/**
 * PEO Tools Portal — Broker Frontend
 * Design system lifted & adapted from the PEOTools conversion/landing page.
 * Warm paper aesthetic, Merriweather display, Inter body, JetBrains Mono UI.
 * Colors, spacing, and component language matched for brand consistency.
 */

:root {
  /* Paper & Ink (from conversion page) */
  --paper:        #f4efe6;
  --paper-deep:   #ece5d4;
  --paper-warm:   #ebe3d1;
  --ink:          #0e0d0b;
  --ink-soft:     #25221d;
  --ink-mute:     #5a544a;
  --rule:         #cdc4b0;
  --rule-soft:    #ddd5bf;

  /* Accent */
  --accent:       #b8551f;
  --accent-deep:  #8a3e15;
  --accent-soft:  #d4793e;

  /* Semantic */
  --emerald:      #1f5d3a;
  --crimson:      #8a2c1f;

  /* Typography (match landing exactly) */
  --display: 'Merriweather', Georgia, serif;
  --body:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Portal specific extensions */
  --sidebar-bg: #0f172a; /* close to ink, kept for nav contrast */
  --sidebar-text: #e2e8f0;
  --card-bg: #fff;
  --success: var(--emerald);
  --error: var(--crimson);
}

/* Base */
html, body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: 28px; margin: 0 0 24px; }
h2 { font-size: 20px; margin: 0 0 16px; font-weight: 700; }
h3 { font-size: 17px; }

label, .ptp-muted, .ptp-badge, code, .ptp-snippet {
  font-family: var(--mono);
}

.ptp-muted { color: var(--ink-mute); font-size: 13px; }

/* Portal Layout */
.ptp-portal {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
}

.ptp-portal__nav {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.ptp-portal__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 24px 24px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ptp-portal__brand .dashicons {
  font-size: 26px;
  width: 26px;
  height: 26px;
  color: var(--accent-soft);
}

.ptp-portal__nav nav {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex: 1;
}

.ptp-portal__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(226, 232, 240, 0.75);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 120ms ease;
}

.ptp-portal__link:hover {
  background: rgba(255,255,255,0.04);
  color: #fff;
}

.ptp-portal__link--active {
  background: rgba(184, 85, 31, 0.15);
  color: #fff;
  border-left-color: var(--accent);
}

.ptp-portal__link .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.ptp-portal__user {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 14px;
  color: rgba(226, 232, 240, 0.85);
}

.ptp-portal__user a {
  color: var(--accent-soft);
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
  margin-top: 6px;
}

.ptp-portal__main {
  padding: 48px 56px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Notices */
.ptp-notice {
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 28px;
  font-size: 14.5px;
  border-left: 4px solid;
}

.ptp-notice--info  { background: #f0e9d8; border-color: var(--accent); color: var(--ink-soft); }
.ptp-notice--ok    { background: #e6f0e6; border-color: var(--emerald); color: #1f3a2a; }
.ptp-notice--warn  { background: #f8f0e0; border-color: #b36b2e; color: #5c3a1f; }
.ptp-notice--err   { background: #f8e8e4; border-color: var(--crimson); color: #5c2a22; }

/* Stats / Cards */
.ptp-grid {
  display: grid;
  gap: 20px;
}

.ptp-grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.ptp-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.ptp-grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

@media (max-width: 1100px) {
  .ptp-grid--2, .ptp-grid--3, .ptp-grid--4 { grid-template-columns: 1fr; }
}

.ptp-stat {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  padding: 24px 28px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(14,13,11,0.04);
}

.ptp-stat__num {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}

.ptp-stat__lbl {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 10px;
}

/* Cards */
.ptp-card-light {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 24px;
}

.ptp-card-light h2 {
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--ink);
}

/* Forms & Inputs (match landing page exactly) */
.ptp-portal__main label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.ptp-portal__main input[type="text"],
.ptp-portal__main input[type="email"],
.ptp-portal__main input[type="url"],
.ptp-portal__main input[type="number"],
.ptp-portal__main input[type="color"],
.ptp-portal__main textarea,
.ptp-portal__main select {
  width: 100%;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: 13px 15px;
  border-radius: 4px;
  outline: none;
  transition: border-color 120ms, background 120ms;
}

.ptp-portal__main input:focus,
.ptp-portal__main textarea:focus,
.ptp-portal__main select:focus {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(184, 85, 31, 0.08);
}

.ptp-portal__main textarea { min-height: 110px; font-family: var(--body); resize: vertical; }

/* Buttons — cta-pill style from landing */
.ptp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: all 140ms ease;
  letter-spacing: -0.005em;
}

.ptp-btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
}

.ptp-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.ptp-btn--primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.ptp-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}

.ptp-btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Tables (inspired by compare table in landing) */
.ptp-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 8px 8px 0 var(--ink);
}

.ptp-table th,
.ptp-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 14px;
  vertical-align: top;
}

.ptp-table th {
  background: var(--paper-deep);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

.ptp-table tr:last-child td { border-bottom: none; }

.ptp-table tr:hover td { background: #faf8f3; }

/* Badges */
.ptp-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ptp-badge--starter    { background: #dbeafe; color: #1e40af; }
.ptp-badge--pro        { background: #dcfce7; color: #166534; }
.ptp-badge--enterprise,
.ptp-badge--aggressive { background: #fef3c7; color: #854d0e; }

/* Snippet / Code blocks (payload-window style) */
.ptp-snippet {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--ink);
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: 6px;
  border: 1px solid var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Status */
.ptp-status { font-size: 13px; font-family: var(--mono); }
.ptp-status.ok  { color: var(--emerald); }
.ptp-status.err { color: var(--crimson); }

/* Actions row */
.ptp-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Tenant form specific */
#ptp-tenant-form .ptp-grid {
  gap: 22px;
}

/* Leads table tweaks */
.ptp-table td code {
  background: var(--paper-deep);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* Preview iframe */
.ptp-iframe-wrap {
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 12px 12px 0 var(--ink);
}

.ptp-iframe-wrap iframe {
  width: 100%;
  height: 820px;
  border: 0;
  display: block;
}

/* Webhook form */
#ptp-webhook-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

#ptp-webhook-form input {
  flex: 1;
  max-width: 520px;
}

/* Login page (standalone) */
.ptp-portal-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 40px 20px;
}

.ptp-auth-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 48px 44px;
  max-width: 420px;
  width: 100%;
  box-shadow: 16px 16px 0 var(--ink);
}

.ptp-auth-card h1 {
  font-family: var(--display);
  font-size: 26px;
  margin: 0 0 8px;
  letter-spacing: -0.025em;
}

.ptp-auth-card p { color: var(--ink-soft); }

/* Responsive */
@media (max-width: 900px) {
  .ptp-portal { grid-template-columns: 1fr; }
  .ptp-portal__nav { display: none; }
  .ptp-portal__main { padding: 32px 20px; }
}

/* Subtle reveal for lists/cards if needed */
.ptp-portal__main > * {
  animation: fadeInUp 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Embed snippet highlight in integrations */
.ptp-card-light .ptp-snippet {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

/* Tenant pause toggle (Calculator status card) */
.ptp-toggle-form .ptp-actions { margin-top: 18px; }

.ptp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  color: var(--ink);
}
.ptp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ptp-toggle__track {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: var(--rule);
  border-radius: 999px;
  transition: background 180ms ease;
  flex-shrink: 0;
}
.ptp-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(14, 13, 11, 0.18);
  transition: transform 180ms ease;
}
.ptp-toggle input:checked + .ptp-toggle__track { background: var(--emerald); }
.ptp-toggle input:checked + .ptp-toggle__track .ptp-toggle__thumb { transform: translateX(20px); }
.ptp-toggle input:focus-visible + .ptp-toggle__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ptp-toggle__label { font-weight: 500; }
/* ============================================================
   STAGE 1 ADDITIONS - class names introduced in the rewritten
   shell.php and login.php. Appended to end of ptp-portal.css.
   Existing rules are NOT touched.
   ============================================================ */

/* ---------- Brand mark (sidebar + auth) ---------- */
.ptp-portal__brand-mark,
.ptp-auth__brand-mark {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ptp-portal__brand-mark span,
.ptp-auth__brand-mark span {
  color: var(--paper);
  font-family: var(--display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -1px;
}

/* ---------- Sidebar nav icons (SVG instead of dashicons) ---------- */
.ptp-portal__link svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.ptp-portal__link:hover svg,
.ptp-portal__link--active svg {
  opacity: 1;
}

/* ---------- User card refinements ---------- */
.ptp-portal__user-name { font-weight: 600; font-size: 14px; }
.ptp-portal__user-tier {
  font-family: var(--mono);
  color: rgba(226, 232, 240, 0.55);
  font-size: 11.5px;
  margin-top: 3px;
}
.ptp-portal__signout {
  margin-top: 10px;
  display: inline-block;
  color: var(--accent-soft);
  font-size: 13px;
  text-decoration: none;
}
.ptp-portal__signout:hover { color: var(--accent); }

/* ---------- Auth page (overrides old ptp-portal-auth) ---------- */
.ptp-login-body {
  margin: 0;
  background: var(--paper);
  min-height: 100vh;
  font-family: var(--body);
}
.ptp-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ptp-auth__card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 12px 40px -12px rgba(14,13,11,0.12);
}
.ptp-auth__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.ptp-auth__brand-name {
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.ptp-auth__title {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.ptp-auth__sub {
  color: var(--ink-mute);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}
.ptp-auth__form { display: flex; flex-direction: column; }
.ptp-auth__label {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.ptp-auth__input {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--body);
  background: #fdfbf6;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.ptp-auth__input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(184, 85, 31, 0.12);
}
.ptp-auth__btn {
  margin-top: 16px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--body);
  cursor: pointer;
  transition: background .15s, transform .05s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ptp-auth__btn:hover { background: var(--ink-soft); }
.ptp-auth__btn:active { transform: translateY(1px); }
.ptp-auth__btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.ptp-auth__msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.ptp-auth__msg--ok  { background: #e6f0e6; border-color: var(--emerald); color: #1f3a2a; }
.ptp-auth__msg--err { background: #f8e8e4; border-color: var(--crimson); color: #5c2a22; }
.ptp-auth__footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
}
.ptp-auth__footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.ptp-auth__footer a:hover { text-decoration: underline; }
/* ============================================================
   STAGE 2 ADDITIONS - dashboard cards, sent-state, link inlines.
   Appended to ptp-portal.css.
   ============================================================ */

/* Dashboard layout */
.ptp-dash__header {
  margin-bottom: 8px;
}
.ptp-dash__h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.ptp-dash__sub {
  color: var(--ink-mute);
  font-size: 14.5px;
  margin: 0;
}

.ptp-card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 24px;
}
.ptp-card__h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.ptp-defs {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  row-gap: 10px;
  column-gap: 18px;
  align-items: baseline;
}
.ptp-defs dt {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.ptp-defs dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
}

.ptp-link-inline {
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
}
.ptp-link-inline:hover {
  text-decoration: underline;
}

.ptp-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ptp-checklist li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.ptp-checklist li:last-child {
  border-bottom: 0;
}
.ptp-checklist li a {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: block;
  font-size: 14.5px;
}
.ptp-checklist li a:hover {
  color: var(--accent);
}
.ptp-checklist li p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
}

/* Sent state on /login/?sent_for=email */
.ptp-auth__sent {
  text-align: left;
}
.ptp-auth__hint {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 12px 0 16px;
  line-height: 1.5;
}
.ptp-auth__link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
}
.ptp-auth__link:hover {
  text-decoration: underline;
}
/* ============================================================
   STAGE 3 ADDITIONS - config page, 4-stat grid, pause toggle.
   Appended to ptp-portal.css.
   ============================================================ */

/* 4-up grid for dashboard */
.ptp-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .ptp-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* /config/ page layout */
.ptp-config__section {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 24px 24px 18px;
  margin-top: 24px;
}
.ptp-config__section--locked {
  opacity: 0.92;
  position: relative;
}
.ptp-config__section--locked .ptp-input,
.ptp-config__section--locked .ptp-input--select,
.ptp-config__section--locked .ptp-input--textarea {
  background: #f4efe6;
  color: #5a544a;
  cursor: not-allowed;
}

.ptp-config__section-head { margin-bottom: 14px; }
.ptp-config__section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.ptp-config__section-blurb {
  margin: 0;
  color: var(--ink-mute);
  font-size: 13.5px;
  line-height: 1.5;
}

.ptp-config__fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 24px;
  margin-top: 18px;
}
.ptp-config__fields--plans {
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 900px) {
  .ptp-config__fields, .ptp-config__fields--plans { grid-template-columns: 1fr; }
}

.ptp-plan-card {
  background: #fcfaf4;
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 16px;
}
.ptp-plan-card__h3 {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin: 0 0 12px;
  font-weight: 600;
}
.ptp-plan-card .ptp-field {
  margin-bottom: 12px;
}
.ptp-plan-card .ptp-field:last-child {
  margin-bottom: 0;
}

/* Field renderer */
.ptp-field { display: flex; flex-direction: column; }
.ptp-field__label {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  margin-bottom: 5px;
}
.ptp-field__control {
  position: relative;
  display: flex;
  align-items: center;
}
.ptp-field__control--affix,
.ptp-field__control--affix-right {
  position: relative;
  display: flex;
  align-items: center;
}
.ptp-field__prefix,
.ptp-field__suffix {
  position: absolute;
  font-family: var(--mono);
  color: var(--ink-mute);
  font-size: 14px;
  pointer-events: none;
}
.ptp-field__prefix { left: 12px; }
.ptp-field__suffix { right: 12px; }
.ptp-field__control--affix .ptp-input { padding-left: 26px; }
.ptp-field__control--affix-right .ptp-input { padding-right: 24px; }

.ptp-input {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: var(--body);
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.ptp-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 85, 31, 0.12);
}
.ptp-input--textarea { min-height: 72px; resize: vertical; font-family: var(--body); line-height: 1.5; }
.ptp-input--select   { background: #fff; appearance: auto; cursor: pointer; }

.ptp-field__help {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 4px 0 0;
  line-height: 1.45;
}
.ptp-field__status {
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 4px;
  min-height: 14px;
  letter-spacing: 0.04em;
}
.ptp-field__status--saving { color: var(--ink-mute); }
.ptp-field__status--ok     { color: var(--emerald, #1f5d3a); }
.ptp-field__status--err    { color: var(--crimson, #8a2c1f); }
.ptp-field--dirty .ptp-input {
  border-color: var(--accent);
}
.ptp-field--saving .ptp-input {
  border-color: var(--ink-mute);
}

/* Section footer */
.ptp-config__section-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
}
.ptp-config__section-msg {
  font-size: 13px;
  color: var(--ink-mute);
  font-family: var(--mono);
}

.ptp-btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--body);
  cursor: pointer;
  transition: opacity .15s, background .15s;
}
.ptp-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.ptp-btn--primary { background: var(--ink); color: var(--paper); }
.ptp-btn--primary:hover:not([disabled]) { background: var(--ink-soft, #25221d); }
.ptp-btn--accent  { background: var(--accent); color: #fff; text-decoration: none; display: inline-block; }

/* Upgrade CTA */
.ptp-upgrade-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fdf5e9;
  border: 1px solid #e6d5a7;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.ptp-upgrade-cta__text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ptp-upgrade-cta__text strong { font-size: 13.5px; color: var(--ink); }
.ptp-upgrade-cta__text span   { color: var(--ink-mute); }

/* Pause toggle */
.ptp-pause {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 24px;
}
.ptp-pause__title {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.ptp-pause__state { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ptp-pause__dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ptp-pause__dot--on  { background: #1f5d3a; box-shadow: 0 0 0 3px rgba(31, 93, 58, 0.15); }
.ptp-pause__dot--off { background: #8a2c1f; box-shadow: 0 0 0 3px rgba(138, 44, 31, 0.15); }

.ptp-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.ptp-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ptp-switch__track {
  width: 44px;
  height: 24px;
  background: #c8c0ad;
  border-radius: 12px;
  position: relative;
  transition: background .2s;
}
.ptp-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.ptp-switch input:checked + .ptp-switch__track {
  background: #1f5d3a;
}
.ptp-switch input:checked + .ptp-switch__track::after {
  transform: translateX(20px);
}
.ptp-switch__label {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  min-width: 48px;
}

/* ============================================================
   BILLING — ptp-billing v0.7
   Scope: .ptp-billing and children only.
   Design system: paper (#f4efe6), ink (#0e0d0b), copper (#b8551f),
   green (#1f5d3a), border (#cdc4b0)
============================================================ */

.ptp-billing { display:flex; flex-direction:column; gap:40px; padding-bottom:60px; }

/* Header row: plan card + payment method card */
.ptp-billing__header { display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
@media(max-width:680px){ .ptp-billing__header { grid-template-columns:1fr; } }

.ptp-billing__plan-card,
.ptp-billing__pm-card {
  background:#fff;
  border:1px solid #cdc4b0;
  padding:28px 32px;
  box-shadow:4px 4px 0 #0e0d0b;
}

.ptp-billing__plan-card-inner { display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; }

.ptp-billing__plan-label { font-size:11px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:#5a544a; margin-bottom:6px; }
.ptp-billing__plan-name  { font-size:1.6rem; font-weight:700; color:#0e0d0b; line-height:1.1; }
.ptp-billing__plan-meta  { display:flex; align-items:center; gap:10px; margin-top:8px; flex-wrap:wrap; }
.ptp-billing__plan-renewal { font-size:13px; color:#5a544a; }
.ptp-billing__upgrade-cta  { white-space:nowrap; }

/* Payment method card */
.ptp-billing__pm-display { display:flex; align-items:center; gap:10px; margin:10px 0 12px; font-size:15px; color:#0e0d0b; font-variant-numeric:tabular-nums; }
.ptp-billing__pm-update  { font-size:13px; color:#b8551f; text-decoration:underline; cursor:pointer; }
.ptp-billing__pm-update:hover { color:#0e0d0b; }

/* Badge colours */
.ptp-badge--green   { background:#d1fae5; color:#065f46; }
.ptp-badge--yellow  { background:#fef3c7; color:#92400e; }
.ptp-badge--red     { background:#fee2e2; color:#991b1b; }
.ptp-badge--neutral { background:#e8e3d9; color:#5a544a; }

/* Section titles */
.ptp-billing__section-title { font-size:1.15rem; font-weight:700; color:#0e0d0b; margin:0 0 20px; }

/* Period toggle */
.ptp-billing__plans-header  { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:24px; }
.ptp-billing__toggle        { display:flex; background:#e8e3d9; border-radius:6px; padding:3px; gap:2px; }
.ptp-billing__toggle-btn    { background:transparent; border:none; padding:6px 16px; border-radius:4px; font-size:13px; font-weight:500; color:#5a544a; cursor:pointer; transition:background 0.15s,color 0.15s; }
.ptp-billing__toggle-btn--active { background:#fff; color:#0e0d0b; box-shadow:0 1px 3px rgba(14,13,11,0.12); }
.ptp-billing__save-badge    { background:#1f5d3a; color:#fff; font-size:11px; padding:1px 6px; border-radius:3px; margin-left:4px; vertical-align:middle; }

/* Plan grid */
.ptp-billing__plan-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
@media(max-width:1024px){ .ptp-billing__plan-grid { grid-template-columns:repeat(2,1fr); } }
@media(max-width:560px) { .ptp-billing__plan-grid { grid-template-columns:1fr; } }

.ptp-billing__plan-item {
  position:relative;
  background:#fff;
  border:1px solid #cdc4b0;
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:0;
}
.ptp-billing__plan-item--highlight {
  border-color:#0e0d0b;
  box-shadow:4px 4px 0 #0e0d0b;
}
.ptp-billing__plan-item--current {
  background:#f9f7f4;
  border-style:dashed;
}

.ptp-billing__plan-popular {
  position:absolute; top:-12px; left:50%; transform:translateX(-50%);
  background:#0e0d0b; color:#f4efe6;
  font-size:10px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase;
  padding:3px 10px; border-radius:3px; white-space:nowrap;
}

.ptp-billing__plan-item-label { font-size:1rem; font-weight:700; color:#0e0d0b; margin-bottom:6px; }
.ptp-billing__plan-item-desc  { font-size:12px; color:#5a544a; line-height:1.5; margin-bottom:16px; }

.ptp-billing__plan-price { margin-bottom:16px; }
.ptp-billing__plan-price span { font-size:1.8rem; font-weight:800; color:#0e0d0b; }
.ptp-billing__price-period { font-size:0.9rem; font-weight:400; color:#5a544a; }

.ptp-billing__feature-list {
  list-style:none; margin:0 0 20px; padding:0;
  flex:1;
  display:flex; flex-direction:column; gap:7px;
}
.ptp-billing__feature-list li { font-size:13px; color:#25221d; padding-left:18px; position:relative; }
.ptp-billing__feature-list li::before { content:'✓'; position:absolute; left:0; color:#1f5d3a; font-weight:700; }

.ptp-billing__plan-select { width:100%; justify-content:center; }

.ptp-billing__plan-current-badge {
  text-align:center; font-size:12px; font-weight:600;
  color:#1f5d3a; background:#d1fae5;
  padding:8px; border-radius:4px;
}
.ptp-billing__plan-current-badge--muted { color:#5a544a; background:#e8e3d9; }

/* Payment history table */
.ptp-billing__history-table th,
.ptp-billing__history-table td { padding:10px 14px; }
.ptp-billing__invoice-id { font-variant-numeric:tabular-nums; font-weight:600; color:#0e0d0b; }
.ptp-billing__amount     { font-variant-numeric:tabular-nums; font-weight:500; }
.ptp-billing__receipt-link { font-size:13px; color:#b8551f; text-decoration:none; font-weight:500; white-space:nowrap; }
.ptp-billing__receipt-link:hover { text-decoration:underline; }

/* Spinner overlay */
.ptp-billing__spinner {
  display:none;
  position:fixed; inset:0;
  background:rgba(244,239,230,0.85);
  z-index:9999;
  align-items:center; justify-content:center;
}
.ptp-billing__spinner[aria-hidden="false"] { display:flex; }
.ptp-billing__spinner-inner { display:flex; flex-direction:column; align-items:center; gap:14px; }
.ptp-billing__spinner-inner svg { animation:ptp-spin 0.8s linear infinite; }
.ptp-billing__spinner-inner span { font-size:14px; color:#0e0d0b; font-weight:500; }
@keyframes ptp-spin { to { transform:rotate(360deg); } }

/* ============================================================
   STAGE 4 ADDITIONS — Sticky sidebar + sub-nav under Leads
   ============================================================ */

/* Sticky sidebar — nav stays fixed while main content scrolls */
.ptp-portal {
  align-items: start; /* grid: let nav be its own height, not stretch */
}
.ptp-portal__nav {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
.ptp-portal__nav::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* Sub-nav container — hidden by default, shown when parent is active */
.ptp-portal__subnav {
  display: none;
  flex-direction: column;
}
.ptp-portal__subnav--open {
  display: flex;
}

/* Child link indentation */
.ptp-portal__link--child {
  padding-left: 44px;
  font-size: 13.5px;
  color: rgba(226, 232, 240, 0.6);
}
.ptp-portal__link--child:hover {
  color: #fff;
  background: rgba(255,255,255,0.03);
}
.ptp-portal__link--child.ptp-portal__link--active {
  color: #fff;
  background: rgba(184, 85, 31, 0.12);
  border-left-color: var(--accent);
}

/* Dot bullet replacing SVG icon for child links */
.ptp-portal__link-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.6;
}
.ptp-portal__link--active .ptp-portal__link-dot {
  opacity: 1;
  background: var(--accent-soft);
}



/* ── Analytics page v4 ─────────────────────────────────────────────── */

.ptp-an { max-width: 900px; }

/* Header */
.ptp-an__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.ptp-an__title {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 900;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: -.025em;
}
.ptp-an__status {
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0;
  line-height: 1.5;
}
.ptp-an__period {
  font-size: 12px;
  color: var(--ink-mute);
  white-space: nowrap;
  padding-top: 6px;
  letter-spacing: .02em;
}

/* KPI strip */
.ptp-an-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 700px) { .ptp-an-kpis { grid-template-columns: repeat(2, 1fr); } }

.ptp-an-kpi {
  background: var(--card-bg);
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 22px 24px 20px;
  box-shadow: 0 1px 3px rgba(14,13,11,.04);
  position: relative;
  overflow: hidden;
}
.ptp-an-kpi--hero {
  border-color: #b8551f55;
  background: linear-gradient(135deg, #fff 60%, #b8551f09);
  box-shadow: 0 2px 12px rgba(184,85,31,.10);
}
.ptp-an-kpi__num {
  font-family: var(--display);
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--ink);
}
.ptp-an-kpi--hero .ptp-an-kpi__num { color: #b8551f; }
.ptp-an-kpi__lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 8px;
}
.ptp-an-kpi__badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #b8551f;
  background: #b8551f15;
  border-radius: 20px;
  padding: 2px 10px;
  letter-spacing: .02em;
}

/* Tabs */
.ptp-an-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--rule-soft);
  margin-bottom: 20px;
}
.ptp-an-tab {
  background: none;
  border: none;
  padding: 10px 20px 12px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  position: relative;
  bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  letter-spacing: .01em;
}
.ptp-an-tab:hover { color: var(--ink); }
.ptp-an-tab--active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Chart cards */
.ptp-an-view--hidden { display: none; }
.ptp-an-card {
  background: var(--card-bg);
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  padding: 32px 36px 28px;
  box-shadow: 0 2px 8px rgba(14,13,11,.06);
}
.ptp-an-card__head {
  margin-bottom: 28px;
}
.ptp-an-card__title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 5px;
  letter-spacing: -.015em;
}
.ptp-an-card__sub {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
}

/* Chart containers - explicit heights prevent Canvas resize loop */
.ptp-an-funnel-wrap {
  position: relative;
  height: 380px;
  width: 100%;
}
.ptp-an-bar-wrap {
  position: relative;
  height: 300px;
  width: 100%;
}

/* -- Dashboard KPI strip ------------------------------------------- */
.ptp-db-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  gap: 14px;
  margin-top: 24px;
}
@media (max-width: 760px) {
  .ptp-db-kpis { grid-template-columns: 1fr 1fr; }
}
.ptp-db-kpi {
  background: var(--card-bg);
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 22px 24px 20px;
  box-shadow: 0 1px 3px rgba(14,13,11,.04);
}
.ptp-db-kpi--hero {
  border-color: #b8551f55;
  background: linear-gradient(135deg, #fff 60%, #b8551f09);
  box-shadow: 0 2px 12px rgba(184,85,31,.10);
}
.ptp-db-kpi--chart {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
}
.ptp-db-kpi__num {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--ink);
}
.ptp-db-kpi--hero .ptp-db-kpi__num { color: #b8551f; }
.ptp-db-kpi__lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 8px;
}
.ptp-db-kpi__delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: .01em;
}
.ptp-db-kpi__delta--up   { color: #1f5d3a; }
.ptp-db-kpi__delta--down { color: #8a2c1f; }
.ptp-db-minichart {
  flex: 1;
  margin-top: 10px;
  position: relative;
  min-height: 70px;
  max-height: 90px;
}
.ptp-db-minichart canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* -- Dashboard additions v2 ----------------------------------------- */
.ptp-db-kpi__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: .01em;
}
.ptp-db-kpi__link:hover { text-decoration: underline; }
.ptp-db-kpi__context {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 5px;
}
.ptp-db-kpi__nudge {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 8px;
  font-style: italic;
}
.ptp-db-kpi__disclaimer {
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 6px;
  line-height: 1.4;
}
.ptp-db-kpi__num--muted { color: var(--rule) !important; }
.ptp-db-kpi__num--green { color: #1f5d3a !important; }
.ptp-db-kpi--pipeline {
  border-color: #1f5d3a33;
  background: linear-gradient(135deg, #fff 60%, #1f5d3a08);
}

/* ROI config section */
.ptp-roi-section { margin-top: 24px; }
.ptp-roi-field {
  margin-bottom: 20px;
}
.ptp-roi-field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.ptp-roi-field__unit {
  font-weight: 400;
  color: var(--ink-mute);
}
.ptp-roi-field__help {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0 0 8px;
  line-height: 1.5;
}
.ptp-roi-input {
  width: 200px;
  max-width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--body);
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s;
}
.ptp-roi-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

/* -- ROI explainer block -------------------------------------------- */
.ptp-roi-explainer {
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ptp-roi-explainer__heading {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -.01em;
}
.ptp-roi-explainer__how p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 8px;
}
.ptp-roi-explainer__how p:last-child { margin-bottom: 0; }
.ptp-roi-explainer__calc {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ptp-roi-explainer__formula {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: 7px;
  border-left: 3px solid var(--accent);
}
.ptp-roi-explainer__formula-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.ptp-roi-explainer__formula-eq {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--mono);
}
.ptp-roi-explainer__formula-note {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.5;
  margin-top: 2px;
}
.ptp-roi-explainer__privacy {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid var(--rule-soft);
}

/* -- ROI config v2 -------------------------------------------------- */
.ptp-roi-help-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  vertical-align: middle;
  font-family: var(--body);
  letter-spacing: 0;
}
.ptp-roi-help-link:hover { text-decoration: underline; }
.ptp-roi-help-link svg { flex-shrink: 0; }

.ptp-roi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: end;
}
@media (max-width: 600px) {
  .ptp-roi-row { grid-template-columns: 1fr; }
}
.ptp-roi-row .ptp-roi-field { margin-bottom: 0; }
.ptp-roi-row .ptp-roi-input { width: 100%; }

/* -- Help article styles -------------------------------------------- */
.ptp-help-article {
  max-width: 680px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.ptp-help-section h2 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
  letter-spacing: -.015em;
}
.ptp-help-section p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 10px;
}
.ptp-help-section p:last-child { margin-bottom: 0; }
.ptp-help-formula {
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
}
.ptp-help-formula__name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.ptp-help-formula__eq {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.ptp-help-cta {
  padding-top: 8px;
  border-top: 1px solid var(--rule-soft);
}

/* =====================================================================
 * Analytics v5 additions — appended to ptp-portal.css
 * Funnel rows, leak callout, CTA grid, KPI badge variants.
 * Uses existing tokens: --paper --ink --ink-mute --accent --emerald.
 * Appended by install.sh on 2026-05-27. Safe to remove this whole block
 * (from this banner to the matching END banner) to roll back styling.
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * Dark chart wells — the charts sit in deep charcoal cards on the light
 * page so ApexCharts' translucent gradient fills glow like glass.
 * TUNE THESE TWO VARIABLES to taste after seeing it live:
 *   --ptp-well-bg    : the dark well color (warm near-black by default)
 *   --ptp-well-glow  : 0 = no glow, 1 = full. Lower for calmer, daily-use feel.
 * ------------------------------------------------------------------- */
:root {
  --ptp-well-bg:   #16140f;
  --ptp-well-edge: #2a2620;
  --ptp-well-glow: 0.7;
  --ptp-lit-coral:   #e07a3e;
  --ptp-lit-emerald: #3fa86a;
  --ptp-lit-blue:    #4a90d9;
}

.ptp-an-well {
  background: var(--ptp-well-bg);
  border: 1px solid var(--ink);
  border-radius: 12px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 20px 22px 14px;
  margin: 18px 0;
}
.ptp-an-well__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ptp-an-well__title {
  font-size: 16px;
  font-weight: 700;
  color: #f6f1e7;
  margin: 0;
}
.ptp-an-well__sub {
  font-size: 12px;
  color: #b8b0a0;
}
.ptp-an-well__link {
  font-size: 12px;
  font-weight: 600;
  color: var(--ptp-lit-coral);
  text-decoration: none;
  white-space: nowrap;
}
.ptp-an-well__link:hover { color: #f0975e; }
.ptp-an-well__canvas { min-height: 300px; }

/* KPI badge soft variant (avg savings / cta labels) */
.ptp-an-kpi__badge--soft {
  background: transparent;
  color: var(--ink-mute);
  font-weight: 500;
}

/* Funnel rows ------------------------------------------------------- */
.ptp-an-funnel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 4px;
}
.ptp-an-frow__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ptp-an-frow__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.ptp-an-frow__val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.ptp-an-frow__pct {
  font-weight: 400;
  color: var(--ink-mute);
}
.ptp-an-frow__track {
  background: var(--paper-deep);
  border-radius: 8px;
  height: 34px;
  overflow: hidden;
}
.ptp-an-frow__bar {
  height: 100%;
  border-radius: 8px;
  background: var(--ink-mute);
  transition: width 700ms cubic-bezier(.22,.61,.36,1);
}
.ptp-an-frow--hero .ptp-an-frow__bar { background: var(--accent); }
.ptp-an-frow--win  .ptp-an-frow__bar { background: var(--emerald); }
.ptp-an-frow__note {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 5px;
}

/* Leak callout ------------------------------------------------------ */
.ptp-an-leak {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f0e9d8;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 20px 0;
}
.ptp-an-leak__icon {
  font-size: 18px;
  line-height: 1.4;
  color: var(--accent-deep);
  flex-shrink: 0;
}
.ptp-an-leak__body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.ptp-an-leak__body strong { color: var(--ink); }

/* CTA breakdown grid ------------------------------------------------ */
.ptp-an-cta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 4px;
}
.ptp-an-cta {
  background: var(--paper-deep);
  border-radius: 8px;
  padding: 18px 16px;
  text-align: center;
}
.ptp-an-cta__num {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ptp-an-cta__lbl {
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 8px;
}

/* Card link (right side of card head) ------------------------------- */
.ptp-an-card__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.ptp-an-card__link:hover { color: var(--accent-deep); }

/* Funnel comparison subpage (this month vs last) -------------------- */
.ptp-an-flegend {
  display: flex;
  gap: 18px;
  margin: 4px 0 18px;
}
.ptp-an-flegend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mute);
}
.ptp-an-flegend__sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.ptp-an-flegend__sw--cur  { background: var(--accent); }
.ptp-an-flegend__sw--prev { background: var(--ink-mute); opacity: .35; }

.ptp-an-funnel--compare .ptp-an-frow__track--prev {
  height: 14px;
  margin-top: 4px;
  background: transparent;
}
.ptp-an-frow__bar--prev {
  background: var(--ink-mute) !important;
  opacity: .3;
}

.ptp-an-delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ptp-an-delta--up   { color: var(--emerald); }
.ptp-an-delta--down { color: var(--accent-deep); }
.ptp-an-delta--flat { color: var(--ink-mute); font-weight: 400; }

@media (max-width: 560px) {
  .ptp-an-cta-grid { grid-template-columns: 1fr; }
}

/* ===================================================================== */
/* END Analytics v5 additions                                            */
/* ===================================================================== */
