/* =====================================================================
   CMA STUDIO: the agent's CMA presentations workspace (#agent/cma).
   Built on the Money design system: the .money-app shell, .m-* parts and
   --m-* tokens come from money.css. Everything here is cs2- prefixed and
   uses tokens only, so light and dark both work.
   Designed in Figma, page "CMA Presentations".
   ===================================================================== */

/* ---- sidebar ---- */
.cs2-app .cs2-newbtn { justify-content: center; width: 100%; margin: 0 0 6px; padding: 8px 12px; }
.cs2-app .m-nav .cs2-count { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--m-faint); }
.cs2-app .m-nav .cs2-count.warn { color: var(--m-warn); }
.cs2-recent { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; min-width: 0; }
.cs2-recent:hover, .cs2-recent.active { background: var(--m-surface-2); }
.cs2-recent .t { flex: 1; min-width: 0; }
.cs2-recent .n { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs2-recent .k { font-size: 10.5px; color: var(--m-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs2-sidefoot { border-top: 1px solid var(--m-line); padding: 10px 4px 0; display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--m-faint); line-height: 1.4; }
.cs2-sidefoot b { font-size: 11px; font-weight: 600; color: var(--m-muted); }

/* ---- grade badges ---- */
.cs2-grade { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 700; flex-shrink: 0; background: var(--m-surface-2); color: var(--m-muted); }
.cs2-grade.lg { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
.cs2-grade.g-A, .cs2-grade.g-B { background: var(--m-pos-soft); color: var(--m-pos); }
.cs2-grade.g-C { background: var(--m-warn-soft); color: var(--m-warn); }
.cs2-grade.g-D { background: var(--m-neg-soft); color: var(--m-neg); }

/* ---- page heads ---- */
.cs2-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--m-faint); margin-bottom: 3px; }
.cs2-back:hover { color: var(--m-ink); }
.cs2-back svg.i { width: 13px; height: 13px; }
.cs2-sub { font-size: 12.5px; color: var(--m-muted); margin-top: 5px; line-height: 1.45; }
.cs2-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cs2-app .m-head .m-title { overflow-wrap: anywhere; }

/* ---- library ---- */
.cs2-tabbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--m-line); flex-wrap: wrap; }
.cs2-tabbar .m-tabs { border-bottom: 0; }
.cs2-tabbar .m-tab { display: inline-flex; align-items: center; gap: 6px; }
.cs2-tabbar .m-tab i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--m-faint); }
.cs2-sort { font-size: 12px; color: var(--m-faint); padding-bottom: 9px; }
.cs2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.cs2-card { display: flex; flex-direction: column; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 14px; overflow: hidden; box-shadow: var(--m-shadow); transition: border-color .12s, transform .12s, box-shadow .12s; min-width: 0; }
.cs2-card:hover { border-color: var(--m-faint); transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--m-ink) 8%, transparent); }

/* The map-like header: a drawn street grid, not a real map. The street
   offsets come from the presentation id, so a card always looks the same. */
.cs2-map {
  --cs2-road: color-mix(in srgb, var(--m-surface) 72%, transparent);
  position: relative; height: 104px; flex-shrink: 0; overflow: hidden;
  background-color: var(--m-accent-soft);
  background-image:
    linear-gradient(0deg, transparent calc(var(--cs2-h1, 33%) - 1px), var(--cs2-road) calc(var(--cs2-h1, 33%) - 1px), var(--cs2-road) calc(var(--cs2-h1, 33%) + 1px), transparent calc(var(--cs2-h1, 33%) + 1px)),
    linear-gradient(0deg, transparent calc(var(--cs2-h2, 70%) - 1px), var(--cs2-road) calc(var(--cs2-h2, 70%) - 1px), var(--cs2-road) calc(var(--cs2-h2, 70%) + 1px), transparent calc(var(--cs2-h2, 70%) + 1px)),
    linear-gradient(90deg, transparent calc(var(--cs2-v1, 24%) - 1px), var(--cs2-road) calc(var(--cs2-v1, 24%) - 1px), var(--cs2-road) calc(var(--cs2-v1, 24%) + 1px), transparent calc(var(--cs2-v1, 24%) + 1px)),
    linear-gradient(90deg, transparent calc(var(--cs2-v2, 62%) - 1px), var(--cs2-road) calc(var(--cs2-v2, 62%) - 1px), var(--cs2-road) calc(var(--cs2-v2, 62%) + 1px), transparent calc(var(--cs2-v2, 62%) + 1px)),
    linear-gradient(90deg, transparent calc(var(--cs2-v3, 84%) - 1px), var(--cs2-road) calc(var(--cs2-v3, 84%) - 1px), var(--cs2-road) calc(var(--cs2-v3, 84%) + 1px), transparent calc(var(--cs2-v3, 84%) + 1px));
}
.cs2-map::before { content: ""; position: absolute; left: calc(var(--cs2-v2, 62%) + 8px); top: calc(var(--cs2-h1, 33%) + 8px); width: 58px; height: 20px; border-radius: 4px; background: color-mix(in srgb, var(--m-accent) 14%, transparent); }
.cs2-map::after { content: ""; position: absolute; left: calc(var(--cs2-v1, 24%) - 22px); top: calc(var(--cs2-h2, 70%) + 6px); width: 7px; height: 7px; border-radius: 999px; background: color-mix(in srgb, var(--m-muted) 45%, transparent); box-shadow: 150px -46px 0 color-mix(in srgb, var(--m-muted) 45%, transparent), 90px -62px 0 color-mix(in srgb, var(--m-muted) 45%, transparent); }
.cs2-pin { position: absolute; left: var(--cs2-px, 46%); top: var(--cs2-py, 44%); width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 999px; background: var(--m-accent); border: 3px solid var(--m-surface); box-shadow: 0 0 0 6px color-mix(in srgb, var(--m-accent) 18%, transparent); z-index: 1; }
.cs2-map .cs2-grade { position: absolute; top: 12px; left: 12px; background: var(--m-surface); border: 1px solid var(--m-line); z-index: 1; }
.cs2-card-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; flex: 1; min-width: 0; }
.cs2-addr { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs2-meta { font-size: 12px; color: var(--m-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs2-est { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cs2-lbl { font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--m-faint); }
.cs2-est-v { font-size: 20px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.cs2-est-r { font-size: 11.5px; color: var(--m-faint); font-variant-numeric: tabular-nums; }
.cs2-minibar { position: relative; height: 5px; border-radius: 3px; background: var(--m-surface-2); }
.cs2-minibar > i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: color-mix(in srgb, var(--m-accent) 50%, transparent); }
.cs2-minibar > b { position: absolute; top: -2px; width: 2px; height: 9px; margin-left: -1px; border-radius: 1px; background: var(--m-accent); }
.cs2-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--m-line-soft); padding-top: 10px; margin-top: auto; }
.cs2-updated { flex: 1; min-width: 0; font-size: 11px; color: var(--m-faint); white-space: nowrap; }

/* loading skeletons */
.cs2-skel { background: var(--m-surface-2); border-radius: 6px; animation: cs2-pulse 1.4s ease-in-out infinite; }
.cs2-card .cs2-skel.map { height: 104px; border-radius: 0; }
@keyframes cs2-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- builder ---- */
.cs2-builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.cs2-app .cs2-form { padding: 20px 22px; gap: 16px; }
.cs2-section { display: flex; align-items: center; gap: 10px; }
.cs2-step { width: 22px; height: 22px; border-radius: 999px; background: var(--m-accent-soft); color: var(--m-accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cs2-section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cs2-section p { margin: 1px 0 0; font-size: 11.5px; color: var(--m-faint); }
.cs2-divider { height: 1px; background: var(--m-line); }
.cs2-row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) 220px; align-items: end; }
.cs2-row.facts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cs2-row.price { grid-template-columns: minmax(0, 1fr) 260px; }
.cs2-row.one { grid-template-columns: minmax(0, 260px); }
.cs2-row.full { grid-template-columns: minmax(0, 1fr); }
.cs2-hint { font-weight: 400; color: var(--m-faint); }
.cs2-app .m-form textarea { resize: vertical; min-height: 74px; line-height: 1.45; }
.cs2-app .m-form textarea:focus { border-color: var(--m-accent); box-shadow: 0 0 0 3px var(--m-accent-soft); }
.cs2-lookup { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cs2-lookup-info { flex: 1; min-width: 220px; font-size: 12px; line-height: 1.4; padding: 7px 10px; border-radius: 8px; background: var(--m-surface-2); color: var(--m-muted); }
.cs2-lookup-info.ok { background: var(--m-pos-soft); color: var(--m-ink); }
.cs2-lookup-info.warn { background: var(--m-warn-soft); color: var(--m-ink); }
.cs2-form-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.cs2-foot-note { margin-left: auto; font-size: 11.5px; color: var(--m-faint); }
.cs2-busybar { position: relative; height: 3px; border-radius: 2px; overflow: hidden; background: var(--m-accent-soft); }
.cs2-busybar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 2px; background: var(--m-accent); animation: cs2-slide 1.2s ease-in-out infinite; }
@keyframes cs2-slide { 0% { left: -35%; } 100% { left: 100%; } }

.cs2-aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.cs2-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cs2-checks li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--m-muted); }
.cs2-checks li em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--m-faint); }
.cs2-tick { width: 16px; height: 16px; border-radius: 999px; border: 1.5px solid var(--m-line); flex-shrink: 0; position: relative; }
.cs2-checks li.done { color: var(--m-ink); }
.cs2-checks li.done .cs2-tick { background: var(--m-pos); border-color: var(--m-pos); }
.cs2-checks li.done .cs2-tick::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
/* The checklist is live without script: it reads the form's own fields. */
.cs2-app:has(#cs-street:not(:placeholder-shown)) .cs2-ck-street,
.cs2-app:has(#cs-sqft:not(:placeholder-shown)):has(#cs-beds:not(:placeholder-shown)) .cs2-ck-facts,
.cs2-app:has(#cs-client:not(:placeholder-shown)) .cs2-ck-client,
.cs2-app:has(#cs-price:not(:placeholder-shown)) .cs2-ck-price,
.cs2-app:has(#cs-note:not(:placeholder-shown)) .cs2-ck-note { color: var(--m-ink); }
.cs2-app:has(#cs-street:not(:placeholder-shown)) .cs2-ck-street .cs2-tick,
.cs2-app:has(#cs-sqft:not(:placeholder-shown)):has(#cs-beds:not(:placeholder-shown)) .cs2-ck-facts .cs2-tick,
.cs2-app:has(#cs-client:not(:placeholder-shown)) .cs2-ck-client .cs2-tick,
.cs2-app:has(#cs-price:not(:placeholder-shown)) .cs2-ck-price .cs2-tick,
.cs2-app:has(#cs-note:not(:placeholder-shown)) .cs2-ck-note .cs2-tick { background: var(--m-pos); border-color: var(--m-pos); }
.cs2-app:has(#cs-street:not(:placeholder-shown)) .cs2-ck-street .cs2-tick::after,
.cs2-app:has(#cs-sqft:not(:placeholder-shown)):has(#cs-beds:not(:placeholder-shown)) .cs2-ck-facts .cs2-tick::after,
.cs2-app:has(#cs-client:not(:placeholder-shown)) .cs2-ck-client .cs2-tick::after,
.cs2-app:has(#cs-price:not(:placeholder-shown)) .cs2-ck-price .cs2-tick::after,
.cs2-app:has(#cs-note:not(:placeholder-shown)) .cs2-ck-note .cs2-tick::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.cs2-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.cs2-steps li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; }
.cs2-steps li > span { width: 20px; height: 20px; border-radius: 999px; background: var(--m-surface-2); color: var(--m-muted); font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cs2-steps b { display: block; font-size: 12.5px; font-weight: 600; }
.cs2-steps small { display: block; font-size: 11.5px; color: var(--m-faint); margin-top: 1px; line-height: 1.4; }
.cs2-noai { border-radius: 10px; padding: 9px 12px; background: var(--m-accent-soft); color: var(--m-accent); font-size: 11.5px; font-weight: 500; line-height: 1.4; }

/* ---- detail ---- */
.cs2-app .cs2-hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; padding: 0; }
.cs2-hero-main { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cs2-bigrow { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cs2-big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.cs2-bigsub { font-size: 12.5px; color: var(--m-muted); }
.cs2-range { padding-top: 32px; }
.cs2-track { position: relative; height: 10px; border-radius: 5px; background: var(--m-surface-2); }
.cs2-band { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: color-mix(in srgb, var(--m-accent) 30%, transparent); }
.cs2-mark-est { position: absolute; top: -4px; width: 3px; height: 18px; margin-left: -1.5px; border-radius: 2px; background: var(--m-accent); }
.cs2-mark-you { position: absolute; top: -3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 999px; background: var(--m-warn); border: 3px solid var(--m-surface); z-index: 1; }
.cs2-you-tag { position: absolute; bottom: 18px; transform: translateX(-50%); white-space: nowrap; font-size: 10.5px; font-weight: 600; color: var(--m-warn); background: var(--m-warn-soft); padding: 3px 7px; border-radius: 6px; }
.cs2-you-tag.l { transform: translateX(-12px); } .cs2-you-tag.r { transform: translateX(calc(-100% + 12px)); }
.cs2-range-lbl { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; }
.cs2-range-lbl > div { display: flex; flex-direction: column; gap: 1px; }
.cs2-range-lbl > div:nth-child(2) { align-items: center; }
.cs2-range-lbl > div:nth-child(2) .cs2-lbl, .cs2-range-lbl > div:nth-child(2) b { color: var(--m-accent); }
.cs2-range-lbl > div:nth-child(3) { align-items: flex-end; }
.cs2-range-lbl b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cs2-stats { display: flex; gap: 12px 36px; flex-wrap: wrap; padding-top: 4px; }
.cs2-stats .lbl { font-size: 11.5px; font-weight: 500; color: var(--m-faint); }
.cs2-stats .v { font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.cs2-stats .v.pos { color: var(--m-pos); } .cs2-stats .v.neg { color: var(--m-neg); } .cs2-stats .v.warn { color: var(--m-warn); }
.cs2-conf { border-left: 1px solid var(--m-line); padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.cs2-conf-top { display: flex; align-items: center; gap: 12px; }
.cs2-conf-top h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cs2-conf-top p { margin: 2px 0 0; font-size: 11.5px; color: var(--m-muted); line-height: 1.4; }
.cs2-gradebig { width: 52px; height: 52px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #fff; background: var(--m-faint); flex-shrink: 0; }
.cs2-gradebig.g-A, .cs2-gradebig.g-B { background: var(--m-pos); } .cs2-gradebig.g-C { background: var(--m-warn); } .cs2-gradebig.g-D { background: var(--m-neg); }
.cs2-reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cs2-reasons li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; font-size: 12px; line-height: 1.4; }
.cs2-reasons li > i { font-style: normal; font-weight: 700; color: var(--m-faint); }
.cs2-app .m-tile .val.warn { color: var(--m-warn); }
.cs2-conf-note { margin-top: auto; border-radius: 8px; padding: 8px 10px; background: var(--m-surface-2); font-size: 11px; color: var(--m-muted); line-height: 1.4; }

.cs2-comps td { font-variant-numeric: tabular-nums; }
.cs2-comps .idx { width: 28px; color: var(--m-faint); }
.cs2-comps .addr { font-weight: 600; }
.cs2-comps .sub { font-size: 11px; color: var(--m-faint); margin-top: 1px; }
.cs2-net { display: block; font-size: 10.5px; font-weight: 500; color: var(--m-faint); }
.cs2-sim { display: flex; align-items: center; gap: 8px; min-width: 116px; }
.cs2-sim .m-progress { flex: 1; }
.cs2-sim b { font-size: 12px; font-weight: 600; width: 22px; text-align: right; }
.cs2-dropped { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--m-line); font-size: 12px; color: var(--m-muted); }
.cs2-dropped .m-chip { border: 0; cursor: pointer; font-family: inherit; color: var(--m-ink); }
.cs2-dropped .m-chip:hover { background: var(--m-line); }
.cs2-dropped .m-chip[disabled] { opacity: .5; cursor: default; }

.cs2-adj { display: grid; grid-template-columns: minmax(0, 1fr) 120px 84px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--m-line-soft); }
.cs2-adj:first-child { border-top: 0; }
.cs2-adj .n { font-weight: 600; font-size: 12.5px; }
.cs2-adj .k { font-size: 11px; color: var(--m-faint); }
.cs2-adj .v { text-align: right; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs2-div { position: relative; height: 6px; border-radius: 3px; background: var(--m-surface-2); }
.cs2-div::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--m-line); }
.cs2-div > i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.cs2-div > i.pos { left: 50%; background: var(--m-pos); } .cs2-div > i.neg { right: 50%; background: var(--m-neg); }
.cs2-kvs { margin-top: 12px; border-top: 1px solid var(--m-line); padding-top: 6px; }
.cs2-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 5px 0; color: var(--m-muted); }
.cs2-kv b { color: var(--m-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.cs2-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cs2-app .cs2-edit { gap: 12px; }
.cs2-attached { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--m-pos-soft); font-size: 12.5px; margin-bottom: 12px; }
.cs2-attached a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cs2-attach-row { display: flex; gap: 8px; align-items: flex-end; }
.cs2-attach-row .m-field { flex: 1; }
.cs2-app .cs2-attach-row select { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--m-line); border-radius: 8px; background: var(--m-surface); color: var(--m-ink); }

/* ---- narrow screens ---- */
@media (max-width: 1100px) {
  .cs2-builder, .cs2-app .cs2-hero { grid-template-columns: minmax(0, 1fr); }
  .cs2-aside { position: static; }
  .cs2-conf { border-left: 0; border-top: 1px solid var(--m-line); }
}
@media (max-width: 900px) {
  .cs2-app .m-side .cs2-recent, .cs2-app .m-side .cs2-sidefoot { display: none; }
  .cs2-app .m-side .cs2-newbtn { width: auto; margin: 0; flex-shrink: 0; }
  .cs2-row, .cs2-row.price, .cs2-row.one { grid-template-columns: minmax(0, 1fr); }
  .cs2-row.facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs2-big { font-size: 32px; }
  .cs2-adj { grid-template-columns: minmax(0, 1fr) 80px 76px; }
}
