/* ============================================================
   Parcl9 Deal Pipeline — Shared styles (admin + frontend)
   ============================================================ */

:root {
  /* ── Parcl9 theme tokens ─────────────────────────── */
  --p9-bg:          #f5f2eb;
  --p9-surface:     #ffffff;
  --p9-border:      rgba(154,111,46,.18);
  --p9-border2:     rgba(154,111,46,.35);
  --p9-text:        #1a1814;
  --p9-mid:         #6b6458;
  --p9-muted:       #a8a090;
  --p9-accent:      #9a6f2e;
  --p9-accent2:     #b8883e;
  --p9-accent-lt:   rgba(154,111,46,.08);
  --p9-radius:      4px;
  --p9-shadow:      0 1px 3px rgba(26,24,20,.06), 0 1px 2px rgba(26,24,20,.04);
  --p9-shadow-md:   0 4px 16px rgba(26,24,20,.08), 0 2px 6px rgba(26,24,20,.05);
  --p9-font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --p9-font-serif:  'Playfair Display', Georgia, 'Times New Roman', serif;

  /* Stage colors — warm palette */
  --p9-lead:           #7c5c2e;
  --p9-evaluating:     #b45309;
  --p9-loi:            #9a6f2e;
  --p9-under-contract: #2e7d32;
  --p9-closed:         #1a5c26;
  --p9-dead:           #a8a090;
}

/* ── Utility ─────────────────────────────────────────────── */
.p9dp-hidden { display: none !important; }
.p9dp-positive { color: #16a34a; font-weight: 600; }
.p9dp-negative { color: #dc2626; font-weight: 600; }

/* ── Badges / stage pills ────────────────────────────────── */
.p9dp-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: #fff;
}
.p9dp-stage-lead           { background: var(--p9-lead); }
.p9dp-stage-evaluating     { background: var(--p9-evaluating); }
.p9dp-stage-loi            { background: var(--p9-loi); }
.p9dp-stage-under_contract { background: var(--p9-under-contract); }
.p9dp-stage-closed         { background: var(--p9-closed); }
.p9dp-stage-dead           { background: var(--p9-dead); }

/* Source badge (LIVE / DEMO) */
.p9dp-source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: .5px;
  vertical-align: middle;
}
.p9dp-source-live { background: #d1fae5; color: #065f46; }
.p9dp-source-demo { background: #fef3c7; color: #92400e; }

/* ── Risk flags ──────────────────────────────────────────── */
/* Severity scale shared everywhere risk flags show up: dot, badge, list. */
.p9dp-risk-dot {
  display: inline-block;
  margin-left: 4px;
  font-size: 13px;
  line-height: 1;
  cursor: help;
}
.p9dp-risk-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  margin-left: 6px;
  vertical-align: middle;
}
.p9dp-risk-dot.p9dp-risk-high,   .p9dp-risk-badge.p9dp-risk-high   { color: #b91c1c; }
.p9dp-risk-dot.p9dp-risk-medium, .p9dp-risk-badge.p9dp-risk-medium { color: #b45309; }
.p9dp-risk-badge.p9dp-risk-high   { background: #fee2e2; }
.p9dp-risk-badge.p9dp-risk-medium { background: #fef3c7; }

.p9dp-risk-flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.p9dp-risk-flag {
  border-left: 3px solid var(--p9-border2);
  padding: 6px 0 6px 12px;
  font-size: 13px;
}
.p9dp-risk-flag strong { display: block; margin-bottom: 2px; }
.p9dp-risk-flag span   { color: var(--p9-mid); line-height: 1.4; }
.p9dp-risk-flag.p9dp-risk-high   { border-left-color: #b91c1c; }
.p9dp-risk-flag.p9dp-risk-high strong   { color: #b91c1c; }
.p9dp-risk-flag.p9dp-risk-medium { border-left-color: #b45309; }
.p9dp-risk-flag.p9dp-risk-medium strong { color: #b45309; }
.p9dp-risk-flag.p9dp-risk-low    { border-left-color: #16a34a; }
.p9dp-risk-flag.p9dp-risk-low strong    { color: #16a34a; }
.p9dp-risk-flag.p9dp-risk-info   { border-left-color: var(--p9-muted); }
.p9dp-risk-flag.p9dp-risk-info strong   { color: var(--p9-mid); }

/* ── Stalled-deal nudges ─────────────────────────────────── */
/* Deliberately its own color (purple) rather than reusing risk's red/amber —
   a nudge is "needs a decision", not "something's wrong with the parcel". */
.p9dp-nudge-dot {
  display: inline-block;
  margin-left: 4px;
  font-size: 13px;
  line-height: 1;
  cursor: help;
}
.p9dp-nudge-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  margin-left: 6px;
  vertical-align: middle;
}
.p9dp-nudge-dot.p9dp-nudge-high,   .p9dp-nudge-badge.p9dp-nudge-high   { color: #6d28d9; }
.p9dp-nudge-dot.p9dp-nudge-medium, .p9dp-nudge-badge.p9dp-nudge-medium { color: #7e22ce; }
.p9dp-nudge-badge.p9dp-nudge-high   { background: #ede9fe; }
.p9dp-nudge-badge.p9dp-nudge-medium { background: #f3e8ff; }

.p9dp-nudge-box {
  border-left: 3px solid #7e22ce;
  background: #faf5ff;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--p9-text);
}
.p9dp-nudge-box strong { color: #6d28d9; }
.p9dp-nudge-box.p9dp-nudge-high { border-left-color: #6d28d9; }
.p9dp-nudge-action { margin-top: 4px; color: var(--p9-mid); }

/* ── Deal digest (AI recap of a long activity log) ──────────── */
.p9dp-digest-box {
  border: 1px solid var(--p9-border);
  background: var(--p9-accent-lt);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.p9dp-digest-box strong { color: var(--p9-accent); }
.p9dp-digest-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--p9-accent);
  background: var(--p9-surface);
  border: 1px solid var(--p9-border2);
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}
.p9dp-digest-box p { margin: 6px 0 0; color: var(--p9-mid); line-height: 1.5; }

/* ── Root container ──────────────────────────────────────── */
.p9dp-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--p9-text);
  background: var(--p9-bg);
  min-height: 400px;
  padding: 0;
}

/* ── Header ──────────────────────────────────────────────── */
.p9dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--p9-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.p9dp-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.p9dp-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── View toggle ─────────────────────────────────────────── */
.p9dp-view-toggle {
  display: flex;
  background: var(--p9-border);
  border-radius: 6px;
  padding: 2px;
}
.p9dp-toggle-btn {
  padding: 5px 14px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  color: var(--p9-muted);
  transition: all .15s;
}
.p9dp-toggle-btn.active {
  background: var(--p9-surface);
  color: var(--p9-text);
  box-shadow: var(--p9-shadow);
}

/* ── Buttons ─────────────────────────────────────────────── */
.p9dp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .15s;
}
.p9dp-btn-primary { background: var(--p9-accent); color: #fff; }
.p9dp-btn-primary:hover { background: var(--p9-accent2); }
.p9dp-btn-ghost { background: transparent; color: var(--p9-muted); border: 1px solid var(--p9-border); }
.p9dp-btn-ghost:hover { background: var(--p9-bg); }
.p9dp-btn-sm { padding: 4px 10px; font-size: 12px; }
.p9dp-link-btn { background: none; border: none; color: var(--p9-accent); cursor: pointer; font-size: inherit; padding: 0; }

.p9dp-archive-count-badge {
  background: var(--p9-border);
  color: var(--p9-muted);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Kanban board ────────────────────────────────────────── */
.p9dp-kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.p9dp-kanban-col {
  flex: 0 0 240px;
  background: var(--p9-bg);
  border-radius: var(--p9-radius);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.p9dp-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--p9-muted);
  border-bottom: 2px solid var(--p9-border);
}

.p9dp-col-count {
  background: var(--p9-border);
  color: var(--p9-muted);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
}

.p9dp-col-body {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  transition: background .15s;
}

.p9dp-col-body.p9dp-drag-over {
  background: var(--p9-accent-lt);
  border-radius: 0 0 var(--p9-radius) var(--p9-radius);
}

/* "+N more in Archive" link appended to the Dead column once it hits its
   cap — see enforceDeadCap() in pipeline-kanban.js. */
.p9dp-archive-more {
  margin-top: 2px;
  padding: 8px 10px;
  background: none;
  border: 1px dashed var(--p9-border2);
  border-radius: var(--p9-radius);
  color: var(--p9-accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.p9dp-archive-more:hover { background: var(--p9-accent-lt); }

/* ── Kanban horizontal-scroll hint ──────────────────────────────────── */
.p9dp-kanban-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
  padding: 4px 0 2px;
  font-size: 11px;
  color: var(--p9-muted);
}
.p9dp-scroll-arrow {
  font-size: 15px;
  line-height: 1;
  transition: opacity .15s;
}
.p9dp-kanban-scroll-hint.p9dp-scroll-at-start .p9dp-scroll-arrow-left,
.p9dp-kanban-scroll-hint.p9dp-scroll-at-end .p9dp-scroll-arrow-right {
  opacity: .25;
}

/* ── Deal cards ──────────────────────────────────────────── */
.p9dp-card {
  background: var(--p9-surface);
  border: 1px solid var(--p9-border);
  border-radius: var(--p9-radius);
  padding: 12px;
  cursor: grab;
  box-shadow: var(--p9-shadow);
  transition: box-shadow .15s, transform .1s, opacity .15s;
  user-select: none;
}
.p9dp-card:hover { box-shadow: var(--p9-shadow-md); }
.p9dp-card.p9dp-dragging { opacity: .5; transform: rotate(2deg); cursor: grabbing; }

.p9dp-card-address {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--p9-text);
  margin-bottom: 4px;
}
.p9dp-card-apn { font-size: 11px; color: var(--p9-muted); margin-bottom: 6px; }
.p9dp-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--p9-muted);
  margin-bottom: 6px;
}
.p9dp-card-price { font-weight: 600; color: var(--p9-text); }
.p9dp-card-analyst { font-size: 11px; color: var(--p9-muted); margin-bottom: 8px; }
.p9dp-card-dates {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--p9-muted);
  margin-bottom: 8px;
  cursor: help;
}
.p9dp-card-actions { text-align: right; }
.p9dp-card-view-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--p9-border);
  background: var(--p9-bg);
  cursor: pointer;
  color: var(--p9-muted);
}
.p9dp-card-view-btn:hover { background: var(--p9-accent-lt); color: var(--p9-accent); border-color: var(--p9-accent); }

/* ── Table view ──────────────────────────────────────────── */
.p9dp-table-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.p9dp-filter-select, .p9dp-search-input {
  padding: 6px 10px;
  border: 1px solid var(--p9-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--p9-surface);
  color: var(--p9-text);
}
.p9dp-search-input { min-width: 220px; }

.p9dp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--p9-surface);
  border-radius: var(--p9-radius);
  overflow: hidden;
  box-shadow: var(--p9-shadow);
  font-size: 13px;
}
.p9dp-table th {
  background: var(--p9-bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--p9-muted);
  border-bottom: 1px solid var(--p9-border);
  white-space: nowrap;
}
.p9dp-table th.sortable { cursor: pointer; }
.p9dp-table th.sortable:hover { color: var(--p9-text); }
.p9dp-table th.sort-asc::after  { content: ' ↑'; }
.p9dp-table th.sort-desc::after { content: ' ↓'; }
.p9dp-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--p9-border);
  color: var(--p9-text);
  vertical-align: middle;
}
.p9dp-table tr:last-child td { border-bottom: none; }
.p9dp-table tr:hover td { background: var(--p9-bg); }
.p9dp-empty-table { text-align: center; padding: 40px; color: var(--p9-muted); }

/* ── Slide-over panel ────────────────────────────────────── */
.p9dp-slideover {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 480px;
  max-width: 95vw;
  background: var(--p9-surface);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  z-index: 9999;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.p9dp-slideover.p9dp-open { transform: translateX(0); }
.p9dp-slideover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9998;
}
.p9dp-slideover-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 14px 14px 0 0;
  background: var(--p9-bg);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.p9dp-slideover-content { padding: 20px; }

.p9dp-so-header h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.p9dp-so-header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.p9dp-delete-deal {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.p9dp-delete-deal:hover { text-decoration: underline; }
.p9dp-delete-deal:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

.p9dp-label-optional { font-weight: normal; color: var(--p9-muted); font-size: 11px; }

/* .p9dp-ai-intake-actions / .p9dp-ai-intake-status are shared "status line"
   styling reused outside the chat widget below too — e.g. the slide-over's
   inline deal-edit form (see class-p9dp-frontend.php) — so these stay even
   though the old paste-a-listing/APN-lookup toggle widgets that originally
   introduced them are gone. */
.p9dp-ai-intake-actions { display: flex; align-items: center; gap: 10px; }
.p9dp-ai-intake-status { font-size: 12px; color: #1a7f37; }
.p9dp-ai-intake-status.p9dp-ai-error { color: #dc2626; }

/* Guided AI intake chat — combines what used to be two separate toggle
   widgets ("paste a listing" + "look up by APN") into one guided
   conversation, styled to match parcel9-parcel-iq's "Parcel IQ Assistant"
   chat (see property-iq.css's .p9piq-intake-* rules). Used in both the
   wp-admin and frontend create-deal modals. Unlike Parcel IQ's version,
   this one never pops out into a floating window — it just lives inside
   the existing create-deal modal — so there's no header pop-out button,
   resize bar, or photo-attach affordance. */
.p9dp-chat-intake {
  background: var(--p9-accent-lt);
  border: 1px solid var(--p9-border);
  border-radius: var(--p9-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 16px;
}
.p9dp-chat-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 14px 0;
}
.p9dp-chat-header > svg { flex-shrink: 0; margin-top: 3px; color: var(--p9-accent); }
.p9dp-chat-title {
  flex: 0 1 115px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.35;
  color: var(--p9-accent);
}
.p9dp-chat-subtitle {
  flex: 1 1 120px;
  min-width: 90px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--p9-mid);
}
.p9dp-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  min-height: 60px;
  max-height: 50vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.p9dp-chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.p9dp-chat-msg--user { flex-direction: row-reverse; }
.p9dp-chat-avatar {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--p9-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p9dp-chat-bubble {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 85%;
  color: var(--p9-text);
}
.p9dp-chat-msg--assistant .p9dp-chat-bubble {
  background: var(--p9-surface);
  box-shadow: var(--p9-shadow);
  border-top-left-radius: 3px;
}
.p9dp-chat-msg--user .p9dp-chat-bubble {
  background: rgba(154,111,46,.18);
  border: 1px solid var(--p9-border2);
  border-top-right-radius: 3px;
}
.p9dp-chat-typing-dots { display: flex; gap: 4px; padding: 12px 14px; }
.p9dp-chat-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--p9-accent);
  border-radius: 50%;
  opacity: .35;
  animation: p9dpChatTypingDot 1.2s infinite;
}
.p9dp-chat-typing-dots span:nth-child(2) { animation-delay: .2s; }
.p9dp-chat-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes p9dpChatTypingDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.p9dp-chat-input-row { display: flex; align-items: flex-end; gap: 10px; padding: 0 14px 14px; }
.p9dp-chat-input {
  flex: 1 1 auto;
  box-sizing: border-box;
  resize: none;
  min-height: 50px;
  max-height: 120px;
  overflow-y: hidden;
  padding: 12px 14px;
  border: 1px solid var(--p9-border);
  border-radius: 10px;
  font-family: var(--p9-font-body);
  font-size: 13px;
  line-height: 1.5;
  background: var(--p9-surface);
  color: var(--p9-text);
  transition: border-color .15s ease;
}
.p9dp-chat-input:focus { outline: none; border-color: var(--p9-accent); box-shadow: 0 0 0 3px var(--p9-accent-lt); }
.p9dp-chat-input::placeholder { color: var(--p9-muted); font-size: 12px; line-height: 1.4; }
.p9dp-chat-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--p9-accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s ease;
}
.p9dp-chat-send-btn:hover  { opacity: .85; }
.p9dp-chat-send-btn:active { opacity: .7; }
.p9dp-chat-footer {
  padding: 0 14px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.p9dp-chat-apply-note { font-size: 11px; color: var(--p9-mid); }
.p9dp-chat-skip { padding: 0 14px 14px; font-size: 12px; color: var(--p9-mid); }
.p9dp-chat-skip-btn { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.p9dp-so-meta { display: flex; gap: 12px; font-size: 12px; color: var(--p9-muted); margin-bottom: 16px; flex-wrap: wrap; }
.p9dp-so-prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--p9-bg);
  border-radius: var(--p9-radius);
  padding: 14px;
  margin-bottom: 16px;
}
.p9dp-so-price label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--p9-muted); margin-bottom: 4px; font-weight: 600; }
.p9dp-so-price span  { font-size: 15px; font-weight: 700; }

.p9dp-so-stage-mover { margin-bottom: 16px; }
.p9dp-so-stage-mover label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; color: var(--p9-muted); display: block; margin-bottom: 8px; }
.p9dp-stage-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.p9dp-stage-btn {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 2px solid var(--p9-border);
  background: var(--p9-bg);
  cursor: pointer;
  color: var(--p9-muted);
  transition: all .15s;
}
.p9dp-stage-btn.active, .p9dp-stage-btn:hover { border-color: var(--p9-accent); background: var(--p9-accent-lt); color: var(--p9-accent); }

.p9dp-so-section { border-top: 1px solid var(--p9-border); padding-top: 14px; margin-top: 14px; }
.p9dp-so-section h4 { font-size: 13px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }

.p9dp-so-notes-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--p9-text);
  background: var(--p9-bg);
  border-radius: var(--p9-radius);
  padding: 12px 14px;
  margin: 0;
  white-space: pre-line;
}
.p9dp-textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.p9dp-so-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p9dp-kv { background: var(--p9-bg); border-radius: 6px; padding: 8px 10px; }
.p9dp-kv-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--p9-muted); font-weight: 600; margin-bottom: 2px; }
.p9dp-kv-val { font-size: 13px; font-weight: 500; color: var(--p9-text); }

.p9dp-note-input { width: 100%; border: 1px solid var(--p9-border); border-radius: 6px; padding: 8px; font-size: 13px; resize: vertical; margin-bottom: 8px; box-sizing: border-box; }
.p9dp-note-input:focus { outline: none; border-color: var(--p9-accent); }

/* ── Activity list ───────────────────────────────────────── */
.p9dp-activity-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.p9dp-activity-item { display: flex; gap: 10px; align-items: flex-start; }
.p9dp-act-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.p9dp-act-body { flex: 1; }
.p9dp-act-msg  { margin: 0; font-size: 13px; color: var(--p9-text); line-height: 1.4; }
.p9dp-act-meta { margin: 2px 0 0; font-size: 11px; color: var(--p9-muted); }

/* ── Modal ───────────────────────────────────────────────── */
.p9dp-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p9dp-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.p9dp-modal-content {
  position: relative;
  background: var(--p9-surface);
  border-radius: 12px;
  padding: 28px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--p9-shadow-md);
  transform: translateY(16px) scale(.97);
  opacity: 0;
  transition: all .25s ease;
}
.p9dp-modal-content.p9dp-modal-in { transform: none; opacity: 1; }
.p9dp-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--p9-bg);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p9dp-modal h2, .p9dp-modal h3 { margin: 0 0 20px; font-size: 18px; font-weight: 700; }
.p9dp-modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }

/* ── Archive modal ───────────────────────────────────────────────────── */
.p9dp-archive-content { width: 480px; }
.p9dp-archive-modal-count { color: var(--p9-muted); font-weight: 400; font-size: 14px; }
.p9dp-archive-subtitle { margin: -14px 0 16px; font-size: 12px; color: var(--p9-mid); }
.p9dp-archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}
.p9dp-archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--p9-border);
  border-radius: var(--p9-radius);
  background: var(--p9-bg);
}
.p9dp-archive-row-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.p9dp-archive-row-main strong { font-size: 13px; color: var(--p9-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p9dp-archive-row-meta { font-size: 11px; color: var(--p9-muted); }
.p9dp-archive-row-date { font-size: 11px; color: var(--p9-muted); white-space: nowrap; flex-shrink: 0; }
.p9dp-archive-view-btn { flex-shrink: 0; }

/* Modal form fields */
.p9dp-form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.p9dp-form-field label { font-size: 12px; font-weight: 600; color: var(--p9-muted); text-transform: uppercase; letter-spacing: .4px; }
.p9dp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.p9dp-input { padding: 8px 10px; border: 1px solid var(--p9-border); border-radius: 6px; font-size: 13px; background: var(--p9-surface); color: var(--p9-text); width: 100%; box-sizing: border-box; }
.p9dp-input:focus { outline: none; border-color: var(--p9-accent); box-shadow: 0 0 0 3px var(--p9-accent-lt); }

/* Broker/Seller/Wholesaler contact picker (Deal Info edit form) */
.p9dp-contact-picker { position: relative; }
.p9dp-contact-clear { font-size: 15px; padding: 0 6px; }
.p9dp-contact-results {
  position: absolute; top: 100%; left: 0; right: 40px; z-index: 20; margin-top: 4px;
  background: var(--p9-surface); border: 1px solid var(--p9-border); border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto;
}
.p9dp-contact-result {
  display: block; width: 100%; text-align: left; padding: 8px 10px; font-size: 13px;
  background: none; border: none; border-bottom: 1px solid var(--p9-border); color: var(--p9-text); cursor: pointer;
}
.p9dp-contact-result:last-child { border-bottom: none; }
.p9dp-contact-result:hover { background: var(--p9-accent-lt); }
.p9dp-contact-result-email { color: var(--p9-muted); font-size: 11px; }
.p9dp-contact-empty { padding: 8px 10px; font-size: 12px; color: var(--p9-muted); }

/* Native <select> chrome (height, padding, the OS-drawn arrow) doesn't match
   a plain <input> even with identical box-model CSS — reset appearance and
   draw our own arrow so selects line up with the text fields next to them. */
select.p9dp-input,
select.p9dp-filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6458' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  padding-right: 28px;
  cursor: pointer;
  line-height: normal;
}
.p9dp-form-hint { font-size: 11px; color: var(--p9-muted); margin-top: 10px; }
.p9dp-form-error { color: #dc2626; font-size: 13px; margin: 0; }

body.p9dp-modal-open { overflow: hidden; }

/* ── Toast notifications ─────────────────────────────────── */
.p9dp-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  z-index: 99999;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s ease;
  pointer-events: none;
}
.p9dp-toast-show { opacity: 1; transform: translateY(0); }
.p9dp-toast-success { background: #16a34a; }
.p9dp-toast-error   { background: #dc2626; }
.p9dp-toast-interactive { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px; }
.p9dp-toast-cta {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
  flex-shrink: 0;
}
.p9dp-toast-cta:hover { color: #fff; opacity: .85; }

/* ── Loading ─────────────────────────────────────────────── */
.p9dp-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px;
  color: var(--p9-muted);
  font-size: 14px;
}
.p9dp-spinner-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--p9-border);
  border-top-color: var(--p9-accent);
  border-radius: 50%;
  animation: p9dp-spin .7s linear infinite;
  display: inline-block;
}
@keyframes p9dp-spin { to { transform: rotate(360deg); } }

/* ── Login prompt ────────────────────────────────────────── */
.p9dp-login-prompt {
  padding: 30px;
  text-align: center;
  color: var(--p9-muted);
  font-size: 14px;
}
.p9dp-login-prompt a { color: var(--p9-accent); }

/* ── Guest banner (frontend, shown above the pipeline for logged-out visitors) ── */
.p9dp-guest-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 14px;
  background: var(--p9-surface);
  border: 1px solid var(--p9-border);
  border-left: 3px solid var(--p9-accent);
  border-radius: var(--p9-radius);
  box-shadow: var(--p9-shadow);
  font-size: 13px;
  color: var(--p9-mid);
}
.p9dp-guest-banner-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--p9-accent-lt);
  color: var(--p9-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p9dp-guest-banner-text { flex: 1 1 260px; }
.p9dp-guest-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}
/* Unlike the plugin's other .p9dp-btn-primary usages (all <button>
   elements), this CTA is an <a> — the theme's own global link-color
   rules can carry higher specificity than a single class and silently
   override the white text color below, making it invisible against the
   gold button background. Force it explicitly rather than relying on
   cascade order. */
.p9dp-guest-banner-cta,
.p9dp-guest-banner-cta:link,
.p9dp-guest-banner-cta:visited,
.p9dp-guest-banner-cta:hover,
.p9dp-guest-banner-cta:focus {
  color: #fff !important;
  white-space: nowrap;
  text-decoration: none;
}
.p9dp-guest-banner-login {
  color: var(--p9-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.p9dp-guest-banner-login:hover { color: var(--p9-accent); }

/* ── Guest badge (wp-admin, flags deals created by a logged-out guest) ── */
.p9dp-guest-badge {
  background: var(--p9-accent-lt);
  color: var(--p9-accent);
  border: 1px solid var(--p9-border2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 1px 7px;
}

/* ── Admin-specific overrides ────────────────────────────── */
.p9dp-wrap .p9dp-table { box-shadow: none; border: 1px solid var(--p9-border); }
.p9dp-back { font-size: 13px; color: var(--p9-muted); text-decoration: none; margin-right: 10px; }
.p9dp-back:hover { color: var(--p9-accent); }
.p9dp-dates-line { font-size: 12px; color: var(--p9-muted); margin: 2px 0 0; }

.p9dp-detail-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .p9dp-detail-grid { grid-template-columns: 1fr; } }

.p9dp-kv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.p9dp-kv-table th { text-align: left; padding: 6px 10px 6px 0; color: var(--p9-muted); font-weight: 600; white-space: nowrap; width: 35%; }
.p9dp-kv-table td { padding: 6px 10px 6px 0; color: var(--p9-text); }

.p9dp-form-table th { font-size: 13px; width: 140px; }

/* ── Deal detail tab navigation ──────────────────────── */
.p9dp-tab-nav {
  display: flex;
  gap: 4px;
  margin: 16px 0 0;
  border-bottom: 2px solid var(--p9-border);
  padding-bottom: 0;
}
.p9dp-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--p9-muted);
  cursor: pointer;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
  transition: color .15s, border-color .15s;
}
.p9dp-tab-btn:hover { color: var(--p9-text); }
.p9dp-tab-btn.p9dp-tab-active {
  color: var(--p9-accent);
  border-bottom-color: var(--p9-accent);
  background: var(--p9-surface);
}

/* The frontend slide-over is a fixed ~480px column — narrower than the
   wp-admin page this tab styling was designed for — and can end up with
   3+ tabs (Overview / Activity Log / Deal Score, the latter added by
   parcel9-deal-score's score-frontend.js). Let the tab bar scroll
   horizontally on its own rather than either wrapping awkwardly or
   forcing the whole panel wide; a short scrollable strip of tab labels
   is normal, expected UI, unlike the full-panel horizontal scroll this
   is meant to avoid. */
.p9dp-slideover .p9dp-tab-nav {
  flex-wrap: nowrap;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.p9dp-slideover .p9dp-tab-nav::-webkit-scrollbar { display: none; }
.p9dp-slideover .p9dp-tab-btn { padding: 8px 12px; white-space: nowrap; flex: 0 0 auto; }
.p9dp-slideover .p9dp-tab-panel { padding-top: 14px; }

/* ═══════════════════════════════════════════════════════════
   PARCL9 THEME SYNC — Final authoritative overrides
════════════════════════════════════════════════════════════ */

/* Root & typography */
.p9dp-root {
  font-family: var(--p9-font-body);
  background: var(--p9-bg);
  color: var(--p9-text);
}
.p9dp-title {
  font-family: var(--p9-font-serif);
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--p9-text);
}
p, .p9dp-card-apn, .p9dp-card-meta, .p9dp-card-analyst, .p9dp-card-dates,
.p9dp-act-msg { color: var(--p9-mid); }
.p9dp-col-header, .p9dp-kv-label, .p9dp-form-field label { color: var(--p9-muted); }

/* Buttons — match theme .btn style */
.p9dp-btn {
  font-family: var(--p9-font-body);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: background .22s ease, color .22s ease, border-color .22s ease;
}
.p9dp-btn-primary { background: var(--p9-accent); color: #fff; border-color: var(--p9-accent); }
.p9dp-btn-primary:hover { background: var(--p9-accent2); border-color: var(--p9-accent2); color: #fff; }
.p9dp-btn-ghost { background: transparent; color: var(--p9-mid); border: 1px solid var(--p9-border2); }
.p9dp-btn-ghost:hover { border-color: var(--p9-accent); color: var(--p9-accent); background: var(--p9-accent-lt); }
.p9dp-btn-sm { font-size: .75rem; padding: 4px 10px; }
.p9dp-link-btn { color: var(--p9-accent); font-size: inherit; font-weight: inherit; text-transform: none; letter-spacing: 0; }
.p9dp-link-btn:hover { color: var(--p9-accent2); }

/* View toggle */
.p9dp-view-toggle { background: var(--p9-border); border-radius: 3px; }
.p9dp-toggle-btn { border-radius: 2px; color: var(--p9-mid); }
.p9dp-toggle-btn.active { background: var(--p9-surface); color: var(--p9-text); }

/* Kanban */
.p9dp-col-header { letter-spacing: .1em; }
.p9dp-col-body.p9dp-drag-over { background: var(--p9-accent-lt); border-radius: 0 0 4px 4px; }

/* Cards */
.p9dp-card {
  background: rgba(255,255,255,.6);
  border: 1px solid var(--p9-border);
  border-radius: 4px;
  box-shadow: var(--p9-shadow);
}
.p9dp-card:hover { box-shadow: var(--p9-shadow-md); border-color: var(--p9-border2); }
.p9dp-card-view-btn {
  border-radius: 3px;
  border-color: var(--p9-border);
  background: var(--p9-bg);
  color: var(--p9-muted);
}
.p9dp-card-view-btn:hover { background: var(--p9-accent-lt); color: var(--p9-accent); border-color: var(--p9-border2); }

/* Inputs & selects */
.p9dp-input, .p9dp-filter-select, .p9dp-search-input, .p9dp-note-input {
  background: rgba(255,255,255,.5);
  border: 1px solid var(--p9-border);
  border-radius: 3px;
  color: var(--p9-text);
  font-family: var(--p9-font-body);
}
.p9dp-input:focus, .p9dp-filter-select:focus, .p9dp-search-input:focus, .p9dp-note-input:focus {
  outline: none;
  border-color: var(--p9-border2);
}

/* Stage buttons */
.p9dp-stage-btn {
  border-radius: 999px;
  font-family: var(--p9-font-body);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: 1px solid var(--p9-border);
  background: var(--p9-bg);
  color: var(--p9-mid);
}
.p9dp-stage-btn.active, .p9dp-stage-btn:hover {
  border-color: var(--p9-accent);
  background: var(--p9-accent-lt);
  color: var(--p9-accent);
}

/* Table */
.p9dp-table {
  background: var(--p9-surface);
  border-radius: 4px;
  box-shadow: var(--p9-shadow);
}
.p9dp-table th { background: var(--p9-bg); color: var(--p9-muted); font-family: var(--p9-font-body); }
.p9dp-table tr:hover td { background: var(--p9-accent-lt); }

/* Modal */
.p9dp-modal-content { border-radius: 4px; background: var(--p9-surface); box-shadow: var(--p9-shadow-md); }
.p9dp-modal h2, .p9dp-modal h3 { font-family: var(--p9-font-serif); font-weight: 400; }

/* Slide-over */
.p9dp-so-header h3 { font-family: var(--p9-font-serif); font-weight: 400; }
.p9dp-kv { background: var(--p9-bg); border-radius: 4px; }

/* Tab nav (deal detail) */
.p9dp-tab-btn { font-family: var(--p9-font-body); font-weight: 500; color: var(--p9-mid); }
.p9dp-tab-btn:hover { color: var(--p9-text); }
.p9dp-tab-btn.p9dp-tab-active { color: var(--p9-accent); border-bottom-color: var(--p9-accent); background: transparent; }

/* Spinner */
.p9dp-spinner-ring { border-color: var(--p9-border); border-top-color: var(--p9-accent); }

/* Toast */
.p9dp-toast-success { background: #1a4a2e; }
.p9dp-toast-error   { background: #6b2222; }

/* Badge source */
.p9dp-source-live { background: rgba(46,125,50,.1); color: #1a5c26; }
.p9dp-source-demo { background: rgba(154,111,46,.1); color: var(--p9-accent); }

/* Links */
.p9dp-back:hover { color: var(--p9-accent); }
.p9dp-login-prompt a { color: var(--p9-accent); }
