/* Deals board (B-014) and the Add deal form (B-015). Colours only via tokens.css. */

/* ---- Page + toolbar ---- */
.deals-page { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: var(--sp-6) var(--sp-6) 0; }
.deals-toolbar { display: flex; flex-direction: column; gap: var(--sp-4); flex: none; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); min-width: 0; }
.toolbar-row-2 { min-height: 28px; margin-bottom: var(--sp-5); }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.toolbar-right { justify-content: flex-end; flex-wrap: wrap; }

/* View switch: joined square buttons, active one light blue */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-button); }
.view-btn {
  width: 48px; height: var(--control-h); display: grid; place-items: center; color: var(--text);
  background: var(--bg-surface); border-left: 1px solid var(--border); text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}
.view-btn:first-child { border-left: 0; }
.view-btn:hover { background: var(--bg-hover); text-decoration: none; }
.view-btn.is-active { background: var(--view-active-bg); color: var(--blue); box-shadow: inset 0 0 0 1px var(--view-active-border); }

/* Green split "+ Deal" */
.split-btn { display: inline-flex; }
.split-btn .split-main { border-radius: var(--r-md) 0 0 var(--r-md); padding: 0 var(--sp-5) 0 var(--sp-4); }
.split-btn .split-caret { border-radius: 0 var(--r-md) var(--r-md) 0; padding: 0; width: 32px; border-left: 1px solid var(--green-press); }
.split-caret-ic, .split-caret-ic svg { width: 8px; height: 8px; }
.split-btn .ic svg { color: currentColor; }

.deals-count { font-size: var(--fs-md); color: var(--text); white-space: nowrap; }
.deals-count-info { color: var(--text-2); margin-right: var(--sp-4); }

.tool-btn { gap: var(--sp-3); padding: 0 var(--sp-4); white-space: nowrap; }
.tool-btn.is-icon { width: var(--control-h); padding: 0; }
.tool-btn.is-soon { color: var(--text-muted); cursor: default; box-shadow: none; }
.tool-btn.is-soon:hover { background: var(--bg-surface); }
.tool-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tool-caret, .tool-caret svg { width: 8px; height: 8px; }

/* Show closed deals switch */
.switch-wrap { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); cursor: pointer; }
.switch {
  position: relative; width: 28px; height: 16px; padding: 0; border: 0; border-radius: var(--r-pill);
  background: var(--border-strong); cursor: pointer; transition: background var(--t-fast) var(--ease); flex: none;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg-surface); box-shadow: var(--shadow-button); transition: transform var(--t-fast) var(--ease);
}
.switch[aria-checked="true"] { background: var(--blue-bright); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(12px); }
.switch:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Sort: arrow + "Sort by:" + borderless blue select */
.board-sort { display: inline-flex; align-items: center; gap: var(--sp-2); margin-left: var(--sp-5); }
.sort-dir {
  width: 28px; height: 28px; border: 0; border-radius: var(--r-md); background: var(--view-active-bg);
  color: var(--blue); display: grid; place-items: center; cursor: pointer;
}
.sort-dir .ic svg { transition: transform var(--t-med) var(--ease); }
.sort-dir.is-desc .ic svg { transform: rotate(180deg); }
.sort-dir:hover { background: var(--bg-selected); }
.board-sort-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--blue); padding-left: var(--sp-3); }
.board-sort .select-trigger {
  width: auto; height: 28px; padding: 0 var(--sp-4) 0 var(--sp-2); border: 0; box-shadow: none; background: none;
  color: var(--blue); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.board-sort .select-trigger:hover, .board-sort .select-trigger.is-open { background: var(--view-active-bg); }
.board-sort .select-caret { color: var(--blue); }

/* ---- Board: columns side by side, the board scrolls sideways, each column scrolls down ---- */
.board-box { position: relative; flex: 1; min-height: 0; margin: 0 calc(-1 * var(--sp-6)); }
.board {
  height: 100%; display: flex; gap: var(--sp-2); overflow-x: auto; overflow-y: hidden;
  padding: 0 var(--sp-6); overscroll-behavior-x: contain;
}
.board-col {
  flex: 1 0 210px; max-width: var(--column-w); min-width: 210px; display: flex; flex-direction: column; min-height: 0;
}
/* Header with a chevron right edge (and a matching notch on the left after the first column). */
.col-head {
  flex: none; padding: var(--sp-5) var(--sp-7) var(--sp-4) var(--sp-6); background: var(--column-bg);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  border-radius: var(--r-md) 0 0 0;
}
.board-col.is-first .col-head { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.col-name {
  margin: 0; font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-semibold);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-sub { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); margin-top: var(--sp-2); }
.col-body {
  flex: 1; min-height: 0; overflow-y: auto; background: var(--column-bg); margin-right: 10px;
  padding: var(--sp-1) var(--sp-3) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* ---- Card ---- */
.deal-card {
  position: relative; flex: none; background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: var(--sp-3) var(--sp-4) var(--sp-4); cursor: pointer;
  display: flex; flex-direction: column; gap: var(--sp-1);
  transition: box-shadow var(--t-fast) var(--ease);
}
.deal-card:hover { box-shadow: var(--card-shadow-hover); }
.card-labels { display: flex; gap: var(--sp-2); }
.card-labels:empty { display: none; }
.card-label-bar { width: 24px; height: 3px; border-radius: 2px; }
.card-labels { flex-wrap: wrap; }
.card-label.label-blue { background: var(--label-blue); }
.card-label.label-green { background: var(--label-green); }
.card-label.label-yellow { background: var(--label-yellow); }
.card-label.label-red { background: var(--label-red); }
.card-label.label-purple { background: var(--label-purple); }
.card-label.label-grey { background: var(--label-grey); }
.card-label.label-brown { background: var(--label-brown); }
.card-label.label-orange { background: var(--label-orange); }
.card-label.label-darkgrey { background: var(--label-darkgrey); }
.card-label.label-pink { background: var(--label-pink); }
.card-quality { background: var(--text-muted); }
.card-quality.quality-hot { background: var(--quality-hot); }
.card-quality.quality-medium { background: var(--quality-medium); }
.card-quality.quality-unsure { background: var(--quality-unsure); }
.card-quality.quality-low { background: var(--quality-low); }
.card-quality.quality-not_good { background: var(--quality-not-good); }
.card-title-row { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.card-title {
  flex: 0 1 auto; min-width: 0; color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: var(--fw-semibold);
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title:hover { color: var(--link); text-decoration: none; }
.card-new {
  flex: none; margin-top: 2px; height: 16px; padding: 0 var(--sp-3); border-radius: var(--r-pill);
  background: var(--new-pill-bg); color: var(--text-inverse); font-size: 10px; line-height: 16px;
  font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.3px;
}
.card-who {
  font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Fix round (Build A): the 'New reply' pill / 'Reply?' + activity icon (`card-meta-end`) stay together at the right;
   on a card too narrow for everything they wrap to their own line, so the activity icon never leaves the card. */
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-3);
  min-height: 20px; min-width: 0;
}
.card-meta-end { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-3); max-width: 100%; }
.card-avatar {
  width: 16px; height: 16px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--label-darkgrey); color: var(--text-inverse); font-size: 7px; font-weight: var(--fw-semibold); line-height: 1;
}
.card-value {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-size: var(--fs-xs); line-height: var(--lh-sm); font-weight: var(--fw-semibold); color: var(--text-2); white-space: nowrap;
}
.card-rot {
  flex: none; height: 16px; padding: 0 var(--sp-3); border-radius: var(--r-pill); background: var(--rotting-pill);
  color: var(--text-inverse); font-size: 10px; line-height: 16px; font-weight: var(--fw-semibold);
}
.card-reply {
  flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--reply-blue);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.card-reply .ic, .card-reply .ic svg { width: 14px; height: 14px; }

/* Activity state icon: yellow triangle (none), green (today), red (overdue), grey (planned). */
.act-icon {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; flex: none;
  display: grid; place-items: center; cursor: pointer; transition: box-shadow var(--t-fast) var(--ease);
}
.act-icon .ic, .act-icon .ic svg { width: 16px; height: 16px; }
.act-icon.none { color: var(--act-none); }
.act-icon.today { color: var(--act-today); }
.act-icon.overdue { color: var(--act-overdue); }
.act-icon.planned { color: var(--act-planned); }
.deal-card:hover .act-icon, .act-icon:focus-visible { box-shadow: 0 0 0 3px var(--bg-surface), 0 0 0 4px var(--act-ring); outline: none; }

/* Card states */
.deal-card.rotting { background: var(--rotting-bg); }
.deal-card.rotting:hover .act-icon { box-shadow: 0 0 0 3px var(--rotting-bg), 0 0 0 4px var(--act-ring); }
.deal-card.won { background: var(--won-bg); box-shadow: inset 3px 0 0 var(--won-edge), var(--card-shadow); }
.deal-card.lost { background: var(--lost-bg); box-shadow: inset 3px 0 0 var(--lost-edge), var(--card-shadow); }
.deal-card.won:hover { box-shadow: inset 3px 0 0 var(--won-edge), var(--card-shadow-hover); }
.deal-card.lost:hover { box-shadow: inset 3px 0 0 var(--lost-edge), var(--card-shadow-hover); }
.deal-card.won .card-title { color: var(--won-edge); }
.deal-card.lost .card-title { color: var(--lost-edge); }
/* BUG-054: deleted cards under 'All deleted deals' are muted and never draggable. */
/* BUG-065: they have no page to open, so no pointer, no hover lift, and the title is plain text. */
.deal-card.deleted { background: var(--column-bg); box-shadow: inset 3px 0 0 var(--border-strong); cursor: not-allowed; }
.deal-card.deleted:hover { box-shadow: inset 3px 0 0 var(--border-strong); }
.deal-card.deleted .card-title { color: var(--text-muted); text-decoration: line-through; cursor: not-allowed; }
.deal-card.deleted .card-title:hover { text-decoration: line-through; color: var(--text-muted); }
.deal-card.deleted .card-meta, .deal-card.deleted .card-who, .deal-card.deleted .card-labels { opacity: .6; }
/* The switch reads on for a closed-deal filter but is not the saved choice. */
.switch-wrap.is-forced { cursor: default; }
.switch-wrap.is-forced .switch { opacity: .6; }

/* Loading skeleton */
.board.is-loading .deal-card { cursor: default; box-shadow: none; gap: var(--sp-4); padding: var(--sp-5) var(--sp-4); }
.deal-card .skeleton-bar.is-short { width: 50%; }
.col-skel-title { width: 60%; height: 14px; }
.col-skel-sub { width: 35%; height: 10px; margin-top: var(--sp-4); }

/* Empty pipeline */
.board-empty {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%); width: min(360px, calc(100% - 32px));
  background: var(--bg-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-popover);
  padding: var(--sp-7); display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); text-align: center;
}
.board-empty-art, .board-empty-art svg { width: 120px; height: 88px; }
.board-empty-title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: var(--fw-semibold); }
.board-empty-text { color: var(--text-2); font-size: var(--fs-sm); }

/* ---- Add deal modal (~663px, two columns) ---- */
.deal-modal .modal-body { padding: 0; display: block; }
.deal-form { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
.deal-col { display: flex; flex-direction: column; gap: var(--sp-5); padding: var(--sp-6); min-width: 0; }
.deal-col-right { border-left: 1px solid var(--border); padding-top: var(--sp-7); }
.deal-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.deal-label { font-size: var(--fs-md); line-height: var(--lh-md); color: var(--text); }
.deal-field.is-invalid .input, .deal-field.is-invalid .lookup { border-color: var(--red); }
.deal-value-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--sp-4); }
.deal-stage-box { display: flex; flex-direction: column; gap: var(--sp-4); }
.deal-caption { display: flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.3px; }
.deal-caption-line { flex: 1; height: 1px; background: var(--border); }
.deal-contact-rows { display: flex; flex-direction: column; gap: var(--sp-4); }
.deal-contact-row { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: var(--sp-4); }
.deal-contact-row .input:disabled { background: var(--field-disabled-bg); border-color: var(--border); cursor: default; }
.deal-person-hint { font-size: var(--fs-sm); color: var(--text-2); }
.deal-custom:empty { display: none; }
.link-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: calc(-1 * var(--sp-2));
  padding: 0; border: 0; background: none; color: var(--link); font-weight: var(--fw-semibold); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }
.deal-field .select-trigger[aria-disabled="true"] { cursor: default; color: var(--text-muted); }

/* Pipeline stage chevron bar: segments up to the picked stage are green */
.stage-pick { display: flex; height: 24px; }
.stage-pick-seg {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; cursor: pointer; margin-left: -4px;
  background: var(--stage-pick-bg); transition: background var(--t-fast) var(--ease);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%);
}
.stage-pick-seg:first-child { margin-left: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.stage-pick-seg:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 8px 50%); }
.stage-pick-seg:hover { background: var(--stage-pick-hover); }
.stage-pick-seg.is-on { background: var(--stage-pick-on); }
.stage-pick-seg:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }

/* Lookup field (contact person, organization): icon, input, NEW pill */
.lookup {
  display: flex; align-items: center; gap: var(--sp-3); height: var(--control-h); padding: 0 var(--sp-3) 0 var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface);
}
.lookup.is-focused { border-color: var(--border-focus); }
.lookup-ic { color: var(--text-2); }
.lookup-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; padding: 0; }
.lookup-pill {
  flex: none; height: 16px; padding: 0 var(--sp-3); border-radius: var(--r-pill); background: var(--new-pill-bg);
  color: var(--text-inverse); font-size: 10px; line-height: 16px; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.3px;
}
.popover.lookup-pop { padding: var(--sp-4) 0; }
.lookup-matches { max-height: 288px; overflow-y: auto; overscroll-behavior: contain; }
.lookup-row {
  display: flex; flex-direction: column; justify-content: center; min-height: var(--menu-row-h);
  padding: var(--sp-3) var(--sp-6); cursor: pointer;
}
.lookup-name { font-size: var(--fs-md); line-height: var(--lh-md); }
.lookup-sub { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.lookup-add { flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--sp-4); color: var(--link); font-weight: var(--fw-semibold); }
.lookup-row.is-highlighted { background: var(--menu-hover-bg); color: var(--menu-hover-text); }
.lookup-row.is-highlighted .lookup-sub { color: var(--menu-hover-text); }

@media (prefers-reduced-motion: reduce) {
  .deal-card, .act-icon, .switch, .switch-knob, .sort-dir .ic svg { transition: none; }
}

/* ---- Drag and drop (B-016) ---- */
body.is-board-dragging, body.is-board-dragging * { cursor: grabbing !important; user-select: none; }
.deal-card .card-title { -webkit-user-drag: none; }
.deal-card.is-drag-source { visibility: hidden; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: var(--z-drag); pointer-events: none; margin: 0;
  box-shadow: var(--card-shadow-drag); will-change: transform;
}
.drag-ghost.won, .drag-ghost.lost { box-shadow: var(--card-shadow-drag); }
.board-col.drop-target .col-head, .board-col.drop-target .col-body { background: var(--column-drop-bg); }
.col-head, .col-body { transition: background var(--t-fast) var(--ease); }

.drop-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--drop-bar-h); z-index: calc(var(--z-drag) - 1);
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-6);
  background: var(--drop-bar-bg); box-shadow: var(--drop-bar-shadow);
  transform: translateY(100%); transition: transform 500ms var(--ease-enter);
}
.drop-bar.is-open { transform: translateY(0); }
.drop-zone {
  flex: 1 1 0; min-width: 0; height: 48px; border-radius: 6px; border: 6px dashed var(--drop-zone-border);
  display: grid; place-items: center; font-size: 13px; font-weight: var(--fw-semibold); letter-spacing: 0.2px;
  text-transform: uppercase; color: var(--drop-zone-text); background: var(--drop-bar-bg);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.drop-zone-lost { color: var(--drop-lost); }
.drop-zone-won { color: var(--drop-won); }
.drop-zone.hover { border-style: solid; border-color: var(--drop-zone-hover-bg); background: var(--drop-zone-hover-bg); color: var(--drop-zone-text); }
.drop-zone-lost.hover { border-color: var(--drop-lost); background: var(--drop-lost); color: var(--text-inverse); }
.drop-zone-won.hover { border-color: var(--drop-won); background: var(--drop-won); color: var(--text-inverse); }

/* Mark as lost / Move deal modals */
.lost-form, .moveto-form { display: flex; flex-direction: column; gap: var(--sp-6); }
.lost-field { display: flex; flex-direction: column; gap: var(--sp-3); }
.lost-label { font-size: var(--label-fs); font-weight: var(--fw-regular); color: var(--text); }
.lost-comment { min-height: 64px; height: auto; padding: var(--sp-4); resize: vertical; line-height: var(--lh-md); }
.lost-planned-list { margin: 0; padding-left: var(--sp-5, 20px); font-size: var(--fs-sm); color: var(--text-2); }
.lost-planned-check { display: flex; align-items: center; gap: var(--sp-2, 6px); font-size: var(--fs-sm); }
.lost-hint { font-size: var(--fs-sm); color: var(--text-2); }
.native-select { appearance: auto; cursor: pointer; }
.moveto-form .select-trigger { width: 100%; }

/* ---- Column quick add (B-017): grey "+" on a hovered column ---- */
.col-add {
  flex: none; width: 100%; height: var(--col-add-h); border: 1px dashed var(--col-add-border); border-radius: 6px;
  background: transparent; color: var(--col-add-icon); display: grid; place-items: center; cursor: pointer;
  visibility: hidden; opacity: 0; transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.col-add .ic, .col-add .ic svg { width: 16px; height: 16px; }
.board-col:hover .col-add, .col-add:focus-visible { visibility: visible; opacity: 1; }
.col-add:hover { background: var(--col-add-hover-bg); color: var(--text-2); border-style: solid; }
.col-add:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
body.is-board-dragging .col-add, .board.is-loading .col-add { display: none; }

/* ---- Pipeline switcher (B-018) ---- */
.pipeline-switch[aria-expanded="true"] { background: var(--bg-selected); border-color: var(--view-active-border); }
.pipeline-menu { min-width: var(--pipeline-menu-w); max-height: 420px; overflow-y: auto; }
.pipeline-menu .menu-item.is-current { font-weight: var(--fw-semibold); }
.menu-check { margin-left: auto; color: var(--menu-check); }
.menu-check svg { width: 16px; height: 16px; color: var(--menu-check); }
.menu-item:hover .menu-check svg, .menu-item:focus-visible .menu-check svg { color: var(--menu-hover-text); }
.menu-item.menu-item-link { color: var(--link); }
.menu-item.menu-item-link svg { width: 16px; height: 16px; color: var(--link); }
.menu-item.menu-item-link:hover, .menu-item.menu-item-link:hover svg { color: var(--menu-hover-text); }
.pipeline-new-form { display: flex; flex-direction: column; gap: var(--sp-5); }
.pipeline-new-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.pipeline-new-field.is-invalid .input { border-color: var(--red); }
@media (prefers-reduced-motion: reduce) { .col-add { transition: none; } }

/* ---- Deal status buttons (B-026): Won / Lost, or a WON / LOST pill + Reopen ---- */
.record-head { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.record-head .record-title { margin: 0; flex: 1; min-width: 0; }
.deal-status { display: inline-flex; align-items: center; gap: var(--sp-4); }
.deal-status .btn { min-width: 62px; height: var(--control-h); font-weight: var(--fw-semibold); }
.btn-won { background: var(--green); border-color: var(--green); color: var(--text-inverse); }
.btn-won:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn-won:active { background: var(--green-press); }
.btn-lost { background: var(--red); border-color: var(--red); color: var(--text-inverse); }
.btn-lost:hover { background: var(--red-hover); border-color: var(--red-hover); }
.deal-status .btn:disabled { opacity: 0.7; cursor: default; }
.deal-status .btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.deal-status-pill {
  display: inline-flex; align-items: center; height: var(--control-h); padding: 0 var(--sp-5);
  border-radius: var(--r-md); color: var(--text-inverse); font-size: var(--fs-md); font-weight: var(--fw-semibold);
  letter-spacing: 0.3px; animation: status-pill-in var(--t-med) var(--ease-enter);
}
.deal-status-pill.is-won { background: var(--pill-won); }
.deal-status-pill.is-lost { background: var(--pill-lost); }
@keyframes status-pill-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

/* ---- Pipeline edit mode (B-019, components/pipeline-editor.js) ---- */
.pe { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pe-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); padding-bottom: var(--sp-5); }
.pe-name-wrap { display: flex; align-items: flex-start; gap: var(--sp-4); font-size: var(--fs-md); }
.pe-name-label { line-height: var(--control-h); white-space: nowrap; }
.pe-name-field { display: flex; flex-direction: column; }
.pe-name { width: 176px; }
.pe-bar-right { display: flex; align-items: center; gap: var(--sp-5); }
.pe-prob-wrap { font-size: var(--fs-md); font-weight: var(--fw-regular); color: var(--text); }
.pe-info, .pe-info svg, .pe-tip .ic, .pe-tip svg { width: 16px; height: 16px; display: block; color: var(--text-2); }
.pe-bar-sep { width: 1px; height: 24px; background: var(--border); }
.pe-error { font-size: var(--fs-sm); color: var(--red); padding-bottom: var(--sp-4); }
.pe-error:empty { display: none; }
.pe-stages { display: flex; gap: var(--sp-3); flex: 1; min-height: 0; overflow-x: auto; padding-bottom: var(--sp-4); }
.pe-stage {
  flex: none; width: 258px; display: flex; flex-direction: column; background: var(--column-bg);
  border-radius: var(--r-md) var(--r-md) 0 0; transition: box-shadow var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.pe-stage.is-dragging { box-shadow: var(--shadow-raised); opacity: 0.85; }
.pe.is-sorting, .pe.is-sorting * { cursor: grabbing !important; user-select: none; }
.pe-stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-6) var(--sp-5); border-bottom: 1px solid var(--border);
}
.pe-stage-head-text { min-width: 0; }
.pe-stage-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: var(--lh-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-stage-prob-line { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--text-2); }
.pe-stage-prob-line .ic, .pe-stage-prob-line svg { width: 12px; height: 12px; display: block; }
.pe-handle {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); cursor: grab; touch-action: none;
}
.pe-handle:hover { background: var(--bg-hover); }
.pe-handle:focus-visible { outline: 2px solid var(--border-focus); }
.pe-handle .ic, .pe-handle svg { width: 16px; height: 16px; display: block; }
.pe-stage-body { flex: 1; display: flex; flex-direction: column; gap: var(--sp-6); padding: var(--sp-7) var(--sp-6); }
.pe-field { display: flex; flex-direction: column; gap: var(--sp-3); }
.pe-label { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-md); color: var(--text); }
.pe-field .input { width: 100%; }
.pe-rot { font-size: var(--fs-md); font-weight: var(--fw-regular); color: var(--text); }
.pe-rot .pe-tip { margin-left: auto; }
.pe-rot-days[hidden] { display: none; }
.pe-field-error { font-size: var(--fs-sm); color: var(--red); }
.pe-field-error:empty { display: none; }
.pe .input.is-invalid { border-color: var(--red); }
.pe-stage-foot { padding: var(--sp-5) var(--sp-6); }
.pe-stage-delete {
  display: inline-flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-2); font: inherit; font-size: var(--fs-md); font-weight: var(--fw-semibold); cursor: pointer;
}
.pe-stage-delete:hover:not(:disabled) { background: var(--bg-hover); color: var(--red); }
.pe-stage-delete:disabled { opacity: 0.5; cursor: not-allowed; }
.pe-stage-delete .ic, .pe-stage-delete svg { width: 16px; height: 16px; display: block; }
.pe-new {
  flex: none; width: 258px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-5); padding: var(--sp-6); text-align: center;
}
.pe-new-title { font-size: var(--fs-xl); font-weight: var(--fw-regular); }
.pe-new-text { font-size: var(--fs-md); color: var(--text-2); }
.pe-add { display: inline-flex; align-items: center; gap: var(--sp-3); }
.pe-add .ic, .pe-add svg { width: 14px; height: 14px; display: block; }
.pe-load-error { padding: var(--sp-6); color: var(--text-2); }
.pe-move-text { margin: 0 0 var(--sp-5); }
.pe-move .select-trigger { width: 100%; }
/* Build B (suggestions-design.md C): under a convert field the AI filled in, until it is edited. */
.deal-ai-hint { font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-1, 2px); }
.deal-ai-spark { color: var(--gold); }
