/* CRM: the Pipeline screen (js/ui/screens/pipeline.js) and the Activity timeline shared with the Dialer (js/ui/activity.js). */

/* ---------- Activity timeline + note box ---------- */
.act-panel { display: flex; flex-direction: column; gap: .6rem; }
.act-title { margin: .4rem 0 0; font-size: .85rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
.act-composer { display: flex; flex-direction: column; gap: .35rem; }
.act-input { width: 100%; resize: vertical; min-height: 4rem; }
.act-composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.act-state:empty { display: none; }
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.act-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; padding: .55rem .1rem; border-top: 1px solid var(--divider); }
.act-item:first-child { border-top: 0; }
.act-ico { display: inline-flex; width: 1.7rem; height: 1.7rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-low); color: var(--secondary); }
.act-ico .icon { width: .85rem; height: .85rem; }
.act-note .act-ico { background: #fff6e0; color: #9a6700; }
.act-main { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.act-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: .85rem; }
.act-time { margin-left: auto; font-size: .78rem; color: var(--secondary); white-space: nowrap; }
.act-body { font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.act-del { padding: .1rem; }
.act-del .icon { width: .8rem; height: .8rem; }
.act-empty { margin: .2rem 0; }

/* ---------- Pipeline page ---------- */
.pl-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pl-search { min-width: 14rem; flex: 0 1 20rem; }
.pl-toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--secondary); cursor: pointer; }
.pl-summary { margin-left: auto; }
.pl-hint { margin: -.3rem 0 .7rem; }
.pl-banner { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1rem; margin-bottom: .8rem; border-radius: .7rem; background: #e8f7ef; border: 1px solid #b6e3c9; color: #14532d; font-size: .9rem; }
.pl-banner .icon { width: 1.1rem; height: 1.1rem; flex: none; }
.btn-link { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--primary); text-decoration: underline; cursor: pointer; }

/* Board: one column per stage, scrolling sideways on narrow screens. */
.pl-board { display: grid; grid-template-columns: repeat(var(--pl-cols, 5), minmax(14rem, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.pl-col { display: flex; flex-direction: column; gap: .5rem; min-height: 10rem; padding: .6rem; border-radius: .9rem; background: var(--surface-low); border: 1px dashed transparent; transition: border-color 120ms ease, background-color 120ms ease; }
.pl-col.pl-drop { border-color: var(--primary); background: #edf0f9; }
.pl-col-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .1rem .2rem .3rem; font-size: .9rem; }
.pl-col-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--primary); }
.pl-col-meeting .pl-col-dot { background: #2563eb; }
.pl-col-proposal .pl-col-dot { background: var(--amber, #d97706); }
.pl-col-negotiation .pl-col-dot { background: #7c3aed; }
.pl-col-won .pl-col-dot { background: #10b981; }
.pl-col-lost .pl-col-dot { background: #94a3b8; }
.pl-col-total { flex-basis: 100%; font-size: .8rem; font-weight: 600; color: var(--secondary); }
.pl-cards { display: flex; flex-direction: column; gap: .5rem; }
.pl-empty { text-align: center; padding: 1rem 0; }
.pl-more { text-align: center; }
.pl-card { display: flex; flex-direction: column; gap: .35rem; padding: .7rem .75rem; border-radius: .7rem; background: var(--card); border: 1px solid var(--divider); box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  cursor: grab; transition: box-shadow 140ms ease, transform 140ms ease; }
.pl-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .pl-card:hover { box-shadow: 0 .4rem 1rem -.3rem rgba(15, 23, 42, .18); } }
.pl-card.pl-dragging { opacity: .5; }
.pl-card-title { font-weight: 600; overflow-wrap: anywhere; }
.pl-card-sub { margin-top: -.2rem; }
.pl-card-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.pl-amount { font-variant-numeric: tabular-nums; }
.pl-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.pl-owner-tag { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-client { display: inline-flex; align-items: center; gap: .25rem; color: #047857; font-weight: 600; }
.pl-client .icon { width: .85rem; height: .85rem; }
.pl-make { align-self: flex-start; }
@media (prefers-reduced-motion: reduce) { .pl-card, .pl-col { transition: none; } }

/* Deal and company dialogs */
.pl-deal, .pl-company { display: flex; flex-direction: column; gap: 1rem; }
.pl-about { display: flex; flex-direction: column; gap: .35rem; padding: .75rem .9rem; border-radius: .7rem; background: var(--surface-low); }
.pl-about-facts { display: flex; gap: .4rem 1rem; flex-wrap: wrap; }
.pl-about-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; }
.pl-money { display: flex; gap: .4rem; }
.pl-money input { flex: 1; min-width: 0; }
.pl-money select { width: auto; }
.pl-label { font-size: .85rem; font-weight: 600; }
.pl-deal-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.pl-deal-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; width: 100%; padding: .5rem .7rem; border: 1px solid var(--divider); border-radius: .6rem; background: var(--card); font: inherit; text-align: left; cursor: pointer; }
.pl-deal-row:hover { background: var(--surface-low); }
.pl-acq { display: flex; flex-direction: column; gap: .4rem; }
.pl-rate { display: inline-flex; align-items: center; gap: .35rem; }
.pl-rate input { width: 6rem; }

/* Companies and reports */
.pl-companies { padding: 0; overflow: hidden; }
.pl-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pl-table th { text-align: left; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); padding: .6rem .75rem; border-bottom: 1px solid var(--divider); }
.pl-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--divider); vertical-align: top; }
.pl-row { cursor: pointer; }
.pl-row:hover, .pl-row:focus-visible { background: var(--surface-low); outline: none; }
/* ---------- Dialer additions ---------- */
.dl-deal-tag { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.dl-deal-tag .icon { width: .85rem; height: .85rem; }
.dl-sheet-notes { margin: 0 0 .4rem; padding: .5rem .7rem; border-radius: .5rem; background: var(--surface-low); font-size: .85rem; color: var(--secondary); white-space: pre-wrap; }
.dl-known { padding: .6rem .75rem; border-radius: .6rem; background: #fff6e0; border: 1px solid #f0c96b; font-size: .88rem; display: flex; flex-direction: column; gap: .35rem; }
.dl-known ul { margin: 0; padding-left: 1.1rem; max-height: 8rem; overflow-y: auto; }

/* ---------- Pipeline → Reports (pipeline.js drawReports) ----------
   One accent hue (the brand teal) for every meter, on a lighter step of the same hue; text stays in ink colours.
   Zeros and empty values recede (muted) so the numbers that exist carry the page. */
.pl-report { --pl-ease: cubic-bezier(.23, 1, .32, 1); --pl-track: color-mix(in oklab, var(--primary) 12%, #fff); display: flex; flex-direction: column; gap: 1rem;
  transition: opacity 150ms ease; }
.pl-report[aria-busy="true"] { opacity: .55; }
.pl-report-controls { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pl-range { font-size: .85rem; color: var(--secondary); font-variant-numeric: tabular-nums; }
.pl-report-user { margin-left: auto; width: auto; }
.pl-report-loading { margin: 0; }
.pl-zero { color: var(--muted); opacity: .7; font-weight: 400; }

/* Period: a segmented control, not a dropdown (it is switched often). */
.pl-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: .7rem; background: var(--surface-container); }
.pl-seg-btn { padding: .4rem .8rem; border: 0; border-radius: .55rem; background: transparent; font: inherit; font-size: .85rem; font-weight: 600; color: var(--secondary); cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms var(--pl-ease, ease-out); }
.pl-seg-btn[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 1px 1px rgba(15, 23, 42, .04); }
.pl-seg-btn:active { transform: scale(.97); }
.pl-seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { .pl-seg-btn:hover:not([aria-pressed="true"]) { color: var(--text); } }

/* The funnel: four steps, each with its share of the calls as a meter. */
.pl-funnel { padding: 1.25rem 1.4rem 1.35rem; }
.pl-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pl-step { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 0 1.25rem; min-width: 0; }
.pl-step:first-child { padding-left: 0; }
.pl-step:last-child { padding-right: 0; }
.pl-step + .pl-step { border-left: 1px solid var(--divider); }
.pl-step-label { font-size: .8rem; font-weight: 600; color: var(--secondary); }
.pl-step-value { font-size: 2rem; font-weight: 650; line-height: 1.1; letter-spacing: -.02em; color: var(--text); }
.pl-step-value.pl-zero { font-weight: 500; }
.pl-step-rate { font-size: .8rem; color: var(--secondary); min-height: 1.2em; }
.pl-meter { display: block; height: 6px; margin-top: .45rem; border-radius: 999px; background: var(--pl-track); overflow: hidden; }
.pl-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform-origin: left center; }

/* Deal figures: one quiet row. */
.pl-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.pl-fig { display: flex; flex-direction: column; gap: .25rem; padding: .85rem 1rem; border-radius: .8rem; background: color-mix(in oklab, var(--card) 70%, transparent); border: 1px solid var(--divider); }
.pl-fig-label { font-size: .8rem; font-weight: 600; color: var(--secondary); }
.pl-fig-value { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.pl-fig-value.pl-zero { font-size: .95rem; }

/* Tables: names left, numbers right in aligned columns, reach rate as a thin meter. */
.pl-rsec { padding: 1.15rem 1.35rem .5rem; }
.pl-rsec h2 { margin: 0 0 .85rem; font-size: .95rem; font-weight: 650; }
/* No box inside the card: the table sits on the card itself (the shared .table-wrap draws its own border). */
.pl-rsec .table-wrap { border: 0; border-radius: 0; background: transparent; max-height: none; overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
.pl-rgrid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(16rem, 2fr); gap: 1rem; align-items: start; }
.pl-rtable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pl-rtable th, .pl-rtable td { padding: .85rem .75rem; border-bottom: 1px solid var(--divider); text-align: left; vertical-align: middle; }
.pl-rtable th:first-child, .pl-rtable td:first-child { padding-left: 0; }
.pl-rtable th:last-child, .pl-rtable td:last-child { padding-right: 0; }
.pl-rtable thead th { padding-top: 0; padding-bottom: .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
.pl-rtable tbody tr:last-child > * { border-bottom: 0; }
.pl-rtable tbody th { font-weight: 600; color: var(--text); }
.pl-rtable .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-rtable .reach { width: 10.5rem; padding-left: 1.25rem; }
.pl-rtable td.pl-reach { padding-left: 1.25rem; }
.pl-reach .pl-meter { margin-top: .3rem; height: 4px; }
.pl-reach-num { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; font-variant-numeric: tabular-nums; }
.pl-reach-pct { font-size: .78rem; color: var(--secondary); }
.pl-who { display: inline-flex; align-items: center; gap: .45rem; }
.pl-rempty { margin: 0; padding: .4rem 0 .2rem; font-size: .88rem; color: var(--secondary); }
.pl-open { list-style: none; margin: 0; padding: 0; }
.pl-open li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--divider); font-size: .88rem; }
.pl-open li:last-child { border-bottom: 0; }
.pl-open-n { color: var(--secondary); }
.pl-open-v { font-weight: 600; text-align: right; }

/* First time the view opens: the cards settle in, one after another (never on a period switch). */
.pl-enter > * { animation: pl-in 260ms var(--pl-ease) both; }
.pl-enter > :nth-child(2) { animation-delay: 40ms; }
.pl-enter > :nth-child(3) { animation-delay: 80ms; }
.pl-enter > :nth-child(4) { animation-delay: 120ms; }
@keyframes pl-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .pl-enter > * { animation: pl-fade 200ms ease both; animation-delay: 0ms; }
  .pl-seg-btn { transition: background-color 150ms ease, color 150ms ease; }
  .pl-seg-btn:active { transform: none; }
}
@keyframes pl-fade { from { opacity: 0; } }

@media (max-width: 900px) {
  .pl-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.25rem; }
  .pl-step:nth-child(3) { padding-left: 0; border-left: 0; }
  .pl-step:nth-child(2) { padding-right: 0; }
  .pl-rgrid { grid-template-columns: 1fr; }
  .pl-report-user { margin-left: 0; }
}
