/* ============================================================
   Everflow Practice OS — ceo-v2.css  (Update 103 · u103-ceo-ui)
   CEO Dashboard v2: Expenses, Costs, Cash forecast, Client
   satisfaction, vital signs, Sales ideas, the Settings card.
   Cobalt Paper tokens only (styles.css :root); controls reuse
   components.css. Every rule is prefixed .cx- (.cv- is already
   the conversation view).
   ============================================================ */

.cx-wrap { display: flex; flex-direction: column; gap: 12px; }
.cx-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.cx-side { display: grid; gap: 12px; align-content: start; }
/* the expense list needs the width: below 1600px the cost cards sit under it, side by side */
@media (max-width: 1599px) { .cx-grid { grid-template-columns: 1fr; } .cx-side { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
.cx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.cx-card + .cx-card { margin-top: 12px; }
.cx-card h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cx-card h3 .cx-right { margin-left: auto; font-family: var(--font-body); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cx-spacer { flex: 1; }
.cx-meta { font-size: 12px; color: var(--ink-3); }
.cx-faint { font-size: 12px; color: var(--ink-4); }
.cx-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-r { text-align: right; }
.cx-good { color: var(--green); }
.cx-attn { color: var(--amber); }
.cx-urgent { color: var(--red); }
.cx-strong { font-weight: 600; color: var(--text); }
.cx-link { color: var(--accent-ink); cursor: pointer; font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; }
.cx-link:hover { text-decoration: underline; }
button.cx-link { text-align: left; }
.cx-gap { margin-top: 12px; }
.cx-hidden { display: none !important; }

/* ---------- the number strip ---------- */
.cx-score { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.cx-k { flex: 1 1 150px; padding: 12px 16px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cx-k:last-child { border-right: 0; }
.cx-k.is-lead { flex: 1.8 1 240px; }
.cx-k-l { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.cx-k-v { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.cx-k.is-lead .cx-k-v { font-size: 28px; }
.cx-k-v.is-red { color: var(--red); }
.cx-k-v.is-amber { color: var(--amber); }
.cx-k-v.is-green { color: var(--green); }
.cx-k-d { font-size: 12px; color: var(--ink-4); }

/* ---------- toolbar, chips, notices ---------- */
.cx-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cx-toolbar input[type="search"] { width: 200px; height: 30px; font-size: 13px; }
.cx-toolbar input[type="month"], .cx-toolbar select { height: 30px; font-size: 13px; }
.cx-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--border-2); background: var(--surface); font-size: 12px; color: var(--text-2); font-family: var(--font-body); cursor: pointer; white-space: nowrap; }
.cx-chip b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.cx-chip.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.pill.cx-p-info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.cx-p-attn { background: var(--amber-soft); color: var(--amber); }
.pill.cx-p-urgent { background: var(--red-soft); color: var(--red); }
.pill.cx-p-good { background: var(--green-soft); color: var(--green); }
.pill.cx-p-line { background: var(--surface); border: 1px solid var(--border-2); color: var(--text-2); }
.cx-notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.cx-notice.is-attn { background: var(--amber-soft); border-color: rgba(176, 74, 10, .25); }
.cx-notice.is-info { background: var(--accent-soft); border-color: var(--accent-line); }
.cx-notice.is-red { background: var(--red-soft); border-color: rgba(179, 38, 30, .3); }
.cx-notice .ti { font-size: 16px; flex: none; }
.cx-notice > span:not(.cx-spacer) { flex: 1 1 320px; min-width: 0; }

/* ---------- expense groups and rows ---------- */
.cx-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 10px; }
.cx-group-h { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; user-select: none; }
.cx-group-h h4 { margin: 0; font-size: 13.5px; font-family: var(--font-body); font-weight: 600; }
.cx-group-h .cx-meta { margin-left: auto; }
.cx-group-h .ti-chevron-down { transition: transform 150ms var(--ease); color: var(--ink-4); }
.cx-group.is-closed .ti-chevron-down { transform: rotate(-90deg); }
.cx-group.is-closed .cx-rows { display: none; }
.cx-rows { border-top: 1px solid var(--border); }
.cx-erow { display: grid; grid-template-columns: 22px minmax(160px, 1fr) 44px 104px 104px 104px 118px 164px; gap: 8px; align-items: center; padding: 6px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.cx-erow:first-child { border-top: 0; }
.cx-erow.is-sel { background: var(--accent-soft); }
.cx-erow.is-done .cx-ename { color: var(--ink-3); }
.cx-erow.is-flash { animation: cx-flash 900ms var(--ease); }
@keyframes cx-flash { from { background: var(--green-soft); } to { background: transparent; } }
.cx-ename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-ename .pill { margin-left: 4px; }
.cx-bar { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; margin-top: 3px; }
.cx-bar > i { display: block; height: 100%; background: var(--accent); }
.cx-acts { display: flex; gap: 4px; justify-content: flex-end; }
.cx-acts .btn-small { margin-left: 0; }
.cx-head-row { display: grid; grid-template-columns: 22px minmax(160px, 1fr) 44px 104px 104px 104px 118px 164px; gap: 8px; padding: 6px 14px 2px; font-size: 11.5px; color: var(--ink-4); }
@media (max-width: 900px) {
  .cx-erow, .cx-head-row { grid-template-columns: 22px 1fr auto; }
  .cx-erow > .cx-col-hide, .cx-head-row > .cx-col-hide { display: none; }
}
.cx-inline { padding: 8px 14px 10px 44px; border-top: 1px dashed var(--border); background: var(--bg); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.cx-inline input, .cx-inline select { height: 30px; font-size: 13px; margin: 0; }
.cx-inline input[type="number"] { width: 110px; }
.cx-inline input.cx-wide { width: 200px; }
.cx-pays { padding: 2px 14px 8px 44px; font-size: 12px; color: var(--ink-3); }
.cx-menu { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 4px; min-width: 180px; }
.cx-menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; border-radius: 6px; text-align: left; }
.cx-menu button:hover { background: var(--sunken); }
.cx-menu button.is-danger { color: var(--red); }
.cx-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.cx-add input, .cx-add select { height: 30px; margin: 0; font-size: 13px; }

/* ---------- selection bar + undo toast ---------- */
.cx-selbar { position: sticky; bottom: 16px; margin-top: 12px; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; background: var(--text); color: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-pop); flex-wrap: wrap; z-index: 6; }
.cx-selbar b { font-variant-numeric: tabular-nums; }
.cx-selbar .btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .28); color: var(--surface); }
.cx-selbar .btn-ghost:hover { border-color: rgba(255, 255, 255, .6); }
.cx-selbar input, .cx-selbar select { height: 28px; width: 70px; margin: 0; font-size: 12.5px; }
.cx-selbar select { width: auto; }
.cx-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: 13px; z-index: 1000; display: flex; align-items: center; gap: 12px; }
.cx-toast button { background: transparent; color: #9CC2FF; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

/* ---------- costs ---------- */
.cx-big { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cx-big.cx-good { color: var(--green); }
.cx-line { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.cx-line:first-of-type { border-top: 0; }
.cx-line .cx-grow { flex: 1; min-width: 0; }
.cx-line .btn-small { margin-left: 0; }
.cx-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.cx-form input, .cx-form select { height: 30px; margin: 0; font-size: 13px; }
.cx-form input[type="number"] { width: 100px; }
.cx-form input.cx-grow { flex: 1; min-width: 120px; }
.cx-sugg { margin-top: 8px; }
.cx-sugg summary { cursor: pointer; font-size: 12.5px; color: var(--accent-ink); }

/* ---------- dialogs ---------- */
.cx-dialog-back { position: fixed; inset: 0; background: rgba(17, 24, 39, .35); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cx-dialog { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 18px 20px; width: min(460px, 92vw); }
.cx-dialog h3 { margin: 0 0 10px; font-size: 16px; }
.cx-dialog label { display: block; font-size: 12.5px; color: var(--ink-3); margin: 8px 0 3px; }
.cx-dialog input, .cx-dialog select { width: 100%; margin: 0; height: 32px; }
.cx-dialog .cx-radio { display: flex; gap: 14px; font-size: 13px; color: var(--text); }
.cx-dialog .cx-radio label { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--text); font-size: 13px; }
.cx-dialog .cx-radio input { width: auto; height: auto; }
.cx-dialog .cx-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.cx-dialog .form-msg { font-size: 12.5px; color: var(--red); }

/* ---------- forecast ---------- */
.cx-weeks { width: 100%; border-collapse: collapse; font-size: 13px; }
.cx-weeks th { text-align: right; font-size: 11.5px; color: var(--ink-4); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.cx-weeks th:first-child, .cx-weeks td:first-child { text-align: left; }
.cx-weeks td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.cx-weeks tr.cx-wk { cursor: pointer; }
.cx-weeks tr.cx-wk:hover { background: var(--sunken); }
.cx-weeks tr.is-low td { background: var(--amber-soft); }
.cx-weeks tr.is-neg td { background: var(--red-soft); }
.cx-weeks tr.cx-wk-detail td { background: var(--bg); text-align: left; padding: 8px 14px 12px; }
.cx-items { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cx-items { grid-template-columns: 1fr; } }
.cx-items h5 { margin: 0 0 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.cx-it { display: flex; gap: 8px; font-size: 12.5px; padding: 3px 0; border-top: 1px dashed var(--border); }
.cx-it:first-of-type { border-top: 0; }
.cx-it .cx-grow { flex: 1; min-width: 0; }
.cx-it .cx-basis { display: block; font-size: 11.5px; color: var(--ink-4); }
.cx-conf { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.cx-conf.high { background: var(--green); }
.cx-conf.low { background: var(--amber); }
.cx-conf.none { background: var(--ink-4); }
.cx-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.cx-strip .cx-tile { border: 1px solid var(--border); border-radius: var(--r); padding: 8px 12px; min-width: 110px; background: var(--surface); }
.cx-tile b { font-family: var(--font-display); font-size: 15px; font-variant-numeric: tabular-nums; display: block; }
.cx-tile.is-prov { background: var(--amber-soft); border-color: rgba(176, 74, 10, .25); }
.cx-chart { position: relative; height: 260px; }
.cx-chart.is-small { height: 160px; }
.cx-whatif { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.cx-whatif input, .cx-whatif select { height: 28px; margin: 0; font-size: 12.5px; }
.cx-whatif input[type="number"] { width: 80px; }
.cx-whatif select[multiple] { height: 80px; min-width: 220px; }
.cx-cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.cx-mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cx-mini td, .cx-mini th { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.cx-mini th { font-weight: 500; color: var(--ink-4); font-size: 11.5px; }
.cx-mini td:first-child, .cx-mini th:first-child { text-align: left; }
.cx-mini td:not(:first-child) { white-space: nowrap; }

/* ---------- satisfaction + vital signs ---------- */
.cx-vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.cx-vital { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.cx-vital .cx-k-l { display: flex; align-items: center; gap: 6px; }
.cx-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--ink-4); flex: none; }
.cx-dot.green { background: var(--green); }
.cx-dot.amber { background: var(--amber); }
.cx-dot.red { background: var(--red); }
.cx-vital .cx-k-v { font-size: 20px; }
.cx-vital button.cx-link { align-self: flex-start; font-size: 12px; }
.cx-sat-row { padding: 8px 0; border-top: 1px dashed var(--border); font-size: 12.5px; }
.cx-sat-row:first-of-type { border-top: 0; }
.cx-sat-h { display: flex; align-items: center; gap: 8px; }
.cx-sat-h b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-sat-h .btn-small { margin-left: auto; }
.cx-sat-sum { margin-top: 2px; color: var(--ink-2); }
.cx-sat-meta { margin-top: 2px; font-size: 11.5px; color: var(--ink-4); }
@media (min-width: 1200px) { .cx-span2 { grid-column: span 2; } }

/* ---------- sales ideas ---------- */
.cx-idea { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; }
.cx-idea-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.cx-idea-h .cx-val { margin-left: auto; color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-idea p { margin: 4px 0 8px; font-size: 12.5px; color: var(--text-2); }
.cx-idea .cx-acts { justify-content: flex-start; flex-wrap: wrap; }

/* ---------- payment profile badge (Debtors, Quotes) ---------- */
.cx-pp { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.cx-pp.reliable { background: var(--green-soft); color: var(--green); }
.cx-pp.late { background: var(--amber-soft); color: var(--amber); }
.cx-pp.unreliable, .cx-pp.started { background: var(--red-soft); color: var(--red); }
.cx-pp.thin, .cx-pp.none { background: var(--sunken); color: var(--ink-3); }

/* ---------- settings card ---------- */
.cx-switches { display: flex; flex-direction: column; gap: 6px; }
.cx-switches label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.cx-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 14px; margin-top: 10px; }
.cx-set-grid label { font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 3px; }
.cx-set-grid input, .cx-set-grid select { margin: 0; height: 30px; }
.cx-months { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.cx-months label { flex-direction: row; align-items: center; gap: 3px; color: var(--text-2); }
.cx-review { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* fixed input widths (no inline styles) */
.cx-w70 { width: 70px; } .cx-w100 { width: 100px; } .cx-w110 { width: 110px; } .cx-w150 { width: 150px; } .cx-w160 { width: 160px; }

/* Still to cut: two rows per cost so the name never squeezes */
.cx-todo { padding: 8px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.cx-todo:first-of-type { border-top: 0; }
.cx-todo-h { display: flex; gap: 8px; align-items: baseline; }
.cx-todo-h .cx-grow { flex: 1; min-width: 0; }
.cx-todo-a { display: flex; gap: 4px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.cx-todo-a select { height: 28px; margin: 0; font-size: 12.5px; }
.cx-todo-a .btn-small { margin-left: 0; }
