/* ─────────────────────────────────────────────────────────────
   Parcl9 Portfolio Dashboard
   Matches the Parcl9 site design tokens exactly.
───────────────────────────────────────────────────────────── */

:root {
  --p9pd-bg:         #ffffff;
  --p9pd-bg-subtle:  #f5f2eb;
  --p9pd-bg-warm:    #fdf9f3;
  --p9pd-border:     rgba(154, 111, 46, 0.18);
  --p9pd-border-md:  rgba(154, 111, 46, 0.28);
  --p9pd-gold:       #9a6f2e;
  --p9pd-gold-hover: #b8883e;
  --p9pd-gold-light: rgba(154, 111, 46, 0.09);
  --p9pd-text:       #1a1814;
  --p9pd-text-mid:   #6b6458;
  --p9pd-muted:      #a8a090;
  --p9pd-danger:     #b53c3c;
  --p9pd-success:    #2e7d32;
  --p9pd-warn:       #b45309;
  --p9pd-radius:     4px;
  --p9pd-shadow:     0 1px 3px rgba(26,24,20,.06), 0 1px 2px rgba(26,24,20,.04);
  --p9pd-shadow-md:  0 4px 16px rgba(26,24,20,.08);
}

/* ── Wrap ─────────────────────────────────────────────────── */
#p9pd-wrap {
  font-family: 'Inter', sans-serif;
  color: var(--p9pd-text);
  background: var(--p9pd-bg);
  padding: 0 1.5rem 2rem;
  box-sizing: border-box;
}
#p9pd-wrap *, #p9pd-wrap *::before, #p9pd-wrap *::after { box-sizing: border-box; }

/* ── Guest gate (PHP-rendered, views/guest-gate.php) ─────────── */
.p9pd-guest-gate {
  font-family: 'Inter', sans-serif;
  width: 100%;
  padding: 40px 20px;
  background: var(--p9pd-bg-warm);
  border: 1px solid var(--p9pd-border);
  border-radius: 8px;
  box-sizing: border-box;
}
.p9pd-gate-inner    { max-width: 560px; margin: 0 auto; text-align: center; }
.p9pd-gate-icon     { width: 52px; height: 52px; margin: 0 auto 16px; background: var(--p9pd-gold-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.p9pd-gate-eyebrow  { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--p9pd-gold); margin: 0 0 8px; }
.p9pd-gate-title    { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(20px,4vw,26px); font-weight: 400; color: var(--p9pd-text); line-height: 1.35; margin: 0 0 14px; }
.p9pd-gate-body     { font-size: 14px; color: var(--p9pd-text-mid); line-height: 1.65; margin: 0 auto 20px; max-width: 440px; }
.p9pd-gate-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 24px; }
.p9pd-gate-pill     { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--p9pd-text-mid); background: var(--p9pd-bg); border: 1px solid var(--p9pd-border); border-radius: 20px; padding: 4px 10px; }
.p9pd-gate-actions  { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.p9pd-gate-cta      { display: inline-flex; align-items: center; justify-content: center; padding: 9px 22px; background: var(--p9pd-gold) !important; color: #fff !important; border: 1px solid var(--p9pd-gold) !important; border-radius: var(--p9pd-radius); font-size: 13px; font-family: 'Inter', sans-serif; font-weight: 500; cursor: pointer; text-decoration: none !important; transition: opacity .12s; }
.p9pd-gate-cta:hover, .p9pd-gate-cta:visited, .p9pd-gate-cta:focus { opacity: .88; color: #fff !important; text-decoration: none !important; }
.p9pd-gate-login    { font-size: 13px; color: var(--p9pd-text-mid); }
.p9pd-gate-login a  { color: var(--p9pd-gold) !important; text-decoration: underline; }

.p9pd-hidden { display: none !important; }

/* ── Guided AI intake chat (Add Project modal only) ──────────
   Mirrors parcel9-deal-pipeline's .p9dp-chat-* (see pipeline.css),
   which itself matches parcel9-parcel-iq's "Parcel IQ Assistant" chat —
   same visual language, own copy/classes, using this plugin's own
   design tokens instead of importing another plugin's CSS. */
.p9pd-chat-intake {
  font-family: 'Inter', sans-serif;
  background: var(--p9pd-gold-light);
  border: 1px solid var(--p9pd-border);
  border-radius: var(--p9pd-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.p9pd-chat-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 14px 0;
}
.p9pd-chat-header > svg { flex-shrink: 0; margin-top: 3px; color: var(--p9pd-gold); }
.p9pd-chat-title {
  flex: 0 1 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.35;
  color: var(--p9pd-gold);
}
.p9pd-chat-subtitle {
  flex: 1 1 120px;
  min-width: 90px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--p9pd-text-mid);
}
.p9pd-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  min-height: 60px;
  max-height: 40vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.p9pd-chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.p9pd-chat-msg--user { flex-direction: row-reverse; }
.p9pd-chat-avatar {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--p9pd-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p9pd-chat-bubble {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 85%;
  color: var(--p9pd-text);
}
.p9pd-chat-msg--assistant .p9pd-chat-bubble {
  background: var(--p9pd-bg);
  box-shadow: var(--p9pd-shadow);
  border-top-left-radius: 3px;
}
.p9pd-chat-msg--user .p9pd-chat-bubble {
  background: rgba(154,111,46,.18);
  border: 1px solid var(--p9pd-border-md);
  border-top-right-radius: 3px;
}
.p9pd-chat-typing-dots { display: flex; gap: 4px; padding: 12px 14px; }
.p9pd-chat-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--p9pd-gold);
  border-radius: 50%;
  opacity: .35;
  animation: p9pdChatTypingDot 1.2s infinite;
}
.p9pd-chat-typing-dots span:nth-child(2) { animation-delay: .2s; }
.p9pd-chat-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes p9pdChatTypingDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.p9pd-chat-input-row { display: flex; align-items: flex-end; gap: 10px; padding: 0 14px 14px; }
.p9pd-chat-input {
  flex: 1 1 auto;
  box-sizing: border-box;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  overflow-y: hidden;
  padding: 11px 13px;
  border: 1px solid var(--p9pd-border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: var(--p9pd-bg);
  color: var(--p9pd-text);
  transition: border-color .15s ease;
}
.p9pd-chat-input:focus { outline: none; border-color: var(--p9pd-gold); box-shadow: 0 0 0 3px rgba(154,111,46,.1); }
.p9pd-chat-input::placeholder { color: var(--p9pd-muted); font-size: 12px; line-height: 1.4; }
.p9pd-chat-send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  background: var(--p9pd-gold);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s ease;
}
.p9pd-chat-send-btn:hover  { opacity: .85; }
.p9pd-chat-send-btn:active { opacity: .7; }
.p9pd-chat-footer {
  padding: 0 14px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.p9pd-chat-apply-note { font-size: 11px; color: var(--p9pd-text-mid); }
.p9pd-chat-skip { padding: 0 14px 14px; font-size: 12px; color: var(--p9pd-text-mid); }
.p9pd-link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--p9pd-gold); cursor: pointer; }
.p9pd-chat-skip-btn { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── Top bar ──────────────────────────────────────────────── */
#p9pd-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--p9pd-border);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
#p9pd-topbar h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--p9pd-text);
  margin: 0;
  flex: 1;
}

/* ── Buttons ──────────────────────────────────────────────── */
.p9pd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.6rem 1.25rem;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.p9pd-btn--primary   { background: var(--p9pd-gold); color: #fff; border-color: var(--p9pd-gold); }
.p9pd-btn--primary:hover { background: var(--p9pd-gold-hover); border-color: var(--p9pd-gold-hover); }
.p9pd-btn--secondary { background: transparent; color: var(--p9pd-gold); border-color: rgba(154,111,46,.4); }
.p9pd-btn--secondary:hover { background: var(--p9pd-gold-light); }
.p9pd-btn--danger    { background: var(--p9pd-danger); color: #fff; border-color: var(--p9pd-danger); }
.p9pd-btn--danger:hover { background: #9c2f2f; border-color: #9c2f2f; }
.p9pd-btn--sm { font-size: 0.7rem; padding: 0.35rem 0.7rem; }
.p9pd-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Summary metric cards ─────────────────────────────────── */
#p9pd-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.p9pd-summary-card {
  background: var(--p9pd-bg);
  border: 1px solid var(--p9pd-border);
  border-radius: var(--p9pd-radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--p9pd-shadow);
}
.p9pd-summary-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--p9pd-muted);
  margin-bottom: 0.3rem;
}
.p9pd-summary-value { font-size: 1.35rem; font-weight: 300; color: var(--p9pd-text); line-height: 1.1; }
.p9pd-summary-value.positive { color: var(--p9pd-success); }
.p9pd-summary-value.negative { color: var(--p9pd-danger); }

/* ── Pipeline bar ─────────────────────────────────────────── */
#p9pd-pipeline-wrap {
  background: var(--p9pd-bg);
  border: 1px solid var(--p9pd-border);
  border-radius: var(--p9pd-radius);
  box-shadow: var(--p9pd-shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}
#p9pd-pipeline-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--p9pd-gold);
  margin-bottom: 0.85rem;
}
#p9pd-pipeline-bar { height: 22px; display: flex; border-radius: 3px; overflow: hidden; margin-bottom: 0.65rem; background: var(--p9pd-bg-subtle); }
.p9pd-stage-seg { height: 100%; transition: width 0.35s ease; }
.p9pd-stage-seg.stage-lead           { background: #1a1814; }
.p9pd-stage-seg.stage-acquisition    { background: #4a3f35; }
.p9pd-stage-seg.stage-entitlement    { background: #6b6458; }
.p9pd-stage-seg.stage-construction   { background: var(--p9pd-gold); }
.p9pd-stage-seg.stage-stabilization  { background: var(--p9pd-gold-hover); }
.p9pd-stage-seg.stage-realized       { background: #2e7d32; }
#p9pd-pipeline-legend { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.p9pd-legend-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.73rem; color: var(--p9pd-text-mid); }
.p9pd-legend-dot  { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ── Grid sections ────────────────────────────────────────── */
#p9pd-grids { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 760px) { #p9pd-grids { grid-template-columns: 1fr; } }

/* ── Panel ────────────────────────────────────────────────── */
.p9pd-panel {
  background: var(--p9pd-bg);
  border: 1px solid var(--p9pd-border);
  border-radius: var(--p9pd-radius);
  box-shadow: var(--p9pd-shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.p9pd-panel:last-child { margin-bottom: 0; }
.p9pd-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--p9pd-border);
}
.p9pd-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--p9pd-gold);
  margin: 0;
}
.p9pd-empty { color: var(--p9pd-muted); font-size: 0.85rem; text-align: center; padding: 1.5rem 0; }

/* ── Project cards ────────────────────────────────────────── */
.p9pd-project-card {
  background: var(--p9pd-bg-warm);
  border: 1px solid var(--p9pd-border);
  border-radius: var(--p9pd-radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.p9pd-project-card:last-child { margin-bottom: 0; }
.p9pd-project-card:hover { box-shadow: var(--p9pd-shadow-md); border-color: rgba(154,111,46,.35); }
.p9pd-project-name { font-size: 0.9rem; font-weight: 600; color: var(--p9pd-text); margin-bottom: 0.3rem; }
.p9pd-project-meta { font-size: 0.75rem; color: var(--p9pd-text-mid); display: flex; gap: 1rem; flex-wrap: wrap; }
.p9pd-project-stat { display: flex; flex-direction: column; align-items: flex-end; }
.p9pd-project-stat-label { font-size: 0.65rem; color: var(--p9pd-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.p9pd-project-stat-value { font-size: 0.85rem; color: var(--p9pd-text); font-weight: 500; }

/* Stage badge */
.p9pd-stage-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 2px;
  background: rgba(154,111,46,.1);
  color: var(--p9pd-gold);
}
.p9pd-stage-badge.realized { background: rgba(46,125,50,.1); color: #1a4a2e; }

/* ── Capital chart ────────────────────────────────────────── */
#p9pd-capital-chart { display: flex; flex-direction: column; gap: 0.6rem; }
.p9pd-cap-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.78rem; }
.p9pd-cap-label { width: 110px; color: var(--p9pd-text-mid); font-size: 0.73rem; text-align: right; flex-shrink: 0; }
.p9pd-cap-bar-wrap { flex: 1; background: var(--p9pd-bg-subtle); border-radius: 3px; height: 16px; overflow: hidden; }
.p9pd-cap-bar { height: 100%; background: var(--p9pd-gold); border-radius: 3px; transition: width 0.35s; }
.p9pd-cap-bar.returned { background: #2e7d32; }
.p9pd-cap-val { width: 80px; font-size: 0.75rem; color: var(--p9pd-text); font-variant-numeric: tabular-nums; }

/* ── IRR / returns chart ──────────────────────────────────── */
.p9pd-irr-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.83rem; padding: 0.4rem 0; border-bottom: 1px solid var(--p9pd-border); }
.p9pd-irr-row:last-child { border-bottom: none; }
.p9pd-irr-label { color: var(--p9pd-text-mid); }
.p9pd-irr-val   { color: var(--p9pd-text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── Modal ────────────────────────────────────────────────── */
.p9pd-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,24,20,.45);
  z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.p9pd-modal {
  background: var(--p9pd-bg);
  border: 1px solid var(--p9pd-border-md);
  border-radius: var(--p9pd-radius);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--p9pd-shadow-md);
}
.p9pd-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--p9pd-border);
  background: var(--p9pd-bg-warm); position: sticky; top: 0;
}
.p9pd-modal-header h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.05rem; font-weight: 400; color: var(--p9pd-text); }
.p9pd-modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--p9pd-muted); line-height: 1; }
.p9pd-modal-body { padding: 1.25rem; }
.p9pd-modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--p9pd-border); display: flex; gap: 0.5rem; justify-content: flex-end; background: var(--p9pd-bg-warm); }

/* ── Form ─────────────────────────────────────────────────── */
.p9pd-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
@media (max-width: 500px) { .p9pd-form-grid { grid-template-columns: 1fr; } }
.p9pd-f-group { display: flex; flex-direction: column; gap: 0.3rem; }
.p9pd-f-group.full { grid-column: 1 / -1; }
.p9pd-f-group label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--p9pd-text-mid); }
.p9pd-f-group input,
.p9pd-f-group select,
.p9pd-f-group textarea {
  background: var(--p9pd-bg-subtle);
  border: 1px solid var(--p9pd-border-md);
  border-radius: var(--p9pd-radius);
  padding: 0.55rem 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  color: var(--p9pd-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.p9pd-f-group input:focus,
.p9pd-f-group select:focus,
.p9pd-f-group textarea:focus {
  border-color: var(--p9pd-gold);
  box-shadow: 0 0 0 3px rgba(154,111,46,.1);
}
.p9pd-f-group input::placeholder,
.p9pd-f-group textarea::placeholder { color: var(--p9pd-muted); }
.p9pd-sold-only { display: none; }
.p9pd-sold-only.visible { display: contents; }

/* Section divider in form */
.p9pd-form-section-label {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p9pd-gold);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--p9pd-border);
  margin-top: 0.25rem;
}

/* ── Notice toast ─────────────────────────────────────────── */
#p9pd-notice {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--p9pd-text); color: #fff;
  padding: 0.7rem 1.2rem; border-radius: 3px;
  font-size: 0.85rem; box-shadow: var(--p9pd-shadow-md);
  display: none; z-index: 9999;
}

/* ── Full-width panel below grids ─────────────────────────── */
#p9pd-distributions-panel { margin-bottom: 1.5rem; }
.p9pd-dist-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.p9pd-dist-table th { font-size: 0.67rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--p9pd-muted); padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid var(--p9pd-border); }
.p9pd-dist-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--p9pd-border); color: var(--p9pd-text); }
.p9pd-dist-table tr:last-child td { border-bottom: none; }
.p9pd-dist-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════
   PATCH — Missing classes
════════════════════════════════════════════════════════════ */

/* Modal */
#p9pd-modal { display: none; }
#p9pd-modal-inner { background: var(--p9pd-bg); border: 1px solid var(--p9pd-border-md); border-radius: var(--p9pd-radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--p9pd-shadow-md); }
#p9pd-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--p9pd-border); background: var(--p9pd-bg-warm); }
#p9pd-modal-header h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.05rem; font-weight: 400; color: var(--p9pd-text); }
#p9pd-modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--p9pd-muted); }
#p9pd-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
#p9pd-modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--p9pd-border); display: flex; gap: 0.5rem; justify-content: flex-end; background: var(--p9pd-bg-warm); }

/* Panel wrapping modal as overlay */
#p9pd-modal { position: fixed; inset: 0; background: rgba(26,24,20,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 1rem; }

/* p9pd-field = alias for p9pd-f-group */
.p9pd-field { display: flex; flex-direction: column; gap: 0.3rem; }
.p9pd-field label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--p9pd-text-mid); }
.p9pd-field input,
.p9pd-field select,
.p9pd-field textarea {
  background: var(--p9pd-bg-subtle); border: 1px solid var(--p9pd-border-md); border-radius: var(--p9pd-radius);
  padding: 0.55rem 0.8rem; font-family: 'Inter', sans-serif; font-size: 0.88rem; color: var(--p9pd-text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
}
.p9pd-field input:focus, .p9pd-field select:focus, .p9pd-field textarea:focus { border-color: var(--p9pd-gold); box-shadow: 0 0 0 3px rgba(154,111,46,.1); }
.p9pd-field input::placeholder, .p9pd-field textarea::placeholder { color: var(--p9pd-muted); }
.p9pd-field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.p9pd-field input[readonly] { background: var(--p9pd-bg-warm); color: var(--p9pd-text-mid); cursor: not-allowed; }

/* Native <select> renders its own OS arrow with no way to match it to our
   theme, so we drop it in favor of a custom gold chevron. */
.p9pd-field select,
.p9pd-f-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239a6f2e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.1rem;
  cursor: pointer;
}
.p9pd-field select:hover,
.p9pd-f-group select:hover { border-color: var(--p9pd-gold); }
.p9pd-field select:disabled,
.p9pd-f-group select:disabled { cursor: not-allowed; opacity: 0.6; }

/* Form grid (2-col and 3-col) */
.p9pd-form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.p9pd-form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.65rem; }
.p9pd-form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0.65rem; }
@media (max-width: 650px) { .p9pd-form-grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .p9pd-form-grid, .p9pd-form-grid-3, .p9pd-form-grid-4 { grid-template-columns: 1fr; } }

/* Form section heading */
.p9pd-form-section { display: flex; flex-direction: column; gap: 0.65rem; padding-top: 0.25rem; }
.p9pd-form-section-title {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--p9pd-gold); padding-bottom: 0.4rem; border-bottom: 1px solid var(--p9pd-border); margin-top: 0.25rem;
}

/* Panel h4 */
.p9pd-panel-h4 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--p9pd-gold); margin: 0 0 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--p9pd-border); }

/* "Active only" fields (hidden when stage = sold) */
.p9pd-active-only { display: flex; flex-direction: column; gap: 0.65rem; }
.p9pd-sold-only { display: none; }

/* JS-rendered card variants: .p9pd-card (from JS renderCards) */
#p9pd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.p9pd-card { background: var(--p9pd-bg); border: 1px solid var(--p9pd-border); border-radius: var(--p9pd-radius); padding: 0.9rem 1rem; box-shadow: var(--p9pd-shadow); }
.p9pd-card-label { font-size: 0.67rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--p9pd-muted); margin-bottom: 0.3rem; }
.p9pd-card-value { font-size: 1.3rem; font-weight: 300; color: var(--p9pd-text); line-height: 1.1; }
.p9pd-card--good .p9pd-card-value { color: var(--p9pd-success); }
.p9pd-card--bad  .p9pd-card-value { color: var(--p9pd-danger); }
.p9pd-card--warn .p9pd-card-value { color: #b45309; }

/* Pipeline inner div (JS renders bar inside #p9pd-pipeline) */
#p9pd-pipeline { margin-bottom: 0.5rem; }

/* Notice states */
#p9pd-notice.p9pd-notice--success { background: #1a4a2e; }
#p9pd-notice.p9pd-notice--error   { background: var(--p9pd-danger); }

/* ── JS-rendered project card classes ─────────────────────── */
/* No gap/background variation of its own before this — with several
   projects, adjacent full-width cards had nothing but a 1px shared
   border between them, making it hard to tell where one ends and the
   next begins. */
#p9pd-active-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.p9pd-project-card { background: var(--p9pd-bg); border: 1px solid var(--p9pd-border); border-radius: var(--p9pd-radius); padding: 1rem 1.1rem; box-shadow: var(--p9pd-shadow); transition: box-shadow 0.2s, border-color 0.2s; }
.p9pd-project-card:nth-child(even) { background: var(--p9pd-bg-warm); }
.p9pd-project-card:hover { box-shadow: var(--p9pd-shadow-md); border-color: rgba(154,111,46,.3); }

.p9pd-pc-header  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.65rem; gap: 0.5rem; }
.p9pd-pc-badges  { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.p9pd-pc-name    { font-size: 0.92rem; font-weight: 600; color: var(--p9pd-text); }
.p9pd-pc-address { font-size: 0.73rem; color: var(--p9pd-muted); margin-bottom: 0.6rem; }
.p9pd-pc-market  { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--p9pd-gold); margin: -0.35rem 0 0.6rem; }
.p9pd-pc-market svg { flex-shrink: 0; opacity: 0.8; }
.p9pd-pc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.75rem; margin-bottom: 0.6rem; }
.p9pd-pc-notes   { font-size: 0.75rem; color: var(--p9pd-text-mid); line-height: 1.4; padding-top: 0.5rem; border-top: 1px solid var(--p9pd-border); }

/* Metric cells */
.p9pd-metric { display: flex; flex-direction: column; gap: 0.1rem; }
.p9pd-metric-label { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--p9pd-muted); }

/* Hoverable glossary icon next to jargon-heavy labels (LTC, LTV, EM, NOI, etc.) — see TOOLTIPS/infoIcon() in portfolio-dashboard.js. Pairs with .p9pd-tooltip below for the actual popup (no native title attribute here — the browser's built-in tooltip has an unavoidable ~1s+ hover delay). */
.p9pd-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    opacity: 0.55;
    cursor: help;
    vertical-align: -2px;
    transition: opacity 0.15s, color 0.15s;
}
.p9pd-info-icon:hover { opacity: 1; color: var(--p9pd-gold); }
.p9pd-info-icon svg { pointer-events: none; }

/*
 * Instant custom tooltip — replaces the native `title` attribute, which
 * every browser delays showing by roughly 1-1.5s. Usage: add this class
 * plus data-tooltip="..." to any element; the text and popup are pure
 * CSS (attr()/::after), so there's no JS timer and it appears the
 * instant you hover.
 *
 * Only used where the popup has open space to float above without
 * getting clipped by a scrolling ancestor — dashboard card grids and
 * modal field labels. The Realized Deals / Distributions table headers
 * intentionally keep the native `title` instead, since those tables
 * sit inside an overflow-x:auto wrapper (.p9pd-table-wrap) that would
 * clip a floating popup the moment the table is scrolled horizontally.
 */
.p9pd-tooltip { position: relative; }
.p9pd-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    background: #23201c;
    color: #f4f1ea;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    text-align: left;
    width: max-content;
    max-width: 220px;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.08s ease, transform 0.08s ease;
    z-index: 60;
}
.p9pd-tooltip:hover::after,
.p9pd-tooltip:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* History panel (#p9pd-history-section) — collapsible per-project change log in the Edit modal, see loadHistory()/renderHistory() in portfolio-dashboard.js. */
.p9pd-history-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 0.4rem; }
.p9pd-history-chevron { font-size: 0.65rem; color: var(--p9pd-muted); transition: transform 0.15s; }
#p9pd-history-body { margin-top: 0.5rem; }
.p9pd-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.p9pd-history-list li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--p9pd-border);
    font-size: 0.78rem;
}
.p9pd-history-list li:last-child { border-bottom: none; }
.p9pd-history-when { font-size: 0.68rem; color: var(--p9pd-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.p9pd-history-desc { color: var(--p9pd-text-mid); }
.p9pd-history-desc strong { color: var(--p9pd-text); }
.p9pd-history-empty { color: var(--p9pd-muted); font-style: italic; border-bottom: none !important; padding: 0.3rem 0 !important; }

/*
 * Project Team (#p9pd-team-section) — multi-party contacts pulled from
 * the shared parcl9-contacts plugin, see renderProjectTeam()/the
 * p9pd-team-* handlers in portfolio-dashboard.js. The "Add Party" row
 * (role <select> + contact search) ports Deal Pipeline's
 * .p9dp-contact-picker look (pipeline-kanban.css) under .p9pd-contact-*
 * names, since this is the same interaction shape.
 */
.p9pd-team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.p9pd-team-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: var(--p9pd-bg-warm);
    border: 1px solid var(--p9pd-border);
    border-radius: var(--p9pd-radius);
    font-size: 0.8rem;
}
.p9pd-team-role-badge { flex-shrink: 0; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 2px; background: rgba(154,111,46,.1); color: var(--p9pd-gold); }
/* No role tagged on this contact in Contacts at all — shown as a muted, non-uppercase hint (optionally a link there) instead of the normal gold role pill, so it reads as "nothing set" rather than as its own role. */
.p9pd-team-role-badge--empty { text-transform: none; letter-spacing: normal; font-weight: 500; background: var(--p9pd-bg-subtle); color: var(--p9pd-muted); }
a.p9pd-team-role-badge--empty { cursor: pointer; text-decoration: none; }
a.p9pd-team-role-badge--empty:hover { color: var(--p9pd-gold); background: var(--p9pd-gold-light); }
.p9pd-team-name    { flex: 1; color: var(--p9pd-text); }
.p9pd-team-company { color: var(--p9pd-muted); }
.p9pd-team-coi-warn { flex-shrink: 0; font-size: 0.68rem; font-weight: 600; color: var(--p9pd-warn); }
.p9pd-team-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0 0.2rem;
    font-size: 1rem;
    line-height: 1;
    color: var(--p9pd-muted);
    cursor: pointer;
    transition: color 0.15s;
}
.p9pd-team-remove:hover { color: var(--p9pd-danger); }
.p9pd-team-empty { color: var(--p9pd-muted); font-style: italic; font-size: 0.8rem; padding: 0.3rem 0; list-style: none; }

.p9pd-team-add-row { display: flex; gap: 0.5rem; margin-top: 0.35rem; }

/* Bare <input> here (not inside .p9pd-field), so it needs its own theme
   styling from scratch — no role <select> alongside it anymore, since a
   party's role is read live off however that contact is already tagged
   in Contacts rather than picked again here (see link_contact() in
   class-p9pd-database.php). */
.p9pd-contact-picker { position: relative; flex: 1; }
#p9pd-team-search {
    width: 100%;
    height: 2.3rem;
    box-sizing: border-box;
    background: var(--p9pd-bg);
    border: 1px solid var(--p9pd-border-md);
    border-radius: var(--p9pd-radius);
    padding: 0 0.7rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--p9pd-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#p9pd-team-search::placeholder { color: var(--p9pd-muted); }
#p9pd-team-search:focus { border-color: var(--p9pd-gold); box-shadow: 0 0 0 3px rgba(154,111,46,.1); }
.p9pd-team-new-toggle { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 500px) { .p9pd-team-add-row { flex-direction: column; align-items: stretch; } }

/* "+ New Contact" quick-add form (#p9pd-team-new-form) — see the
   populateNewContactRoleOptions()/#p9pd-team-new-* handlers in
   portfolio-dashboard.js. */
.p9pd-team-new-form {
    margin-top: 0.6rem;
    padding: 0.75rem;
    background: var(--p9pd-bg-warm);
    border: 1px solid var(--p9pd-border);
    border-radius: var(--p9pd-radius);
}
/* Role(s) multi-select — a plain multi-row <select multiple> rather than
   a row of checkboxes, which wrapped unpredictably once the role list
   got long enough (Broker/Seller/Wholesaler/Contractor/Investor/
   Lender/Property Manager/Attorney/Vendor/Other) and let labels overlap
   their own checkboxes. Native multi-select chrome varies by browser/OS
   and can't be fully re-skinned (no appearance:none equivalent for the
   option list itself), so this focuses on what IS stylable: border,
   radius, font, and the selected-row highlight color. */
.p9pd-team-new-roles {
    width: 100%;
    box-sizing: border-box;
    background: var(--p9pd-bg);
    border: 1px solid var(--p9pd-border-md);
    border-radius: var(--p9pd-radius);
    padding: 0.3rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--p9pd-text);
    outline: none;
}
.p9pd-team-new-roles:focus { border-color: var(--p9pd-gold); box-shadow: 0 0 0 3px rgba(154,111,46,.1); }
.p9pd-team-new-roles option {
    padding: 0.35rem 0.5rem;
    border-radius: 3px;
}
.p9pd-team-new-roles option:checked {
    background: var(--p9pd-gold) linear-gradient(0deg, var(--p9pd-gold), var(--p9pd-gold));
    color: #fff;
}
.p9pd-team-new-roles-hint { font-size: 0.68rem; color: var(--p9pd-muted); margin-top: 0.3rem; }
.p9pd-team-new-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.p9pd-contact-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    margin-top: 4px;
    background: var(--p9pd-bg);
    border: 1px solid var(--p9pd-border-md);
    border-radius: var(--p9pd-radius);
    box-shadow: var(--p9pd-shadow-md);
    max-height: 220px;
    overflow-y: auto;
}
.p9pd-contact-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--p9pd-border);
    color: var(--p9pd-text);
    cursor: pointer;
}
.p9pd-contact-result:last-child { border-bottom: none; }
.p9pd-contact-result:hover { background: var(--p9pd-gold-light); }
.p9pd-contact-result-email { color: var(--p9pd-muted); font-size: 0.7rem; }
.p9pd-contact-empty { padding: 0.5rem 0.6rem; font-size: 0.76rem; color: var(--p9pd-muted); }
.p9pd-contact-empty a { color: var(--p9pd-gold); }

/* Compact "who's involved" chips on a project card (#p9pd-active-grid), see renderPartyChips() in portfolio-dashboard.js. */
.p9pd-party-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; }
.p9pd-party-chip {
    font-size: 0.68rem;
    color: var(--p9pd-text-mid);
    background: var(--p9pd-bg-subtle);
    border: 1px solid var(--p9pd-border);
    border-radius: 20px;
    padding: 0.15rem 0.55rem;
}
.p9pd-party-chip strong { color: var(--p9pd-text); font-weight: 600; }
.p9pd-party-chip--warn { color: var(--p9pd-warn); background: rgba(180, 83, 9, 0.08); border-color: rgba(180, 83, 9, 0.25); }
.p9pd-party-chip--more { color: var(--p9pd-muted); font-style: italic; }

/* Stage checklist (#p9pd-stage-checklist) — read-only guidance list in the Add/Edit modal, see renderStageChecklist() in portfolio-dashboard.js. */
.p9pd-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.p9pd-checklist li {
    position: relative;
    padding-left: 1.35rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--p9pd-text-mid);
}
.p9pd-checklist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--p9pd-gold);
    background: var(--p9pd-bg-warm);
}
.p9pd-metric-value { font-size: 0.88rem; color: var(--p9pd-text); font-weight: 500; font-variant-numeric: tabular-nums; }
.p9pd-metric--good .p9pd-metric-value { color: var(--p9pd-success); }
.p9pd-metric--bad  .p9pd-metric-value { color: var(--p9pd-danger); }
.p9pd-metric--warn .p9pd-metric-value { color: #b45309; }

/* Type pill & stage badge */
.p9pd-type-pill   { display: inline-block; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 2px; background: rgba(154,111,46,.1); color: var(--p9pd-gold); }
.p9pd-stage-badge { display: inline-block; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 2px; background: rgba(168,160,144,.15); color: var(--p9pd-text-mid); }

/* Staleness nudge — purely rule-based "not updated in N days" flag, see
   evaluateStaleness() in portfolio-dashboard.js (mirrors Deal Pipeline's
   P9DP_Nudges). 'medium'/'high' only — silence means nothing to flag. */
.p9pd-nudge-badge         { display: inline-block; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.03em; padding: 0.15rem 0.45rem; border-radius: 2px; cursor: default; }
.p9pd-nudge-badge--medium { background: rgba(180, 83, 9, 0.1);  color: var(--p9pd-warn); }
.p9pd-nudge-badge--high   { background: rgba(181, 60, 60, 0.1); color: var(--p9pd-danger); }
.p9pd-nudge-note          { font-size: 0.75rem; line-height: 1.4; padding: 0.4rem 0.55rem; border-radius: var(--p9pd-radius); margin-bottom: 0.6rem; }
.p9pd-nudge-note--medium  { background: rgba(180, 83, 9, 0.07);  color: var(--p9pd-warn); }
.p9pd-nudge-note--high    { background: rgba(181, 60, 60, 0.07); color: var(--p9pd-danger); }

/* "was $X, now $Y" — a live-overlaid field (capital/ARV/distributions)
   meaningfully differs from what was last saved, see changeSummary() in
   portfolio-dashboard.js / is_meaningful_change() in class-p9pd-ajax.php.
   Neutral blue rather than the nudge colors above — this isn't a problem
   to fix, just "here's what moved since you last looked." Clears itself
   the next time the project is saved. */
.p9pd-change-note { font-size: 0.72rem; line-height: 1.4; padding: 0.4rem 0.55rem; border-radius: var(--p9pd-radius); margin-bottom: 0.6rem; background: rgba(37, 99, 235, 0.07); color: #1d4ed8; }
/* Target vs. actual comparison note (#p9pd-target-compare-note) — reuses .p9pd-change-note's box, just recolored to reflect whether the deal hit/missed its underwriting target rather than "something changed". */
.p9pd-change-note.p9pd-compare-note--good { background: rgba(46, 125, 50, 0.08);  color: var(--p9pd-success); }
.p9pd-change-note.p9pd-compare-note--bad  { background: rgba(181, 60, 60, 0.08); color: var(--p9pd-danger); }

/* Edit buttons */
.p9pd-edit-btn { background: none; border: none; color: var(--p9pd-muted); cursor: pointer; font-size: 0.8rem; padding: 0.1rem 0.3rem; border-radius: 2px; transition: color 0.15s; }
.p9pd-edit-btn:hover { color: var(--p9pd-gold); }
.p9pd-edit-sm  { font-size: 0.7rem; }

/* Pipeline bar — segments/labels are clickable filters for Active Projects
   (except "Sold", which scrolls to Realized Deals instead); see the click
   handler in portfolio-dashboard.js. */
/* Taller than a single-line bar (28px) needed to be — .p9pd-pipe-label now stacks stage name / deal count / equity onto their own lines (see below), so there needs to be room for up to 3 stacked lines instead of 1. */
.p9pd-pipeline-bar    { display: flex; height: 54px; border-radius: 3px; overflow: hidden; margin-bottom: 0.35rem; background: var(--p9pd-bg-subtle); }
.p9pd-pipe-seg        { height: 100%; display: flex; align-items: center; justify-content: center; transition: width 0.3s ease, opacity 0.2s ease, filter 0.2s ease; cursor: pointer; }
.p9pd-pipe-seg:hover  { filter: brightness(1.1); }
.p9pd-pipe-seg--active  { box-shadow: inset 0 0 0 2px rgba(255,255,255,.85); }
.p9pd-pipe-seg--dimmed  { opacity: 0.45; }
/* Stage name / deal count / equity each get their own line (previously all ran together inline as e.g. "STABILIZED2 DEALS$243K EQUITY") — <strong> is the stage name, the <span>s below it are count and (when present) equity. white-space/overflow stay on the wrapper so an unusually narrow segment clips rather than wrapping mid-word. */
.p9pd-pipe-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    text-align: center;
    line-height: 1.2;
    color: rgba(255,255,255,.95);
    white-space: nowrap;
    overflow: hidden;
    padding: 0 0.4rem;
}
.p9pd-pipe-label strong { font-size: 0.7rem;  font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.p9pd-pipe-label span   { font-size: 0.62rem; font-weight: 500; text-transform: uppercase; opacity: 0.92; }
.p9pd-pipeline-labels { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.72rem; color: var(--p9pd-text-mid); }
.p9pd-pipe-foot  { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; padding: 0.1rem 0.3rem; border-radius: 3px; transition: background 0.15s ease; }
.p9pd-pipe-foot:hover { background: var(--p9pd-bg-subtle); }
.p9pd-pipe-foot--active { background: var(--p9pd-bg-subtle); font-weight: 700; }
.p9pd-pipe-arrow { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
#p9pd-active-filter-note { font-size: 0.72rem; font-weight: 400; color: var(--p9pd-text-mid); text-transform: none; letter-spacing: normal; margin-left: 0.4rem; }

/* Search + sort toolbar above the active project cards. Both controls get
   the same explicit height/box-sizing so they line up regardless of any
   line-height/padding drift between a native <input> and a <select> that's
   had appearance:none applied (which is exactly what breaks a select's
   normal auto-centering of its text — see the explicit line-height on
   #p9pd-active-sort below). */
.p9pd-active-toolbar { display: flex; align-items: center; gap: 0.6rem; margin: -0.4rem 0 0.9rem; flex-wrap: wrap; }
.p9pd-search-field {
  display: flex; align-items: center; gap: 0.4rem; flex: 1 1 220px; min-width: 180px;
  height: 2.4rem; box-sizing: border-box;
  background: var(--p9pd-bg-subtle); border: 1px solid var(--p9pd-border-md); border-radius: var(--p9pd-radius);
  padding: 0 0.6rem; color: var(--p9pd-muted);
}
.p9pd-search-field svg { flex-shrink: 0; }
.p9pd-search-field input {
  flex: 1; height: 100%; box-sizing: border-box; border: none; background: none; padding: 0;
  font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--p9pd-text); outline: none;
}
.p9pd-search-field input::placeholder { color: var(--p9pd-muted); }
.p9pd-search-clear {
  border: none; background: none; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--p9pd-muted);
  padding: 0 0.15rem;
}
.p9pd-search-clear:hover { color: var(--p9pd-text); }
/* Belt-and-suspenders on top of .p9pd-hidden's display:none. Some themes/
   page builders (Elementor, Divi, etc.) ship broad "button { ... !important
   }" resets whose selector specificity can beat a plain class even with
   !important on both sides — an ID selector outranks any number of classes/
   elements, so anchoring to this button's own ID here guarantees it always
   wins and actually collapses to nothing instead of a stray sliver. */
#p9pd-active-search-clear.p9pd-hidden {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 0 !important;
  overflow: hidden !important;
}
#p9pd-active-sort {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  height: 2.4rem; box-sizing: border-box; line-height: calc(2.4rem - 2px);
  background: var(--p9pd-bg-subtle); border: 1px solid var(--p9pd-border-md); border-radius: var(--p9pd-radius);
  padding: 0 2.1rem 0 0.8rem; font-family: 'Inter', sans-serif; font-size: 0.82rem; color: var(--p9pd-text);
  flex: 0 0 auto; cursor: pointer; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239a6f2e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
}
#p9pd-active-sort:hover  { border-color: var(--p9pd-gold); }
#p9pd-active-sort:focus  { border-color: var(--p9pd-gold); box-shadow: 0 0 0 3px rgba(154,111,46,.1); }
@media (max-width: 500px) { .p9pd-active-toolbar { flex-direction: column; align-items: stretch; } }

/* Tables */
.p9pd-table-wrap { overflow-x: auto; }
.p9pd-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.p9pd-table th { font-size: 0.67rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--p9pd-muted); padding: 0.35rem 0.5rem; text-align: left; border-bottom: 1px solid var(--p9pd-border); white-space: nowrap; }
.p9pd-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--p9pd-border); color: var(--p9pd-text); font-variant-numeric: tabular-nums; }
.p9pd-table tr:last-child td { border-bottom: none; }
.p9pd-table .p9pd-total-row td { font-weight: 600; background: var(--p9pd-bg-warm); }

/* Note text */
.p9pd-note { font-size: 0.73rem; color: var(--p9pd-muted); line-height: 1.4; }

/* Distributions summary */
.p9pd-dist-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
.p9pd-dist-box    { background: var(--p9pd-bg-warm); border: 1px solid var(--p9pd-border); border-radius: var(--p9pd-radius); padding: 0.75rem 0.85rem; }
.p9pd-dist-label  { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--p9pd-muted); margin-bottom: 0.25rem; }
.p9pd-dist-val    { font-size: 1.15rem; font-weight: 300; color: var(--p9pd-text); font-variant-numeric: tabular-nums; }

/* "live" flag — a field overlaid from another Parcl9 tool (Investor Portal
   distributions, Quick Proforma capital, Land Comps/Parcel IQ ARV) instead
   of this project's own saved snapshot, see with_live_overlays() in
   class-p9pd-ajax.php */
.p9pd-live-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--p9pd-success);
  background: rgba(46, 125, 50, 0.1);
  border: 1px solid rgba(46, 125, 50, 0.25);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  vertical-align: middle;
  margin-left: 0.35rem;
}
    .p9pd-live-note {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      font-size: 0.73rem;
      color: var(--p9pd-success);
      background: rgba(46, 125, 50, 0.08);
      border: 1px solid rgba(46, 125, 50, 0.2);
      border-radius: var(--p9pd-radius);
      padding: 0.5rem 0.65rem;
      margin-bottom: 0.65rem;
      line-height: 1.35;
    }
    .p9pd-live-note svg { flex-shrink: 0; }
    .p9pd-live-note a { color: var(--p9pd-success); font-weight: 600; text-decoration: underline; }

    /* Capital/ARV "a fresher number is available" nudge — unlike
       .p9pd-live-note above (still used by Distributions, which stays
       force-synced/read-only), this never locks the fields; it's just an
       opt-in offer to pull in Quick Proforma/Land Comps/Parcel IQ's
       latest number, since deal economics can legitimately move away
       from that suggestion (renegotiated financing, a fresher comp set,
       etc.) and the user's own typed-in number should win by default. */
    .p9pd-suggest-note {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
      font-size: 0.73rem;
      color: #9a6f2e;
      background: rgba(154, 111, 46, 0.08);
      border: 1px solid rgba(154, 111, 46, 0.25);
      border-radius: var(--p9pd-radius);
      padding: 0.5rem 0.65rem;
      margin-bottom: 0.65rem;
      line-height: 1.35;
    }
    .p9pd-suggest-note svg { flex-shrink: 0; }
    .p9pd-suggest-note span { flex: 1 1 auto; }

/* Capital chart */
.p9pd-chart-wrap { padding: 0.5rem 0; overflow-x: auto; }
.p9pd-cap-svg    { display: block; width: 100%; }

/* Geographic concentration */
.p9pd-geo-chart-wrap { display: flex; flex-direction: column; gap: 0.55rem; padding-top: 0.3rem; }
.p9pd-geo-row {
    display: grid;
    grid-template-columns: 160px 1fr 52px 68px;
    align-items: center;
    gap: 0.75rem;
}
.p9pd-geo-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--p9pd-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.p9pd-geo-count { font-size: 0.68rem; font-weight: 400; color: var(--p9pd-muted); margin-left: 0.15rem; }
.p9pd-geo-bar-track { height: 10px; background: var(--p9pd-bg-subtle); border-radius: 5px; overflow: hidden; }
.p9pd-geo-bar { height: 100%; border-radius: 5px; transition: width 0.3s; }
.p9pd-geo-pct { font-size: 0.78rem; font-weight: 600; color: var(--p9pd-text); text-align: right; font-variant-numeric: tabular-nums; }
.p9pd-geo-amt { font-size: 0.78rem; color: var(--p9pd-text-mid); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
    .p9pd-geo-row { grid-template-columns: 100px 1fr 44px; }
    .p9pd-geo-amt { display: none; }
}

/* =========================================================
   PIPELINE DEAL PICKER  — shared cross-plugin styling
   ========================================================= */
.p9-deal-picker {
    display: block;
    width: 100%;
    margin-bottom: 0.65rem;
    padding: 0.5rem 2.1rem 0.5rem 0.75rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.82rem;
    color: var(--text, #2e2b26);
    background-color: #fff;
    border: 1px solid var(--border, rgba(154,111,46,0.25));
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239a6f2e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
}
.p9-deal-picker:hover {
    border-color: var(--accent, #9a6f2e);
}
.p9-deal-picker:focus {
    outline: none;
    border-color: var(--accent, #9a6f2e);
    box-shadow: 0 0 0 2px rgba(154,111,46,0.15);
}

/* Pipeline deal back-link on project cards */
.p9pd-pipeline-link {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--p9pd-accent, #9a6f2e);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    transition: opacity 0.15s;
}
.p9pd-pipeline-link:hover { opacity: 0.7; text-decoration: underline; }
