/* ---------------------------------------------------------------------------
   Opportunities depth pass (GHL-TEARDOWN-OPPORTUNITIES.md): the record
   drawer (orx-*), the pipelines page and editor (ppl-*), and the board's
   quick actions, smart tags, stage colours and drop zones.
--------------------------------------------------------------------------- */

.g-btn.is-danger { background: #d92d20; border-color: #d92d20; color: #fff; }
.g-btn.is-danger:hover:not(:disabled) { background: #b42318; border-color: #b42318; }

/* ---------- record drawer ---------- */
.orx-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, 0); z-index: 60; transition: background .15s; }
.orx-backdrop.is-open { background: rgba(16, 24, 40, .35); }
.orx {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(1040px, 100vw);
  background: var(--surface); display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(16, 24, 40, .18);
  transform: translateX(24px); opacity: 0; transition: transform .15s, opacity .15s;
}
.orx-backdrop.is-open .orx { transform: none; opacity: 1; }
.orx-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.orx-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.orx-crumb.is-current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.orx-grow { flex: 1; }
.orx-iconbtn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 0 4px;
}
.orx-iconbtn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.orx-iconbtn:disabled { opacity: .35; cursor: default; }
.orx-ico { display: inline-flex; }
.orx-split { flex: 1; display: flex; min-height: 0; }
.orx-main { flex: 1; overflow-y: auto; min-width: 0; }
.orx-top { padding: 16px 22px 14px; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; }
.orx-chip-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.orx-chip { font-size: 11.5px; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 8px; }
.orx-name { width: 100%; border: 1px solid transparent; border-radius: 7px; font: 600 20px/28px Inter, system-ui, sans-serif; padding: 2px 6px; margin-left: -6px; background: none; color: var(--text); }
.orx-name:hover, .orx-name:focus { border-color: var(--line); background: var(--surface); outline: none; }
.orx-topgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.orx-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.orx-label { font-size: 12.5px; font-weight: 500; color: #475467; }
.orx-input {
  width: 100%; box-sizing: border-box; border: 1px solid #d0d5dd; border-radius: 8px; padding: 7px 10px; font: 14px/20px Inter, system-ui, sans-serif;
  background: var(--surface); color: var(--text);
}
.orx-input:focus { outline: none; border-color: #84adff; box-shadow: 0 0 0 3px #d1e0ff; }
.orx-input.orx-narrow { width: auto; min-width: 140px; }
.orx-money { display: flex; align-items: center; border: 1px solid #d0d5dd; border-radius: 8px; overflow: hidden; background: var(--surface); }
.orx-money .orx-input { border: 0; box-shadow: none; }
.orx-cur { padding: 0 8px; color: var(--muted); font-size: 12.5px; border-right: 1px solid var(--line); }
.orx-progress { display: flex; gap: 4px; margin-top: 6px; overflow-x: auto; padding-bottom: 2px; }
.orx-step {
  flex: 1; min-width: 96px; border: 0; border-radius: 6px; background: #eaecf0; color: #475467; font-size: 12px; padding: 6px 8px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer; text-align: left;
}
.orx-step.is-done { background: #d1e0ff; color: #1d4ed8; }
.orx-step.is-current { background: var(--brand); color: #fff; }
.orx-step-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.orx-step-tag { font-size: 10.5px; opacity: .85; }
.orx-body { padding: 18px 22px 40px; }
.orx-rail { width: 76px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; padding: 10px 6px; background: #fbfcfe; overflow-y: auto; }
.orx-rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; border-radius: 8px;
  padding: 8px 2px; color: var(--muted); cursor: pointer; font-size: 10.5px;
}
.orx-rail-item:hover { background: var(--hover); color: var(--text); }
.orx-rail-item.is-active { background: var(--brand-soft); color: var(--brand); }
.orx-rail-count { position: absolute; top: 3px; right: 10px; background: var(--brand); color: #fff; border-radius: 9px; font-size: 10px; min-width: 16px; padding: 0 4px; line-height: 16px; }
.orx-foot { display: none; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.orx-foot.is-dirty { display: flex; }
.orx-unsaved { font-weight: 600; color: #b54708; }
.orx-panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.orx-panel-title { font-size: 16px; font-weight: 600; flex: 1; }
.orx-section { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 4px; margin-bottom: 14px; }
.orx-section-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 10px 0 10px; }
.orx-section > .orx-section-title { margin-top: 0; }
.orx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.orx-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.orx-dim { color: var(--muted); font-size: 12.5px; }
.orx-p { margin: 0 0 10px; color: #344054; font-size: 14px; }
.orx-req { color: #d92d20; }
.orx-tags, .orx-followers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.orx-tag { display: inline-flex; align-items: center; gap: 4px; background: #f2f4f7; border: 1px solid #eaecf0; border-radius: 14px; padding: 2px 9px; font-size: 12px; }
.orx-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.orx-add { width: auto; min-width: 150px; }
.orx-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.orx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.orx-check.is-clash { color: #d92d20; font-weight: 600; }
.orx-meta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-size: 13px; padding-top: 6px; }
.orx-compose { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.orx-task-form { flex-direction: row; flex-wrap: wrap; align-items: center; }
.orx-task-form .orx-input { flex: 1; min-width: 150px; }
.orx-note, .orx-task, .orx-appt, .orx-pay, .orx-assoc, .orx-msg { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; }
.orx-note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.orx-note-body { white-space: pre-wrap; font-size: 14px; }
.orx-scope { font-size: 11px; font-weight: 600; background: #f2f4f7; color: #475467; border-radius: 6px; padding: 1px 7px; text-transform: capitalize; }
.orx-task { display: flex; align-items: center; gap: 10px; }
.orx-task-main { flex: 1; }
.orx-task.is-done .orx-task-title { text-decoration: line-through; color: var(--muted); }
.orx-appt, .orx-pay, .orx-assoc { display: flex; align-items: center; gap: 10px; }
.orx-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.orx-msg.is-in { background: #f9fafb; }
.orx-msg.is-out { background: var(--brand-soft); }
.orx-empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13.5px; }
.orx-loading { color: var(--muted); padding: 20px; }
.orx-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.orx-seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; font-size: 13px; }
.orx-seg button.is-on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.orx-menu { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; width: 220px; }
.orx-menu-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); padding: 6px 8px 4px; }
.orx-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.orx-menu-item:hover:not(:disabled) { background: var(--hover); }
.orx-menu-item:disabled { opacity: .45; cursor: default; }
.orx-menu-item.is-danger { color: #d92d20; }
.orx-lr, .orx-cpick { position: relative; display: flex; align-items: center; gap: 4px; }
.orx-lr-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(16, 24, 40, .14); margin-top: 4px; max-height: 240px; overflow-y: auto; padding: 4px; }
.orx-lr-menu.is-open { display: block; }
.orx-lr-opt { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.orx-lr-opt:hover { background: var(--hover); }
.orx-lr-opt.is-create { color: var(--brand); font-weight: 600; }
.orx-lr-empty { padding: 8px 9px; color: var(--muted); font-size: 13px; }
.orx-form-section { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 12px; }

/* ---------- board additions ---------- */
.oppo { cursor: pointer; }
.oppo.can-drag { cursor: grab; -webkit-touch-callout: none; }
/* The card in flight (public/opportunities-drag.js) and the board under it. */
.oppo-ghost { position: fixed; left: 0; top: 0; z-index: 70; margin: 0; pointer-events: none; cursor: grabbing; box-shadow: 0 12px 28px rgba(16, 24, 40, .18); opacity: .95; will-change: transform; }
body.oppo-dragging, body.oppo-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.oppo.dragging { opacity: .35; }
.oppo.moving { opacity: .6; pointer-events: none; }
.col.collapsed.over { outline: 2px dashed var(--brand); outline-offset: -2px; }
.oppo.compact { padding: 8px 10px; }
.oppo.compact .oppo-field { margin-top: 3px; }
.oppo.tinted { background: color-mix(in srgb, var(--stage) 10%, white); border-color: color-mix(in srgb, var(--stage) 35%, white); }
.oppo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stage, var(--brand)); flex-shrink: 0; margin-top: 5px; }
.col.has-color { border-top: 3px solid var(--stage); }
.col-name .oppo-dot { margin-top: 0; }
.oppo-smart { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.oppo-quick { display: flex; gap: 4px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.oppo-qa { position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; width: 30px; height: 26px; cursor: pointer; color: var(--muted); font-size: 13px; }
.oppo-qa:hover:not(:disabled) { color: var(--brand); border-color: #b2ccff; }
.oppo-qa:disabled { opacity: .4; cursor: default; }
.oppo-qa-count { position: absolute; top: -7px; right: -7px; background: var(--brand); color: #fff; border-radius: 9px; font-size: 9.5px; min-width: 15px; line-height: 15px; padding: 0 3px; }
.ppl-tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 1px 8px; color: var(--tag, #2563eb); background: color-mix(in srgb, var(--tag, #2563eb) 12%, white); border: 1px solid color-mix(in srgb, var(--tag, #2563eb) 30%, white); }
button.ppl-tag { cursor: pointer; }
.oppo-weight button { font-size: 12.5px; padding: 0 10px; }
.board-wrap { position: relative; }
/* Every stage is a full-height lane, as on GHL's board, so a short stage
   still shows where a dragged card can go. */
.board-wrap .board { align-items: stretch; }
.oppo-dropzones { display: none; position: fixed; left: calc(var(--rail-w) + 24px); right: 24px; bottom: 18px; z-index: 40; gap: 12px; }
body.oppo-dragging .oppo-dropzones { display: flex; }
.oppo-zone { flex: 1; height: 64px; border-radius: 10px; display: grid; place-content: center; font-weight: 700; letter-spacing: .04em; border: 2px dashed; }
.oppo-zone.lost { background: #fef3f2; color: #d92d20; border-color: #fda29b; }
.oppo-zone.abandoned { background: #eff8ff; color: #1570ef; border-color: #84caff; }
.oppo-zone.won { background: #ecfdf3; color: #039855; border-color: #6ce9a6; }
.oppo-zone.over { filter: brightness(.95); border-style: solid; }
.ol-row { cursor: pointer; }
.ol-row:hover td { background: var(--hover); }

/* ---------- pipelines ---------- */
.ppl-empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ppl-empty-title { font-size: 17px; font-weight: 600; }
.ppl-nomatch { text-align: center; padding: 26px; }
.ppl-grip { color: var(--dim); cursor: grab; width: 24px; }
tr.ppl-over td { background: var(--brand-soft); }
.ppl-acts { display: flex; gap: 2px; }
.ppl-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; }
.ppl-tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; }
.ppl-tabs button.is-on { color: var(--brand); border-bottom-color: var(--brand); }
.ppl-stage-head { display: flex; align-items: center; gap: 10px; }
.ppl-stage-head .grow { flex: 1; }
.ppl-stages td { vertical-align: middle; }
.ppl-move { white-space: nowrap; width: 64px; }
.ppl-color { width: 36px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.ppl-prob { display: flex; align-items: center; gap: 4px; width: 90px; }
.ppl-opts { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.ppl-modes { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0; }
.ppl-preview { margin-top: 8px; }
.ppl-preview-card { width: 260px; background: #eef1f5; border-radius: 10px; padding: 10px; margin-top: 6px; }
.ppl-preview-card.mode-dot .ppl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stage); display: inline-block; margin-right: 6px; }
.ppl-preview-card.mode-bgTint .ppl-preview-opp { background: color-mix(in srgb, var(--stage) 10%, white); }
.ppl-preview-stage { font-weight: 600; font-size: 13px; }
.ppl-preview-opp { background: var(--surface); border-radius: 8px; padding: 8px; margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.ppl-tags table { margin-top: 8px; }
.ppl-prebuilt { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.ppl-tag.is-prebuilt { padding: 4px 10px; }
.ppl-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ppl-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.ppl-swatch.is-on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }
.ppl-rule { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ppl-rule-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; }
.ppl-rule-row .grow { flex: 1; }
.ppl-subs { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ppl-warn { margin: 0 0 14px; padding-left: 18px; color: #344054; font-size: 14px; }
.ppl-setting { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ppl-card-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.ppl-card-preview { margin-top: 6px; cursor: default; }
.ppl-modal .gcs-modal-body { max-height: calc(100vh - 220px); overflow-y: auto; }

@media (max-width: 720px) {
  .orx-rail { width: 56px; }
  .orx-rail-label { display: none; }
  .orx-two, .ppl-card-grid { grid-template-columns: 1fr; }
  .oppo-dropzones { left: 12px; right: 12px; }
}

/* Inside a modal the body scrolls and clips, so the picker's list opens in
   the flow instead of floating over it. */
.gcs-modal .orx-lr, .gcs-modal .orx-cpick { flex-wrap: wrap; }
.gcs-modal .orx-lr-menu { position: static; flex-basis: 100%; box-shadow: none; }
.orx-cpick > .orx-input, .orx-lr > .orx-input { flex: 1; min-width: 0; }
.ppl-card-preview .oppo-qa { width: auto; padding: 0 7px; font-size: 11px; }
.oppo-qa { display: inline-flex; align-items: center; justify-content: center; }
