
/* ===== GREG (Guided Rep Engagement Generator) - entry button + panel =====
   Uses the app's existing cockpit tokens (--panel,--panel2,--line,--text,
   --text-mid,--text-muted,--ff-disp,--ff-body,--ff-mono,--green). GREG gets
   its own accent pair (emerald -> teal) distinct from --accent (blue), so it
   reads as a separate feature rather than more app chrome. */
:root { --greg-1:#3FD88E; --greg-2:#1FA8C9; }

.score-event-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.score-event-row .score-event { margin:0; }

.greg-entry-btn {
  flex-shrink:0; display:flex; align-items:center; gap:7px;
  background:rgba(63,216,142,0.10); border:1px solid rgba(63,216,142,0.4);
  border-radius:20px; padding:7px 14px 7px 11px; cursor:pointer; margin-top:2px;
  transition:box-shadow .2s, border-color .2s;
}
.greg-entry-btn:hover { box-shadow:0 0 18px rgba(63,216,142,.28); border-color:rgba(63,216,142,0.6); }
.greg-spark-wrap { position:relative; width:16px; height:16px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.greg-spark-glow { position:absolute; inset:-5px; border-radius:50%; background:radial-gradient(circle, rgba(63,216,142,0.55), transparent 70%); animation:greg-pulse 2.4s ease-in-out infinite; }
.greg-spark-wrap svg { position:relative; width:15px; height:15px; filter:drop-shadow(0 0 4px rgba(63,216,142,.8)); }
.greg-entry-label {
  font-size:13px; font-family:var(--ff-disp); font-weight:600;
  background:linear-gradient(100deg, var(--greg-1) 10%, var(--greg-2) 90%);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
}
@keyframes greg-pulse { 0%,100%{ opacity:.55; transform:scale(1); } 50%{ opacity:1; transform:scale(1.08); } }
@keyframes greg-rise { from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:translateY(0); } }

#greg-modal .modal-box { max-width:420px; padding:0; text-align:left; background:var(--panel); }
.greg-panel { position:relative; padding:18px; overflow:hidden; }
.greg-panel::before {
  content:''; position:absolute; top:-60px; left:-20%; width:140%; height:160px;
  background:radial-gradient(closest-side, rgba(63,216,142,0.16), transparent 70%); pointer-events:none;
}
.greg-panel-header { position:relative; display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.greg-panel-title { display:flex; align-items:center; gap:8px; }
.greg-title-text { display:flex; align-items:baseline; gap:7px; flex-wrap:wrap; }
.greg-title-main { font-family:var(--ff-disp); font-size:15px; font-weight:600; letter-spacing:.01em;
  background:linear-gradient(100deg, #EAF1F8 10%, var(--greg-1) 50%, var(--greg-2) 90%); background-size:220% auto;
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; animation:greg-drift 6s ease-in-out infinite; }
.greg-title-sub { font-family:var(--ff-body); font-size:11px; font-weight:400; color:var(--text-muted); letter-spacing:.01em; }
@keyframes greg-drift { 0%,100%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } }
.greg-close { color:var(--text-muted); cursor:pointer; width:16px; height:16px; transition:color .15s; background:none; border:none; padding:0; }
.greg-close:hover { color:var(--text-mid); }

.greg-ctx-line { position:relative; font-size:11.5px; color:var(--text-muted); margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--line); line-height:1.6; }
.greg-ctx-line b { color:var(--text-mid); font-weight:500; }
.greg-ctx-pulse { display:inline-block; width:5px; height:5px; border-radius:50%; background:var(--green); box-shadow:0 0 6px rgba(63,216,142,.9); margin-right:6px; vertical-align:middle; }

.greg-thread { display:flex; flex-direction:column; gap:12px; margin-bottom:14px; max-height:46vh; overflow-y:auto; }
.greg-bubble-rep { align-self:flex-end; background:var(--panel2); color:var(--text-mid); font-size:13px; line-height:1.5; padding:9px 12px; border-radius:10px; max-width:82%; font-family:var(--ff-body); }
.greg-row { display:flex; flex-direction:column; gap:6px; animation:greg-rise .35s ease-out; }
.greg-label { display:flex; align-items:center; gap:5px; font-family:var(--ff-mono); font-size:10px; color:var(--greg-1); letter-spacing:.1em; text-transform:uppercase; }
.greg-label svg { width:10px; height:10px; filter:drop-shadow(0 0 3px rgba(63,216,142,.8)); }
.greg-say { position:relative; color:var(--text); font-size:14.5px; line-height:1.55; font-weight:450; padding:12px 14px; border-radius:4px 12px 12px 12px;
  background:linear-gradient(135deg, rgba(63,216,142,0.10), rgba(31,168,201,0.05)); border-left:2px solid var(--greg-1); font-family:var(--ff-body); white-space:pre-wrap; }
.greg-coach { color:var(--text-muted); font-size:12px; line-height:1.5; padding-left:14px; }
.greg-thinking { display:flex; align-items:center; gap:6px; padding-left:14px; color:var(--text-muted); font-size:12px; font-family:var(--ff-mono); }
.greg-thinking .dot { width:4px; height:4px; border-radius:50%; background:var(--greg-1); animation:greg-pulse 1s ease-in-out infinite; }
.greg-thinking .dot:nth-child(2) { animation-delay:.15s; }
.greg-thinking .dot:nth-child(3) { animation-delay:.3s; }

.greg-input-row { display:flex; align-items:center; gap:8px; background:var(--panel2); border:1px solid var(--line); border-radius:11px; padding:4px 4px 4px 14px; transition:border-color .2s, box-shadow .2s; }
.greg-input-row:focus-within { border-color:rgba(63,216,142,0.55); box-shadow:0 0 0 3px rgba(63,216,142,0.10), 0 0 20px rgba(63,216,142,0.12); }
.greg-input-row input { flex:1; background:transparent; border:none; outline:none; color:var(--text); font-size:13.5px; font-family:var(--ff-body); min-width:0; padding:9px 0; }
/* A generic `input[type="text"]:focus` rule elsewhere in this file forces a
   white background on focus for light-themed forms. Win that fight here too,
   same pattern as #event-setup .event-input. */
.greg-input-row input,
.greg-input-row input:focus {
  background: transparent !important;
  box-shadow: none !important;
}
/* Some browsers force a light background + dark text on inputs they guess
   are autofillable. Force our own dark colors back, same fix as .event-input. */
.greg-input-row input:-webkit-autofill,
.greg-input-row input:-webkit-autofill:hover,
.greg-input-row input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--panel2) inset;
  box-shadow: 0 0 0px 1000px var(--panel2) inset;
  caret-color: var(--text);
}
.greg-input-row input::placeholder { color:var(--text-muted); }
.greg-send-btn { flex-shrink:0; width:32px; height:32px; border-radius:8px; background:linear-gradient(135deg, var(--greg-1), var(--greg-2)); border:none;
  display:flex; align-items:center; justify-content:center; color:#06141f; cursor:pointer; box-shadow:0 0 16px rgba(63,216,142,.45); transition:box-shadow .2s, transform .12s; }
.greg-send-btn:hover { box-shadow:0 0 24px rgba(63,216,142,.65); transform:translateY(-1px); }
.greg-send-btn:active { transform:scale(.93); }
.greg-send-btn:disabled { opacity:.5; cursor:default; box-shadow:none; transform:none; }
.greg-send-btn svg { width:14px; height:14px; }

.tgt-met-btn { color: var(--green) !important; border-color: rgba(63,216,142,0.4) !important; }
.tgt-met-btn:hover { background: rgba(63,216,142,0.12) !important; border-color: rgba(63,216,142,0.7) !important; }
.tgt-met-btn:disabled { opacity: .55; cursor: default; }

/* ── MY SCAN COUNT (Deploy 73) ──────────────────────────
   Rep-focused stat pill on the Scan a Lead hero. Reps see their own
   count for the active event only; managers see the org-wide total. */
.my-scan-count {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  background: var(--panel2); border: 1px solid rgba(63,216,142,0.35); border-radius: 20px;
  font-family: var(--ff-mono); font-size: 12.5px; color: var(--text-mid); flex: none;
}
.my-scan-count svg { width: 13px; height: 13px; color: var(--green); flex: none; }
.my-scan-count #my-scan-count-num { color: var(--text); font-weight: 700; font-family: var(--ff-disp); }
.my-scan-count-lbl { color: var(--text-muted); }
@media (max-width: 720px) { .my-scan-count-lbl { display: none; } }

/* ── NOTEBOOK+ (Deploy 73) ──────────────────────────────
   Freeform capture drawer, lives only on the Scan a Lead page (a direct
   child of #page-score so it inherits that page's display:none when
   inactive, even though the tab itself is position:fixed). Uses --green
   directly as its identity color, distinct from GREG's emerald->teal
   gradient and the blue --accent, matching the tab in the reference mock. */
.nbplus-tab {
  position: fixed; top: 50%; right: 0; transform: translateY(-50%); z-index: 150;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid rgba(63,216,142,0.45); border-right: none;
  border-radius: 12px 0 0 12px; padding: 16px 9px; cursor: pointer;
  box-shadow: 0 0 18px rgba(63,216,142,0.14), inset 0 1px 0 rgba(255,255,255,0.03);
  transition: box-shadow .2s, padding .2s;
}
.nbplus-tab:hover { box-shadow: 0 0 26px rgba(63,216,142,0.26); padding-right: 13px; }
.nbplus-tab svg { width: 15px; height: 15px; color: var(--green); flex: none; filter: drop-shadow(0 0 4px rgba(63,216,142,.7)); }
.nbplus-tab-label {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--ff-disp); font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--green);
}
body.plan-free .nbplus-tab { display: none; }

.nbplus-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(5,8,12,0.6);
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.nbplus-overlay.open { opacity: 1; pointer-events: auto; }

.nbplus-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(46vw, 620px);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -18px 0 40px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s ease;
}
.nbplus-overlay.open .nbplus-drawer { transform: translateX(0); }

.nbplus-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); flex: none; }
.nbplus-drawer-title { display: flex; align-items: center; gap: 8px; font-family: var(--ff-disp); font-size: 15px; font-weight: 600; color: var(--text); }
.nbplus-drawer-title svg { width: 16px; height: 16px; color: var(--green); }
.nbplus-drawer-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-family: var(--ff-body); }
.nbplus-close { color: var(--text-muted); cursor: pointer; background: none; border: none; width: 18px; height: 18px; padding: 0; flex: none; }
.nbplus-close:hover { color: var(--text-mid); }
.nbplus-close svg { width: 18px; height: 18px; }

.nbplus-save-status { font-size: 10.5px; color: var(--text-muted); font-family: var(--ff-mono); padding: 8px 20px 0; flex: none; }
.nbplus-save-status.saving { color: var(--accent); }
.nbplus-save-status.saved { color: var(--green); }

.nbplus-textarea-wrap { flex: 1; padding: 12px 20px; overflow: hidden; display: flex; min-height: 0; }
.nbplus-textarea {
  flex: 1; width: 100%; background: transparent; border: none; outline: none; resize: none;
  color: var(--text); font-family: var(--ff-body); font-size: 14.5px; line-height: 1.7;
}
.nbplus-textarea::placeholder { color: var(--text-muted); }

.nbplus-footer { flex: none; padding: 14px 20px 20px; border-top: 1px solid var(--line); }
.nbplus-process-btn {
  width: 100%; padding: 12px; border-radius: 11px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #3FD88E, #1FA8C9); color: #06141f;
  font-family: var(--ff-disp); font-weight: 700; font-size: 14px;
  box-shadow: 0 0 16px rgba(63,216,142,.35); transition: box-shadow .2s, transform .12s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.nbplus-process-btn:hover { box-shadow: 0 0 24px rgba(63,216,142,.5); transform: translateY(-1px); }
.nbplus-process-btn:disabled { opacity: .55; cursor: default; box-shadow: none; transform: none; }
.nbplus-footer-hint { font-size: 10.5px; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* Review modal (after Process Notes) — reuses the app's existing .modal-overlay/.modal-box shell */
#nbplus-review-modal .modal-box { max-width: 560px; max-height: 84vh; overflow-y: auto; text-align: left; padding: 22px; }
.nbplus-review-head { margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.nbplus-review-head h3 { font-family: var(--ff-disp); font-size: 16px; color: var(--text); margin: 0 0 4px; }
.nbplus-review-head p { font-size: 12px; color: var(--text-muted); margin: 0; }

.nbplus-lead-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.nbplus-lead-card.nbplus-added { opacity: .55; }
.nbplus-lead-card.nbplus-discarded { display: none; }
.nbplus-lead-row { display: flex; gap: 8px; margin-bottom: 8px; }
.nbplus-lead-row input {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px; font-family: var(--ff-body);
}
/* Same global input[type="text"]:focus white-background bug as the
   template form above - these had no :focus rule at all, so on focus
   they fell straight through to the unscoped global default. */
.nbplus-lead-row input:focus { background: var(--panel) !important; color: var(--text) !important; border-color: var(--accent); box-shadow: none !important; }
.nbplus-lead-row input:-webkit-autofill,
.nbplus-lead-row input:-webkit-autofill:hover,
.nbplus-lead-row input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--panel) inset;
  box-shadow: 0 0 0px 1000px var(--panel) inset;
}
.nbplus-lead-notes { width: 100%; box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text-mid); font-size: 12.5px; font-family: var(--ff-body); margin-bottom: 8px; resize: vertical; min-height: 46px; }
.nbplus-pitch-line { font-size: 11px; color: var(--text-muted); font-family: var(--ff-mono); margin-bottom: 8px; }
.nbplus-dupe-flag { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--amber); background: rgba(244,181,60,0.12); border: 1px solid rgba(244,181,60,0.4); border-radius: 9px; padding: 6px 10px; margin-bottom: 10px; }
.nbplus-dupe-flag input { margin: 0; }
.nbplus-lead-actions { display: flex; gap: 8px; justify-content: flex-end; }
.nbplus-lead-btn { padding: 6px 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text-mid); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--ff-disp); }
.nbplus-lead-btn.nbplus-add { border-color: rgba(63,216,142,0.5); color: var(--green); }
.nbplus-lead-btn.nbplus-add:hover { box-shadow: 0 0 12px rgba(63,216,142,.25); }
.nbplus-lead-btn.nbplus-discard:hover { border-color: rgba(242,98,126,0.5); color: #F2627E; }

.nbplus-general-block { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 6px; }
.nbplus-general-block h4 { font-family: var(--ff-disp); font-size: 13px; color: var(--text); margin: 0 0 8px; }
.nbplus-general-text { font-size: 13px; color: var(--text-mid); line-height: 1.6; white-space: pre-wrap; margin-bottom: 10px; }
.nbplus-general-actions { display: flex; gap: 8px; }
.nbplus-empty-state { font-size: 12.5px; color: var(--text-muted); text-align: center; padding: 20px 0; }

/* N+ tier — a distinct violet, deliberately separate from the hot/warm/cool
   A/B/C spectrum so it reads as "needs scoring", not a 4th quality rank. */
.tier-badge.tier-n, .ll-tier.N { background: rgba(167,139,250,0.13) !important; color: #A78BFA !important; border: 1px solid rgba(167,139,250,0.5); }
.ll-scard.nplus .ll-big { color: #A78BFA; }

@media (max-width: 720px) {
  .nbplus-drawer { width: 100vw; }
  .nbplus-tab { padding: 13px 7px; }
  #nbplus-review-modal .modal-box { max-width: 94vw; }

  /* GREG used to wrap down onto the same line as the scan counter, landing
     well below the EventCon title. Pull it out of the wrapping flow and
     pin it top-right so it's visually parallel with the title instead. */
  .score-event-row {
    position: relative;
    justify-content: center;
    text-align: center;
  }
  .score-event-row .greg-entry-btn {
    position: static;
    margin: 10px auto 0;
  }
  .score-event-row .score-event {
    width: 100%;
    padding-right: 0;
    text-align: center;
  }
}

/* ── FREE TIER GATING ──────────────────────────────────
   Driven by body.plan-free, toggled in applyPlanGating() from the
   admin-only app_metadata.plan claim. Hides paid-only actions without
   touching the underlying render functions (Edit Score stays visible —
   scoring itself is never gated). */
body.plan-free #page-log .ll-abtn.draft,
body.plan-free #page-log .ll-abtn.cal {
  display: none !important;
}
body.plan-free #log-export-menu button[onclick*="exportSalesforceCSV"],
body.plan-free #log-export-menu button[onclick*="exportHubSpotCSV"],
body.plan-free #log-export-menu button[onclick*="exportPipedriveCSV"] {
  display: none !important;
}
body.plan-free #log-export-menu button[onclick*="exportCSV()"] {
  border-bottom: none !important;
}
