﻿/* ================================================================
   Goal Detail v2 — Owner-editable goal overlay
   Prefix: gd-  (goal detail)
   Mirrors tp-overlay/tp-popup pattern from work.css
   Task cards use gp-task-card styling from project-profile.css
   ================================================================ */

/* ── Overlay ── */
.gd-overlay {
  position: fixed; inset: 0; z-index: 12000;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .25s ease, visibility 0s .25s;
}
.gd-overlay.is-open {
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: opacity .25s ease, visibility 0s 0s;
}

/* ── Popup frame ── */
.gd-popup {
  position: relative;
  width: 94vw; max-width: 1080px; height: 90vh;
  background: var(--surf, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 64px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.06);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.97);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  pointer-events: auto;
}
.gd-overlay.is-open .gd-popup { transform: translateY(0) scale(1); }

/* ── Header ── */
.gd-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  cursor: grab; user-select: none;
}
.gd-header:active { cursor: grabbing; }

.gd-header-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gd-header-icon svg {
  width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2;
}

.gd-header-info { flex: 1; min-width: 0; }
.gd-header-title {
  font-size: 18px; font-weight: 800; color: var(--ink, #161616);
  line-height: 1.3; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gd-header-sub {
  font-size: 11px; font-weight: 500; color: var(--ink3, #8d8d8d);
  margin-top: 2px;
}

.gd-header-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.gd-status-pill {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 12px; border-radius: 10px;
}
.gd-status-pill--on-track  { background: #defbe6; color: #198038; }
.gd-status-pill--at-risk   { background: #fef3c7; color: #b45309; }
.gd-status-pill--behind    { background: #fff1f1; color: #da1e28; }
.gd-status-pill--complete  { background: #defbe6; color: #198038; }
.gd-status-pill--missed    { background: #fff1f1; color: #da1e28; }
.gd-status-pill--draft       { background: #f1f5f9; color: #475569; }
.gd-status-pill--not-started { background: #f1f5f9; color: #475569; }
/* Lifecycle: Active = green (healthy in-progress), Planning = neutral slate. */
.gd-status-pill--active      { background: #defbe6; color: #198038; }
.gd-status-pill--planning    { background: #f1f5f9; color: #475569; }
/* A manually-pinned pill gets a subtle ring so it's clear it's not auto. */
.gd-status-pill.is-pinned    { box-shadow: 0 0 0 1.5px rgba(100,116,139,.35); }

/* Sidebar "Status" field value: a small colored tag + an Auto/Pinned note. */
.gd-status-tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; line-height: 1.5;
}
.gd-status-tag-mode {
  margin-left: 7px; font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: #94a3b8;
}

.gd-hdr-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--ink3, #8d8d8d); transition: all .15s;
  font-family: inherit;
}
.gd-hdr-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-hdr-btn:hover { background: var(--border-s, #f1f5f9); color: var(--ink, #161616); }

/* Edit button — pill with label; turns green when toggled active (in edit mode).
   Sits inside .gp-topbar in the v3 shell, so we have to override .gp-topbar-btn's
   default red hover (which is meant for the close button). */
.gd-hdr-btn--edit {
  width: auto !important; gap: 6px; padding: 0 12px; height: 32px;
  font-size: 13px; font-weight: 600;
  color: var(--ink, #161616);
  display: inline-flex; align-items: center;
  border-radius: 8px;
}
.gd-hdr-btn--edit .gd-hdr-btn-label { line-height: 1; }
.gd-hdr-btn--edit svg { width: 14px !important; height: 14px !important; }
.gd-hdr-btn--edit:hover { background: var(--border-s, #f1f5f9) !important; color: var(--ink, #161616) !important; }
.gd-hdr-btn--edit.is-active { background: #059669 !important; color: #fff !important; }
.gd-hdr-btn--edit.is-active:hover { background: #047857 !important; color: #fff !important; }

/* Delete button — quiet by default, red on hover so it reads as destructive
   but doesn't shout. Only shown to admins / owning leads (project-detail.js). */
.gd-hdr-btn--delete { color: var(--muted, #64748b); border-radius: 8px; }
.gd-hdr-btn--delete svg { width: 16px !important; height: 16px !important; }
.gd-hdr-btn--delete:hover { background: #fee2e2 !important; color: #dc2626 !important; }

/* ── Body (two-column) ── */
.gd-body {
  flex: 1; overflow: hidden; min-height: 0;
  display: flex;
}

/* ── Main (left column) ── */
.gd-main {
  flex: 1; min-width: 0; overflow-y: auto;
  padding: 20px 28px;
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}

/* ── Pill tab bar ── */
.gd-pill-bar {
  display: flex; gap: 6px;
  margin-bottom: 22px;
  flex-shrink: 0;
}
.gd-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  color: var(--ink3, #8d8d8d);
  background: var(--border-s, #f1f5f9);
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: all .15s; font-family: inherit;
}
.gd-pill:hover { color: var(--ink2, #525252); background: var(--border, #e2e8f0); }
.gd-pill.is-active {
  background: #059669; color: #fff;
  border-color: #059669;
}
.gd-pill svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-pill-badge {
  font-size: 9px; font-weight: 800;
  background: rgba(255,255,255,.25); color: inherit;
  padding: 1px 6px; border-radius: 8px;
  min-width: 14px; text-align: center;
}
.gd-pill-badge:empty { display: none; }
.gd-pill.is-active .gd-pill-badge { background: rgba(255,255,255,.3); }

/* ── Tab panels ── */
.gd-panel {
  display: none;
  animation: gdPanelIn .22s ease;
  flex: 1;
}
.gd-panel.is-active { display: block; }
@keyframes gdPanelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Blocks ── */
.gd-block { margin-bottom: 24px; }
.gd-block-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--_head-c, var(--ink2, #525252));
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border-s, #f1f5f9);
}
.gd-block-head svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-block-count {
  margin-left: auto; font-size: 10px; font-weight: 800;
  background: var(--c-green-bg, #dcfce7); color: var(--c-green, #16a34a);
  padding: 2px 7px; border-radius: 10px;
}

/* ── Read-only text blocks (owner-editable) ── */
.gd-text {
  font-size: 13px; line-height: 1.65; color: var(--ink, #161616);
  padding: 10px 12px; border-radius: 8px;
  background: var(--border-s, #f8fafc);
  border: 1px solid var(--border-s, #f1f5f9);
  min-height: 36px;
  white-space: pre-wrap; word-break: break-word;
}
/* Goal "How it's measured" — baseline → target progress bar */
.gd-measure { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.gd-measure-pt { font-size: 12px; font-weight: 700; white-space: nowrap; }
.gd-measure-pt--base { color: #64748b; }
.gd-measure-pt--target { color: #0f172a; }
.gd-measure-bar { flex: 1; height: 8px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.gd-measure-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 999px; transition: width .25s ease; }
.gd-measure-meta { font-size: 11.5px; color: #64748b; margin-top: 6px; }
.gd-text-empty {
  color: var(--ink3, #64748b); font-style: italic;
  background: repeating-linear-gradient(
    -45deg,
    var(--border-s, #f8fafc) 0 10px,
    rgba(148, 163, 184, .06) 10px 20px
  );
  border-style: dashed; border-color: rgba(148, 163, 184, .35);
}
/* Owner can click to edit */
.gd-overlay.is-owner.is-editing .gd-text {
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.gd-overlay.is-owner.is-editing .gd-text:hover {
  border-color: rgba(5,150,105,.25);
  box-shadow: 0 0 0 2px rgba(5,150,105,.08);
}
.gd-text-edit {
  font-size: 13px; line-height: 1.65; color: var(--ink, #161616);
  padding: 10px 12px; border-radius: 8px;
  background: var(--surf, #fff);
  border: 1.5px solid var(--c-green, #059669);
  box-shadow: 0 0 0 3px rgba(5,150,105,.12);
  min-height: 60px; width: 100%; resize: vertical;
  font-family: inherit; outline: none;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Task list — match gp-task-card style ── */
.gd-task-list { display: flex; flex-direction: column; gap: 4px; }

.gd-task {
  border: 1px solid rgba(0,0,0,.06); border-radius: 10px;
  padding: 8px 10px; cursor: pointer;
  background: var(--surf, #fff);
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.gd-task:hover {
  border-color: rgba(0,0,0,.12); transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,.04);
}
.gd-task.is-done { opacity: .55; }

.gd-task-row {
  display: flex; align-items: center; gap: 6px;
}

.gd-task-check {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink4, #cbd5e1); pointer-events: none;
}
.gd-task-check svg { width: 18px; height: 18px; }
.gd-task.is-done .gd-task-check { color: var(--c-green, #16a34a); }

.gd-task-pri-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}

.gd-task-name {
  flex: 1; font-size: 13px; font-weight: 600;
  color: var(--ink, #111); line-height: 1.35;
  min-width: 0; word-break: break-word;
  padding: 1px 4px;
}
.gd-task.is-done .gd-task-name {
  text-decoration: line-through; color: var(--ink4, #9ca3af);
}

.gd-task-meta {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  margin-top: 4px; padding-left: 26px;
}
.gd-task-chip {
  font-size: 10px; padding: 2px 7px; border-radius: 5px;
  background: rgba(0,0,0,.04); color: var(--ink2, #475569);
  font-weight: 600; display: inline-flex; align-items: center; gap: 3px;
}
.gd-task-chip svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-task-chip--pri-critical { background: rgba(220,38,38,.08); color: #dc2626; }
.gd-task-chip--pri-high { background: rgba(239,68,68,.08); color: #ef4444; }
.gd-task-chip--pri-medium { background: rgba(217,119,6,.08); color: #d97706; }
.gd-task-chip--pri-low { background: rgba(22,163,74,.08); color: #16a34a; }
.gd-task-chip--submit { background: rgba(99,102,241,.08); color: #6366f1; }
.gd-task-chip--due { background: rgba(217,119,6,.06); color: #b45309; }
.gd-task-chip--assignee { background: rgba(139,92,246,.08); color: #7c3aed; }
.gd-task-chip--desc { background: rgba(13,148,136,.06); color: #0d9488; cursor: help; }

.gd-task-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px; color: var(--ink4, #94a3b8); text-align: center;
  font-size: 12px;
  border: 1.5px dashed var(--border, #e5e7eb); border-radius: 14px;
  background: rgba(59,130,246,.02);
}
.gd-task-empty svg { width: 28px; height: 28px; opacity: .4; }

/* ── Team member cards with progress ── */
.gd-team-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px;
  margin-bottom: 20px;
}
.gd-team-stat {
  padding: 12px; border-radius: 10px; text-align: center;
  background: var(--surf, #fff); border: 1px solid var(--border, #e2e8f0);
}
.gd-team-stat-val {
  font-size: 22px; font-weight: 800; color: var(--ink, #161616);
  line-height: 1;
}
.gd-team-stat-label {
  font-size: 10px; font-weight: 600; color: var(--ink3, #8d8d8d);
  text-transform: uppercase; letter-spacing: .04em;
  margin-top: 4px;
}
.gd-team-stat--green .gd-team-stat-val { color: var(--c-green, #16a34a); }
.gd-team-stat--yellow .gd-team-stat-val { color: var(--c-yellow, #ca8a04); }
.gd-team-stat--red .gd-team-stat-val { color: var(--c-red, #dc2626); }

.gd-member-list { display: flex; flex-direction: column; gap: 6px; }

.gd-member {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surf, #fff);
  border: 1px solid var(--border-s, #f1f5f9);
  transition: border-color .15s, box-shadow .15s;
}
.gd-member:hover {
  border-color: var(--border, #e2e8f0);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.gd-member-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
  flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,.12);
  overflow: hidden;
}
.gd-member-avatar--img { background: #e2e8f0; }
.gd-member-avatar--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gd-member-body { flex: 1; min-width: 0; }
.gd-member-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.gd-member-name {
  font-size: 13px; font-weight: 700; color: var(--ink, #161616);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.gd-member-owner-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 6px; border-radius: 6px;
  background: rgba(5,150,105,.1); color: #059669;
}
.gd-member-role {
  font-size: 10px; color: var(--ink3, #8d8d8d);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  margin-bottom: 6px;
}
.gd-member-progress-bar {
  height: 4px; border-radius: 4px; background: var(--border, #e2e8f0);
  overflow: hidden; position: relative;
}
.gd-member-progress-fill {
  height: 100%; border-radius: 4px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.gd-member-progress-fill--good { background: var(--c-green, #16a34a); }
.gd-member-progress-fill--ok { background: var(--c-yellow, #ca8a04); }
.gd-member-progress-fill--bad { background: var(--c-red, #dc2626); }

.gd-member-stats {
  display: flex; gap: 10px; margin-top: 4px;
}
.gd-member-stat {
  font-size: 10px; font-weight: 600; color: var(--ink3, #8d8d8d);
  display: inline-flex; align-items: center; gap: 3px;
}
.gd-member-stat svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-member-stat--pct { font-weight: 800; }
.gd-member-stat--good { color: var(--c-green, #16a34a); }
.gd-member-stat--ok { color: var(--c-yellow, #ca8a04); }
.gd-member-stat--bad { color: var(--c-red, #dc2626); }

.gd-member-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px; color: var(--ink4, #94a3b8); text-align: center;
  font-size: 12px;
  border: 1.5px dashed var(--border, #e5e7eb); border-radius: 14px;
  background: rgba(59,130,246,.02);
}
.gd-member-empty svg { width: 28px; height: 28px; opacity: .4; }

/* ── Connected goals ── */
.gd-connected-list { display: flex; flex-direction: column; gap: 4px; }

.gd-connected-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--ink2, #525252);
  transition: background .12s; cursor: pointer;
}
.gd-connected-item:hover { background: var(--border-s, #f1f5f9); }
.gd-connected-item svg {
  width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2;
  flex-shrink: 0; color: var(--ink3, #8d8d8d);
}
.gd-connected-type {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink4, #94a3b8);
  margin-left: auto; flex-shrink: 0;
}
.gd-connected-remove {
  width: 18px; height: 18px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--ink4, #94a3b8); flex-shrink: 0;
  transition: color .15s, background .15s;
}
.gd-connected-remove svg { width: 10px; height: 10px; }
.gd-connected-remove:hover { color: var(--c-red, #dc2626); background: rgba(220,38,38,.06); }
.gd-overlay.is-owner.is-editing .gd-connected-remove { display: flex; }

/* Link goal button (owner only) */
.gd-link-goal-btn {
  display: none; align-items: center; gap: 6px;
  margin-top: 8px; padding: 8px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--c-green, #059669);
  background: rgba(5,150,105,.06); border: 1px dashed rgba(5,150,105,.25);
  cursor: pointer; transition: all .15s; font-family: inherit;
  width: 100%;
}
.gd-link-goal-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.gd-link-goal-btn:hover { background: rgba(5,150,105,.1); border-color: rgba(5,150,105,.4); }
.gd-overlay.is-owner.is-editing .gd-link-goal-btn { display: inline-flex; }

/* Link goal dropdown */
.gd-link-dropdown {
  display: none; margin-top: 6px;
  background: var(--surf, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 8px; max-height: 200px; overflow-y: auto;
}
.gd-link-dropdown.is-open { display: block; }
.gd-link-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--ink2, #525252);
  border: none; background: none; width: 100%; text-align: left;
  font-family: inherit; transition: background .12s;
}
.gd-link-dropdown-item:hover { background: var(--border-s, #f1f5f9); }
.gd-link-dropdown-item svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.gd-link-dropdown-empty {
  padding: 12px; text-align: center; font-size: 11px;
  color: var(--ink4, #94a3b8); font-style: italic;
}

/* Link project button (admins/owners only) — compact pill, NOT a giant card */
.gd-link-project-btn {
  display: none; align-items: center; gap: 6px;
  margin-top: 8px; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--c-green, #059669);
  background: rgba(5,150,105,.06);
  border: 1px dashed rgba(5,150,105,.28);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  font-family: inherit;
  width: auto; align-self: flex-start;
}
.gd-link-project-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.gd-link-project-btn:hover { background: rgba(5,150,105,.1); border-color: rgba(5,150,105,.45); }
.gd-overlay.is-owner.is-editing .gd-link-project-btn { display: inline-flex; }

/* Sidebar editable field — hover affordance for owner/admin */
.gd-overlay.is-owner.is-editing .gd-sb-field[data-gd-sb-edit] {
  cursor: pointer; border-radius: 8px;
  transition: background .12s;
}
.gd-overlay.is-owner.is-editing .gd-sb-field[data-gd-sb-edit]:hover {
  background: rgba(99,102,241,.05);
}
.gd-overlay.is-owner.is-editing .gd-sb-field[data-gd-sb-edit]:hover::after {
  content: '✎';
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--ink4, #94a3b8); pointer-events: none;
}
.gd-sb-field[data-gd-sb-edit] { position: relative; }

.gd-sb-edit-input {
  width: 100%;
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid rgba(99,102,241,.32);
  background: var(--surf, #fff); font: inherit; font-size: 12px;
  color: var(--ink, #0f172a); font-family: inherit;
  outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

/* Heads-Up risks */
.gd-sb-risks .gd-sb-risk-list { display: flex; flex-direction: column; gap: 6px; }
.gd-sb-risk {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600;
}
.gd-sb-risk svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.gd-sb-risk--red   { background: rgba(220,38,38,.06); color: #dc2626; }
.gd-sb-risk--amber { background: rgba(217,119,6,.07);  color: #b45309; }

/* Program chip in sidebar */
.gd-program-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(99,102,241,.08);
  color: #4f46e5; font-weight: 700; font-size: 11px;
  text-decoration: none;
  border: 1px solid rgba(99,102,241,.18);
  transition: background .12s, border-color .12s;
  max-width: 100%;
}
.gd-program-chip:hover { background: rgba(99,102,241,.14); border-color: rgba(99,102,241,.32); }
.gd-program-chip svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.gd-program-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── RIGHT SIDEBAR ── */
.gd-sidebar {
  width: 280px; flex-shrink: 0;
  border-left: 1px solid var(--border, #e2e8f0);
  padding: 20px 18px;
  overflow-y: auto;
  background: var(--border-s, #f8fafc);
}

/* Sidebar progress ring */
.gd-sb-progress {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 20px;
  background: var(--surf, #fff);
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
}
.gd-sb-ring-wrap {
  position: relative; width: 64px; height: 64px; flex-shrink: 0;
}
.gd-sb-ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.gd-sb-ring-bg {
  fill: none; stroke: var(--border, #e2e8f0);
  stroke-width: 5; stroke-linecap: round;
}
.gd-sb-ring-fill {
  fill: none; stroke: var(--c-green, #16a34a);
  stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 188.496; stroke-dashoffset: 188.496;
  transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1), stroke .3s;
}
.gd-sb-ring-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--c-green, #16a34a);
  transition: color .3s;
}
.gd-sb-progress-info { flex: 1; min-width: 0; }
.gd-sb-progress-label {
  font-size: 12px; font-weight: 700; color: var(--ink, #161616);
  display: block; margin-bottom: 2px;
}
.gd-sb-progress-detail {
  font-size: 11px; color: var(--ink3, #8d8d8d); display: block;
}

/* Ring color states */
.gd-sb-progress[data-status="good"]  .gd-sb-ring-fill { stroke: var(--c-green, #16a34a); }
.gd-sb-progress[data-status="good"]  .gd-sb-ring-pct  { color: var(--c-green, #16a34a); }
.gd-sb-progress[data-status="ok"]    .gd-sb-ring-fill { stroke: var(--c-yellow, #ca8a04); }
.gd-sb-progress[data-status="ok"]    .gd-sb-ring-pct  { color: var(--c-yellow, #ca8a04); }
.gd-sb-progress[data-status="bad"]   .gd-sb-ring-fill { stroke: var(--c-red, #dc2626); }
.gd-sb-progress[data-status="bad"]   .gd-sb-ring-pct  { color: var(--c-red, #dc2626); }
.gd-sb-progress[data-status="done"]  .gd-sb-ring-fill { stroke: var(--c-green, #16a34a); }
.gd-sb-progress[data-status="done"]  .gd-sb-ring-pct  { color: var(--c-green, #16a34a); }

/* Sidebar sections */
.gd-sb-section { margin-bottom: 18px; }
.gd-sb-heading {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink3, #8d8d8d);
  margin-bottom: 10px;
}

/* Sidebar meta fields
   ── Alignment, because a long value used to break this row: the label is a
   fixed 86px column and the value gets its own, both TOP-aligned. A centred
   label floated to the middle of a three-line project name, which is what made
   the rail read as crammed and unfinished. `min-height:22px` + centre INSIDE
   the label box keeps single-line rows (and the 22px avatar / stage pill)
   optically level, so nothing jitters between one-line and wrapped rows.
   Keep .gd-sb-* and work.css's .tp-sb-* identical — they are the same
   component, and the deliverable rail is required to match the others. */
.gd-sb-field {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  transition: background .18s, box-shadow .18s; margin-bottom: 1px;
}
.gd-sb-field-label {
  width: 96px; flex-shrink: 0; min-height: 22px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink3, #8d8d8d);
  line-height: 1.3;
}
.gd-sb-field-label svg {
  width: 13px; height: 13px; stroke: currentColor; fill: none;
  stroke-width: 2; flex-shrink: 0;
}
.gd-sb-field-value {
  flex: 1; min-width: 0; min-height: 22px;
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 12.5px; font-weight: 650; color: var(--ink, #0f172a);
  line-height: 1.45; overflow-wrap: anywhere;
}
/* Long free text (a project name) reads as at most three lines, with the whole
   thing on the row's title attribute. */
.gd-sb-field-value--clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden;
}
/* Nothing set yet is stated quietly — it should not carry the same weight as
   a real value sitting next to it. */
.gd-sb-field-value.is-empty { color: var(--ink4, #94a3b8); font-weight: 600; }
.gd-sb-field-av {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  overflow: hidden;
}
.gd-sb-field-av--img { background: transparent; }
.gd-sb-field-av--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gd-sb-field.is-overdue .gd-sb-field-value { color: var(--c-red, #dc2626); }

/* AREA OF THE BUSINESS — the chip and, under it, WHERE THE ANSWER CAME FROM.
   A chip alone cannot tell you whether a person picked this area or the parent
   project handed it down, and on this row that difference is the whole point
   (see _pdAreaValueHtml). The note is a block on its own line because the value
   is a wrapping flex box: an inline sibling rides up beside the chip at wide
   widths and reads as part of it. */
.gd-sb-area { flex-direction: column; align-items: flex-start; gap: 3px; }
.gd-sb-area-note {
  display: block; width: 100%;
  font-size: 11px; font-weight: 600; color: var(--ink4, #94a3b8);
  line-height: 1.35;
}

/* Sidebar audit */
.gd-sb-audit {
  font-size: 11px; color: var(--ink4, #94a3b8); line-height: 1.6;
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 10px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .gd-popup { width: 98vw; height: 96vh; border-radius: 10px; }
  .gd-body { flex-direction: column; }
  .gd-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--border, #e2e8f0); max-height: 260px; }
  .gd-header { padding: 14px 16px; gap: 10px; }
  .gd-main { padding: 16px; }
  .gd-member-list { gap: 4px; }
  .gd-team-summary { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}

/* ================================================================
   v3 — Mini Program popup chrome (full tab system)
   Reuses gp-popup classes from engagement-profile.css.
   ================================================================ */
.gp-popup.gp-popup--project-mini {
  /* Override the absolute positioning inherited from .gp-popup (which assumes
     a .gp-overlay parent). Inside .gd-overlay we want plain flex centering. */
  position: relative; top: auto; left: auto;
  width: 92vw; max-width: 1100px; height: 88vh;
  max-height: 1040px;
  display: flex; flex-direction: column;
  background: var(--surf, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 64px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(.97);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
  pointer-events: auto;
}
.gd-overlay.is-open .gp-popup--project-mini { opacity: 1; transform: translateY(0) scale(1); }
.gp-popup--project-mini > .gp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0; }

/* "Inside Program X" breadcrumb + subtitle meta — sit in the gp-topbar
   subtitle row so the program lineage is unmissable. */
.gp-popup--project-mini .gp-topbar-subtitle {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.gp-popup--project-mini .gp-topbar-subtitle .gd-program-chip {
  padding: 4px 11px;
  font-size: 12px;
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.28);
}
.gp-popup--project-mini .gp-topbar-subtitle .gd-program-chip:hover {
  background: rgba(99,102,241,.2);
  border-color: rgba(99,102,241,.4);
}
.gp-popup--project-mini .gp-topbar-subtitle .gd-sub-meta {
  font-size: 12px; color: var(--ink3, #64748b); font-weight: 500;
}
.gp-popup--project-mini .gp-topbar-subtitle .gd-sub-dot {
  color: var(--ink4, #cbd5e1); font-weight: 400; margin: 0 2px;
}

/* Edit-mode visual transition — orange tab strip + subtle slide-in marker.
   Mirrors the program popup pattern (.ep-is-editing #epTabs) so all three
   popups (program/project/task) feel identical when entering Edit mode. */
.gd-overlay #pdpTabs { transition: background .2s ease, border-bottom-color .2s ease; }
.gd-overlay.is-editing #pdpTabs {
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  border-bottom: 1px solid #fdba74;
}
/* Pulsing "EDITING" badge slides in from the right when Edit mode is on. */
.gd-overlay #pdpEditBanner { display: none; }
.gd-overlay.is-editing #pdpEditBanner {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: #fed7aa; color: #9a3412;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  animation: pdpEditBannerIn .25s ease;
}
@keyframes pdpEditBannerIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Typeahead for "Link a Program/Project" — replaces the static dropdown. */
.gd-link-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surf-2, #f8fafc);
}
.gd-link-search svg { width: 14px; height: 14px; stroke: var(--ink3, #64748b); fill: none; stroke-width: 2; flex-shrink: 0; }
.gd-link-search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 13px; font-family: inherit; color: var(--ink, #0f172a);
  padding: 2px 0;
}
.gd-link-search-input::placeholder { color: var(--ink4, #94a3b8); }
.gd-link-results { max-height: 280px; overflow-y: auto; }

/* Always-visible typeahead variant (no button trigger) */
.gd-link-typeahead {
  position: relative; margin-top: 8px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
  background: var(--surf, #fff); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.gd-link-typeahead:focus-within {
  border-color: rgba(5,150,105,.45);
  box-shadow: 0 0 0 3px rgba(5,150,105,.10);
}
.gd-link-typeahead .gd-link-search { background: transparent; border-bottom: 0; }
.gd-link-typeahead .gd-link-results {
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surf, #fff);
}
.gd-link-typeahead .gd-link-results[hidden] { display: none; }

.pdp-tab-pane { padding: 22px 28px 32px; animation: pdp-fade .18s ease; }
@keyframes pdp-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pdp-tab-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 16px; }
.pdp-tab-head h3 { font-size: 15px; font-weight: 800; color: var(--ink, #0f172a); margin: 0; }

/* Overview: 2-column main + sidebar */
.pdp-overview {
  display: grid; grid-template-columns: 1fr 280px; gap: 24px;
  padding: 22px 28px 32px;
}
.pdp-overview-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.pdp-overview-side { display: flex; flex-direction: column; gap: 14px; }

.pdp-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 36px 24px; color: var(--ink4, #94a3b8); text-align: center;
  font-size: 13px; font-weight: 600;
  border: 1.5px dashed var(--border, #e5e7eb); border-radius: 14px;
  background: rgba(99,102,241,.02);
}
.pdp-empty svg { width: 32px; height: 32px; opacity: .4; stroke: currentColor; fill: none; stroke-width: 1.5; }

.pdp-good {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 44px 28px; border-radius: 16px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(16,185,129,.07), rgba(16,185,129,0) 70%),
    #fbfefc;
  border: 1px solid rgba(16,185,129,.16);
  color: #047857;
  animation: pdpGoodIn .32s cubic-bezier(.22,1,.36,1) both;
}
.pdp-good-badge {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin-bottom: 6px;
  border-radius: 50%;
  background: rgba(16,185,129,.1);
  box-shadow: 0 0 0 6px rgba(16,185,129,.05);
}
.pdp-good-badge svg { width: 28px; height: 28px; stroke: #059669; fill: none; stroke-width: 2.2; }
.pdp-good-title { font-size: 16px; font-weight: 800; color: #065f46; letter-spacing: -.01em; }
.pdp-good-sub { font-size: 13px; line-height: 1.5; color: #5b7d70; max-width: 420px; }
.pdp-good-cta {
  margin-top: 14px; padding: 9px 16px;
  font-size: 13px; font-weight: 700; font-family: inherit;
  color: #fff; background: #059669; border: 0; border-radius: 9px;
  cursor: pointer; transition: background .14s, transform .14s, box-shadow .14s;
  box-shadow: 0 2px 8px rgba(5,150,105,.28);
}
.pdp-good-cta:hover { background: #047857; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(5,150,105,.34); }
.pdp-good-cta:active { transform: translateY(0); }
@keyframes pdpGoodIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.pdp-stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.pdp-stat {
  background: var(--surf-2, #f8fafc); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 12px 14px;
}
.pdp-stat-val { font-size: 18px; font-weight: 800; color: var(--ink, #0f172a); }
.pdp-stat-val--bad { color: #dc2626; }
.pdp-stat-val--ok  { color: #d97706; }
.pdp-stat-label { font-size: 11px; font-weight: 600; color: var(--ink3, #64748b); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.pdp-add-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700;
  background: var(--c-green, #059669); color: #fff;
  border: none; cursor: pointer; font-family: inherit;
  transition: background .15s, transform .12s;
}
.pdp-add-btn:hover { background: #047857; }
.pdp-add-btn:active { transform: translateY(1px); }
/* Add/Log buttons across every tab are mutations — hide unless in Edit mode.
   (Render code still emits them only for owners; this layer hides them from
   owners too until they enter Edit mode.) */
.gd-overlay:not(.is-editing) .pdp-add-btn { display: none !important; }
.pdp-add-btn--ghost {
  background: transparent; color: var(--c-green, #059669);
  border: 1px solid rgba(5,150,105,.3);
}
.pdp-add-btn--ghost:hover { background: rgba(5,150,105,.08); }

.pdp-section { margin-bottom: 18px; }
.pdp-section-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink3, #64748b);
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 8px;
}
.pdp-section-count {
  margin-left: auto;
  background: var(--surf-2, #f1f5f9); color: var(--ink2, #475569);
  padding: 1px 8px; border-radius: 999px; font-size: 10px;
}

.pdp-task-list { display: flex; flex-direction: column; gap: 4px; }

.pdp-del-list { display: flex; flex-direction: column; gap: 4px; }
.pdp-del-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surf-2, #f8fafc); border: 1px solid var(--border, #e5e7eb);
  font-size: 13px;
}
.pdp-del-row.is-done .pdp-del-title { text-decoration: line-through; color: var(--ink3, #64748b); }
.pdp-del-check {
  width: 22px; height: 22px; border: none; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink3, #64748b);
}
.pdp-del-row.is-done .pdp-del-check { color: var(--c-green, #059669); }
.pdp-del-check svg { width: 18px; height: 18px; }
.pdp-del-title { flex: 1; min-width: 0; font-weight: 600; color: var(--ink, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdp-del-date {
  font-size: 11px; font-weight: 600; color: var(--ink3, #64748b);
  background: var(--surf, #fff); padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb);
}

/* 🚨 THE TIME TAB'S ROWS ARE NOT DRAWN HERE ANY MORE, AND NEITHER ARE THEY
   STYLED HERE. They are financials.js's `WkFinEntriesTable` rows — the same
   markup and the same `.fin-tb-*` classes as the Entries tab, dressed by
   fin-rollups.css, which is a plain <link> in Work.html's head and therefore
   always present. `pdp-tb` is a SCOPE HOOK for a harness and nothing else:
   an override here would be this popup disagreeing with the one table, which
   is the exact drift the shared builder exists to prevent. Same rule, and the
   same reason, as `.mts-tb` in wk-my-timesheet.css.

   Gone with the old rows: .pdp-time-row / -date / -who / -hours / -bill /
   -note / -go — a five-field shape nothing else in the app used, a name it
   resolved itself ("Unknown"), and a date one day out from the same entry
   on the Entries tab. */
.pdp-time-list { display: block; }
.pdp-time-loading,
.pdp-time-none {
  padding: 18px 12px; text-align: center;
  font-size: 12.5px; color: var(--ink3, #64748b);
}
/* The shared filter toolbar (WkTimeFilters.toolbarHtml) inside the popup.
   `.fin-tb-toolbar` already lays it out on the Financials tab; all this adds is
   the room it needs away from a page header it does not have here. */
.pdp-time-bar { margin: 0 0 14px; flex-wrap: wrap; row-gap: 8px; }

.pdp-roll-crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink3, #64748b); margin: -6px 0 14px;
}
.pdp-roll-crumb--warn {
  background: rgba(217,119,6,.07); color: #b45309;
  padding: 8px 12px; border-radius: 10px; border: 1px dashed rgba(217,119,6,.25);
  font-weight: 600;
}

.pdp-budget-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pdp-budget-row {
  background: var(--surf-2, #f8fafc); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: 10px 14px;
}
.pdp-budget-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pdp-budget-name { font-size: 13px; font-weight: 700; color: var(--ink, #0f172a); }
.pdp-budget-amt { font-size: 12px; font-weight: 700; color: var(--ink2, #475569); }
.pdp-budget-bar { height: 6px; background: rgba(15,23,42,.06); border-radius: 999px; overflow: hidden; }
.pdp-budget-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.pdp-budget-fill--good { background: linear-gradient(90deg, #10b981, #34d399); }
.pdp-budget-fill--ok   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.pdp-budget-fill--bad  { background: linear-gradient(90deg, #ef4444, #f87171); }

.pdp-expense-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.pdp-expense-row {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center;
  padding: 8px 14px; border-radius: 10px;
  background: var(--surf-2, #f8fafc); border: 1px solid var(--border, #e5e7eb);
  font-size: 12.5px;
}
.pdp-expense-date { font-weight: 600; color: var(--ink2, #475569); }
.pdp-expense-name { font-weight: 600; color: var(--ink, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdp-expense-amt  { font-weight: 800; color: var(--ink, #0f172a); }

.pdp-risk-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pdp-risk-pill { font-size: 12px; font-weight: 700; }

.pdp-doc-list { display: flex; flex-direction: column; gap: 4px; }
.pdp-doc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surf-2, #f8fafc); border: 1px solid var(--border, #e5e7eb);
  font-size: 13px; font-weight: 600; color: var(--ink, #0f172a);
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.pdp-doc-row:hover { background: rgba(99,102,241,.05); border-color: rgba(99,102,241,.25); }
.pdp-doc-row svg { width: 16px; height: 16px; stroke: var(--ink3, #64748b); fill: none; stroke-width: 2; flex-shrink: 0; }
.pdp-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdp-doc-size { font-size: 11px; color: var(--ink3, #64748b); }

.pdp-tab-pane .gd-block { background: var(--surf, #fff); }

@media (max-width: 980px) {
  .pdp-overview { grid-template-columns: 1fr; }
  .pdp-overview-side { order: -1; }
  .gp-popup.gp-popup--project-mini { width: 96vw; height: 92vh; }
}

/* ── Delete moved into the ⋯ menu ──────────────────────────────────────
   #gdDelete stays in the DOM: project-detail.js still owns the permission
   rule (it toggles this button's inline display) and the confirm/cascade
   handler, and the ⋯ item just reuses both. !important because that inline
   display:'' would otherwise win. */
#gdDelete { display: none !important; }
