    /* ============================================================
       DESIGN TOKENS — Lead Pronto brand
    ============================================================ */
    :root {
      --lp-green:          #002620;
      --lp-teal:           #01BFA5;
      --lp-teal-soft:      rgba(1, 191, 165, 0.10);
      --lp-teal-border:    rgba(1, 191, 165, 0.25);

      --bg:                #001A15;
      --surface:           #002620;
      --surface-2:         #003228;
      --surface-3:         #004035;
      --surface-raised:    #004035;

      --text:              #F0F5F4;
      --text-muted:        rgba(240, 245, 244, 0.52);
      --text-dim:          rgba(240, 245, 244, 0.55);

      --border:            rgba(255, 255, 255, 0.07);
      --border-soft:       rgba(255, 255, 255, 0.04);

      --radius:            12px;
      --radius-sm:         8px;
      --radius-xs:         6px;

      --tracking:          -0.020em;
      --tracking-tight:    -0.025em;

      --font-body:         "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

      --red:               #EF4444;
      --amber:             #F59E0B;

      --space-sm:          12px;
      --space-md:          16px;
      --space-lg:          28px;
      --space-xl:          40px;
    }

    /* ============================================================
       RESET
    ============================================================ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    /* ============================================================
       GRID BACKGROUND
    ============================================================ */
    html, body {
      height: 100%;
      background-color: var(--bg);
      background-image:
        linear-gradient(rgba(1, 191, 165, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(1, 191, 165, 0.055) 1px, transparent 1px);
      background-size: 44px 44px;
      color: var(--text);
      font-family: var(--font-body);
      font-size: 15.5px;
      font-weight: 500;
      line-height: 1.6;
      letter-spacing: var(--tracking);
      -webkit-font-smoothing: antialiased;
    }

    /* Radial glow — top right, like the slide */
    body::before {
      content: '';
      position: fixed;
      top: -180px;
      right: -180px;
      width: 560px;
      height: 560px;
      background: radial-gradient(circle, rgba(1, 191, 165, 0.13) 0%, rgba(1, 191, 165, 0.04) 45%, transparent 70%);
      pointer-events: none;
      z-index: 0;
    }

    /* Subtle second glow — bottom left for depth */
    body::after {
      content: '';
      position: fixed;
      bottom: -100px;
      left: 80px;
      width: 380px;
      height: 380px;
      background: radial-gradient(circle, rgba(1, 191, 165, 0.06) 0%, transparent 65%);
      pointer-events: none;
      z-index: 0;
    }

    button { font-family: inherit; cursor: pointer; }
    textarea { font-family: inherit; }
    a { color: var(--lp-teal); text-decoration: none; }

    /* ============================================================
       APP SHELL — sidebar + main
    ============================================================ */
    .app-shell {
      display: flex;
      height: 100vh;
      overflow: hidden;
      position: relative;
      z-index: 1;
    }

    /* ============================================================
       SIDEBAR
    ============================================================ */
    .sidebar {
      width: 248px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      background: rgba(0, 26, 21, 0.82);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-right: 1px solid var(--border);
      overflow: hidden;
    }

    .sidebar-top {
      padding: 20px 16px 16px;
      border-bottom: 1px solid var(--border);
    }

    .wordmark {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 14px;
    }

    .wordmark img {
      height: 21px;
      width: auto;
    }

    .wordmark-badge {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.10em;
      text-transform: uppercase;
      color: var(--lp-teal);
      background: var(--lp-teal-soft);
      border: 1px solid var(--lp-teal-border);
      padding: 2px 7px;
      border-radius: 20px;
    }

    .new-chat-btn {
      width: 100%;
      background: var(--lp-teal);
      border: none;
      border-radius: var(--radius-sm);
      padding: 10px 16px;
      font-size: 14px;
      font-weight: 600;
      color: var(--lp-green);
      letter-spacing: var(--tracking);
      display: flex;
      align-items: center;
      gap: 7px;
      transition: opacity 0.15s;
    }

    .new-chat-btn svg { flex-shrink: 0; }

    /* Conversation history list */
    .conv-list {
      flex: 1;
      overflow-y: auto;
      padding: 10px 8px 8px;
    }

    .conv-list::-webkit-scrollbar { width: 3px; }
    .conv-list::-webkit-scrollbar-track { background: transparent; }
    .conv-list::-webkit-scrollbar-thumb { background: rgba(1, 191, 165, 0.15); border-radius: 2px; }

    .conv-list-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: var(--text-dim);
      padding: 4px 8px 8px;
      display: block;
    }

    .conv-item {
      position: relative;
      padding: 7px 8px 7px 10px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: background 0.12s;
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 1px;
    }

    .conv-item:hover { background: rgba(255, 255, 255, 0.04); }
    .conv-item.active { background: rgba(1, 191, 165, 0.09); }

    .conv-item-title {
      font-size: 12px;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 1;
      line-height: 1.35;
      letter-spacing: var(--tracking);
    }

    .conv-item.active .conv-item-title { color: var(--text); }

    .conv-item-del {
      display: none;
      background: none;
      border: none;
      color: var(--text-dim);
      cursor: pointer;
      padding: 2px 3px;
      border-radius: 3px;
      font-size: 10px;
      flex-shrink: 0;
      line-height: 1;
      transition: color 0.12s;
    }

    .conv-item:hover .conv-item-del,
    .conv-item:focus-within .conv-item-del { display: block; }
    .conv-item-del:hover { color: var(--red); }

    .conv-empty-hint {
      font-size: 11.5px;
      color: var(--text-dim);
      text-align: center;
      padding: 24px 10px;
      line-height: 1.65;
    }

    /* Sources panel — below AI response bubble */
    .sources-panel {
      max-width: 84%;
      margin-top: 6px;
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      overflow: hidden;
      font-size: 12px;
    }

    .sources-header {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 7px 11px;
      cursor: pointer;
      user-select: none;
      color: var(--lp-teal);
      background: rgba(1, 191, 165, 0.04);
      transition: background 0.12s;
    }

    .sources-header:hover { background: rgba(1, 191, 165, 0.08); }

    .sources-toggle { margin-left: auto; font-size: 9px; opacity: 0.7; }

    .sources-body {
      display: none;
      padding: 9px 11px 11px;
      border-top: 1px solid var(--lp-teal-border);
      background: rgba(1, 191, 165, 0.02);
    }

    .sources-body.open { display: block; }

    .sources-body ul {
      margin: 0;
      padding-left: 16px;
    }

    .sources-body li {
      color: var(--text-muted);
      line-height: 1.65;
      margin-bottom: 4px;
    }

    .sources-body li:last-child { margin-bottom: 0; }
    .sources-body strong { color: var(--lp-teal); font-weight: 600; }
    .sources-body em { color: var(--text-dim); font-style: normal; }

    /* Sidebar footer */
    .sidebar-footer {
      padding: 12px 16px;
      border-top: 1px solid var(--border);
    }

    .sidebar-meta {
      font-size: 11px;
      color: var(--text-dim);
      line-height: 1.7;
    }

    .sidebar-meta span { display: block; }

    .status-dot {
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--lp-teal);
      margin-right: 5px;
      animation: pulse 2.2s ease-in-out infinite;
      vertical-align: middle;
    }

    .status-dot.offline { background: var(--red); animation: none; }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50%       { opacity: 0.35; }
    }

    /* ============================================================
       MAIN CONTENT AREA
    ============================================================ */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      overflow: hidden;
    }

    /* ============================================================
       MESSAGES
    ============================================================ */
    .messages {
      flex: 1;
      overflow-y: auto;
      padding: 24px 0 12px;
      scroll-behavior: smooth;
    }

    .messages::-webkit-scrollbar { width: 4px; }
    .messages::-webkit-scrollbar-track { background: transparent; }
    .messages::-webkit-scrollbar-thumb {
      background: rgba(1, 191, 165, 0.2);
      border-radius: 2px;
    }

    /* Empty state */
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 12px;
      padding: 60px 40px 40px;
      min-height: calc(100% - 40px);
    }

    @keyframes iconBreathe {
      0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(1, 191, 165, 0); }
      50%       { transform: scale(1.06); box-shadow: 0 0 18px 4px rgba(1, 191, 165, 0.15); }
    }
    @keyframes greetingIn {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .empty-icon {
      width: 62px;
      height: 62px;
      background: var(--lp-teal-soft);
      border: 1px solid var(--lp-teal-border);
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      animation: iconBreathe 4s ease-in-out infinite;
    }
    #empty-greeting {
      animation: greetingIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
    }
    #empty-sub-text {
      animation: greetingIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.22s both;
    }

    .empty-title {
      font-size: 30px;
      font-weight: 700;
      letter-spacing: -0.038em;
      color: var(--text);
      line-height: 1.1;
    }

    .empty-sub {
      font-size: 13px;
      color: var(--text-muted);
      max-width: 400px;
      line-height: 1.6;
    }

    .suggestions {
      display: flex;
      flex-direction: column;
      gap: 10px;
      align-items: center;
      max-width: 560px;
      width: 100%;
      margin-top: 20px;
    }

    .chip-group {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      justify-content: center;
    }

    .chip-label {
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      margin-top: 8px;
      color: var(--text-dim);
      width: 100%;
      text-align: center;
    }

    .suggestion {
      background: rgba(1, 191, 165, 0.06);
      border: 1px solid var(--lp-teal-border);
      border-radius: 20px;
      padding: 6px 14px;
      font-size: 12.5px;
      color: var(--text-muted);
      cursor: pointer;
      transition: background 0.13s, border-color 0.13s, color 0.13s, transform 0.13s, opacity 0.13s;
      letter-spacing: var(--tracking);
    }

    .suggestion:hover {
      background: rgba(1, 191, 165, 0.12);
      color: var(--text);
      border-color: rgba(1, 191, 165, 0.45);
      transform: translateY(-1px);
    }

    .suggestion.live {
      background: rgba(1, 191, 165, 0.04);
      border-color: rgba(1, 191, 165, 0.3);
      color: var(--lp-teal);
      opacity: 0.85;
    }

    .suggestion.live::before {
      content: '';
      display: inline-block;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--lp-teal);
      margin-right: 6px;
      vertical-align: middle;
      animation: pulse 2.2s ease-in-out infinite;
    }

    .suggestion.live:hover {
      opacity: 1;
      background: rgba(1, 191, 165, 0.12);
      border-color: rgba(1, 191, 165, 0.55);
      color: var(--lp-teal);
    }

    /* Alert-driven chips — amber pulsing dot, urgent feel */
    .suggestion.alert-chip {
      background: rgba(245, 158, 11, 0.06);
      border-color: rgba(245, 158, 11, 0.35);
      color: var(--amber);
      opacity: 0.9;
    }
    .suggestion.alert-chip::before {
      content: '';
      display: inline-block;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--amber);
      margin-right: 6px;
      vertical-align: middle;
      animation: pulse 1.8s ease-in-out infinite;
    }
    .suggestion.alert-chip:hover {
      opacity: 1;
      background: rgba(245, 158, 11, 0.12);
      border-color: rgba(245, 158, 11, 0.6);
      color: var(--amber);
    }
    .suggestion.alert-chip.red {
      background: rgba(239, 68, 68, 0.06);
      border-color: rgba(239, 68, 68, 0.35);
      color: var(--red);
    }
    .suggestion.alert-chip.red::before { background: var(--red); }
    .suggestion.alert-chip.red:hover {
      background: rgba(239, 68, 68, 0.12);
      border-color: rgba(239, 68, 68, 0.6);
      color: var(--red);
    }

    /* Chat column — centred, constrained width */
    .chat-column {
      max-width: 820px;
      width: 100%;
      margin: 0 auto;
      padding: 0 32px;
    }

    /* Message bubbles */
    .message {
      max-width: 820px;
      width: 100%;
      margin: 0 auto;
      padding: 7px 32px;
    }

    .message.user {
      display: flex;
      justify-content: flex-end;
    }

    .message.assistant {
      /* inherits above */
    }

    .bubble {
      max-width: 76%;
      padding: 12px 16px;
      border-radius: var(--radius);
      line-height: 1.65;
      font-size: 15.5px;
    }

    .message.user .bubble {
      background: #013d34;
      border: 1px solid rgba(1, 191, 165, 0.22);
      color: var(--text);
      border-radius: var(--radius) var(--radius) 4px var(--radius);
    }

    .message.assistant .bubble {
      background: #002620;
      border: 1px solid rgba(255, 255, 255, 0.09);
      color: var(--text);
      max-width: 84%;
      border-radius: var(--radius) var(--radius) var(--radius) 4px;
    }

    /* Thinking panel */
    .thinking-panel {
      background: rgba(0, 38, 32, 0.55);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      font-size: 12.5px;
      max-width: 84%;
      backdrop-filter: blur(6px);
    }

    .thinking-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px 13px;
      cursor: pointer;
      user-select: none;
    }

    .thinking-header:hover { background: rgba(255,255,255,0.03); }

    .thinking-spinner {
      width: 12px;
      height: 12px;
      border: 2px solid rgba(1, 191, 165, 0.25);
      border-top-color: var(--lp-teal);
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      flex-shrink: 0;
    }

    .thinking-spinner.done {
      border-color: var(--lp-teal);
      animation: none;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    .thinking-label {
      flex: 1;
      color: var(--text-muted);
      letter-spacing: var(--tracking);
    }

    .thinking-toggle {
      font-size: 10px;
      color: var(--text-dim);
    }

    .thinking-steps {
      border-top: 1px solid var(--border);
      padding: 8px 0;
      max-height: 200px;
      overflow-y: auto;
      opacity: 1;
      transition: max-height 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                  opacity 0.18s ease-out,
                  padding 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .thinking-steps.collapsed {
      max-height: 0;
      opacity: 0;
      padding: 0;
      border-top: none;
      overflow: hidden;
    }

    .thinking-step {
      display: flex;
      align-items: flex-start;
      gap: 7px;
      padding: 4px 13px;
      color: var(--text-dim);
      font-size: 12px;
      letter-spacing: var(--tracking);
    }

    .step-icon {
      width: 13px;
      height: 13px;
      flex-shrink: 0;
      margin-top: 2px;
    }

    /* Markdown inside bubbles */
    .bubble p  { margin: 0 0 10px; }
    .bubble p:last-child { margin-bottom: 0; }
    .bubble ul, .bubble ol { margin: 6px 0 10px 18px; }
    .bubble li { margin-bottom: 3px; }
    .bubble h1, .bubble h2, .bubble h3 {
      font-weight: 600;
      letter-spacing: var(--tracking-tight);
      margin: 14px 0 6px;
    }
    .bubble h1 { font-size: 16px; }
    .bubble h2 { font-size: 14.5px; }
    .bubble h3 { font-size: 13.5px; }
    .bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }

    .bubble table {
      border-collapse: collapse;
      font-size: 12.5px;
      width: 100%;
      margin: 8px 0;
    }
    .bubble th {
      background: rgba(1, 191, 165, 0.08);
      color: var(--lp-teal);
      font-weight: 600;
      text-align: left;
      padding: 6px 10px;
      border: 1px solid var(--border);
      font-size: 11px;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .bubble td {
      padding: 6px 10px;
      border: 1px solid var(--border);
      color: var(--text-muted);
    }
    .bubble tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

    .bubble strong { color: var(--text); font-weight: 600; }
    .bubble em     { color: var(--text-muted); }
    .bubble code {
      background: rgba(1, 191, 165, 0.08);
      border: 1px solid rgba(1, 191, 165, 0.15);
      border-radius: 4px;
      padding: 1px 5px;
      font-size: 12px;
      font-family: "SF Mono", ui-monospace, monospace;
      color: var(--lp-teal);
    }
    .bubble pre {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 12px;
      margin: 8px 0;
      overflow-x: auto;
    }
    .bubble pre code {
      background: none;
      border: none;
      padding: 0;
      color: var(--text);
      font-size: 12px;
    }
    .bubble hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 12px 0;
    }
    .bubble blockquote {
      border-left: 2px solid var(--lp-teal-border);
      padding-left: 12px;
      margin: 8px 0;
      color: var(--text-muted);
    }

    /* Message actions */
    .msg-actions {
      padding: 5px 0 6px;
      max-width: 84%;
      display: flex;
      align-items: center;
      gap: 2px;
    }

    .suggest-update-btn, .copy-btn {
      background: none;
      border: none;
      font-size: 11px;
      color: var(--text-dim);
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 6px;
      border-radius: var(--radius-xs);
      transition: background 0.13s, border-color 0.13s, color 0.13s, transform 0.13s;
      letter-spacing: var(--tracking);
    }

    .suggest-update-btn:hover, .copy-btn:hover {
      color: var(--lp-teal);
      background: var(--lp-teal-soft);
    }

    .copy-btn.copied {
      color: var(--lp-teal);
      animation: copyFlash 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .query-timing {
      margin-left: auto;
      font-size: 11px;
      color: rgba(240,245,244,0.28);
      padding: 3px 5px;
      pointer-events: none;
      user-select: none;
    }

    /* Vault update suggestion form */
    .suggest-form-wrap {
      margin-top: 6px;
      background: rgba(0, 38, 32, 0.7);
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      padding: 10px 12px;
      max-width: 480px;
      backdrop-filter: blur(8px);
    }

    .suggest-form-label {
      font-size: 11.5px;
      color: var(--text-muted);
      margin-bottom: 7px;
    }

    .suggest-form-row {
      display: flex;
      gap: 7px;
    }

    .suggest-input {
      flex: 1;
      background: rgba(0, 0, 0, 0.25);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text);
      font-family: var(--font-body);
      font-size: 12.5px;
      padding: 6px 10px;
      outline: none;
      letter-spacing: var(--tracking);
    }

    .suggest-input:focus { border-color: var(--lp-teal-border); }

    .suggest-submit {
      background: var(--lp-teal);
      border: none;
      border-radius: var(--radius-xs);
      color: var(--lp-green);
      font-size: 12px;
      font-weight: 600;
      padding: 6px 12px;
      transition: opacity 0.13s;
      letter-spacing: var(--tracking);
    }

    .suggest-submit:hover { opacity: 0.85; }
    .suggest-submit:disabled { opacity: 0.4; cursor: not-allowed; }

    .suggest-confirm {
      font-size: 12px;
      color: var(--lp-teal);
      padding: 4px 0;
    }

    /* ============================================================
       INPUT AREA
    ============================================================ */
    .input-area {
      flex-shrink: 0;
      padding: 10px 0 20px;
    }

    .input-form {
      display: flex;
      gap: 9px;
      align-items: flex-end;
      background: rgba(0, 38, 32, 0.65);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 11px 11px 11px 17px;
      transition: border-color 0.13s;
    }

    .input-form:focus-within {
      border-color: var(--lp-teal-border);
      box-shadow: 0 0 0 3px rgba(1, 191, 165, 0.08);
    }

    #msg-input {
      flex: 1;
      background: none;
      border: none;
      outline: none;
      resize: none;
      font-family: var(--font-body);
      font-size: 15.5px;
      color: var(--text);
      line-height: 1.5;
      letter-spacing: var(--tracking);
      max-height: 200px;
      overflow-y: hidden;
    }

    #msg-input::placeholder { color: var(--text-dim); }

    #send-btn {
      width: 38px;
      height: 38px;
      background: var(--lp-teal);
      border: none;
      border-radius: var(--radius-xs);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: opacity 0.13s, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #send-btn:hover             { opacity: 0.85; }
    #send-btn:active:not(:disabled) { transform: scale(0.82); opacity: 1; }
    #send-btn:disabled          { opacity: 0.3; cursor: not-allowed; }

    /* Send ripple — ring that expands outward on message send */
    @keyframes sendRipple {
      0%   { transform: scale(1);   opacity: 0.6; }
      100% { transform: scale(2.2); opacity: 0; }
    }
    #send-btn.sending::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      border: 2px solid var(--lp-teal);
      animation: sendRipple 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
      pointer-events: none;
    }
    #send-btn { position: relative; overflow: visible; }

    .input-hint {
      font-size: 11px;
      color: var(--text-dim);
      text-align: center;
      margin-top: 7px;
    }
    /* ============================================================
       RESPONSIVE — tablet and mobile
    ============================================================ */

    /* Tablet: narrow sidebar */
    @media (max-width: 900px) {
      .sidebar { width: 200px; }
      .chat-column { max-width: 100%; }
      .message { max-width: 100%; }
    }

    /* Mobile top bar */
    .mobile-topbar {
      display: none;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
      background: rgba(0, 26, 21, 0.9);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      flex-shrink: 0;
    }

    .mobile-topbar img { height: 16px; width: auto; }

    .mobile-new-chat {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 12px;
      padding: 5px 10px;
      letter-spacing: var(--tracking);
      transition: background 0.13s, border-color 0.13s, color 0.13s, transform 0.13s;
    }

    .mobile-new-chat:hover {
      border-color: var(--lp-teal-border);
      color: var(--text);
    }

    /* Mobile: hide sidebar, full-width chat */
    @media (max-width: 600px) {
      .sidebar { display: none; }
      .mobile-topbar { display: flex; }

      .app-shell { flex-direction: column; }

      .main { height: 100dvh; }

      .chat-column {
        max-width: 100%;
        padding: 0 16px;
      }

      .message {
        max-width: 100%;
        padding: 4px 16px;
      }

      .message.user .bubble  { max-width: 90%; }
      .message.assistant .bubble { max-width: 100%; }

      .messages { padding: 16px 0 8px; }

      .input-area { padding: 8px 0 16px; }

      .empty-state { padding: 40px 20px 20px; }

      .suggestions { gap: 6px; }
      .suggestion  { font-size: 12px; padding: 5px 11px; }

      .empty-title { font-size: 16px; }
    }
    /* ============================================================
       ACCESSIBILITY — focus, screen reader, contrast
    ============================================================ */

    /* Focus ring — teal, keyboard users only, invisible to mouse */
    :focus-visible {
      outline: 2px solid rgba(1, 191, 165, 0.85);
      outline-offset: 3px;
      border-radius: var(--radius-xs);
    }

    /* Suppress ring on scroll container and textarea (has its own indicator) */
    .messages:focus-visible,
    #msg-input:focus-visible { outline: none; }

    /* Visually hidden — present in DOM for screen readers, invisible visually */
    .sr-only {
      position: absolute;
      width: 1px; height: 1px;
      padding: 0; margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border-width: 0;
    }

    /* ============================================================
       POLISH — typographic refinement, brand details, consistency
    ============================================================ */

    /* Space Grotesk numeric alignment for data tables */
    .bubble td { font-variant-numeric: tabular-nums; }

    /* Sidebar top — teal accent line for brand character */
    .sidebar-top {
      border-bottom: 1px solid rgba(1, 191, 165, 0.22);
    }

    /* Vault file count — give it teal presence */
    #sb-files {
      color: var(--lp-teal);
      opacity: 0.75;
      font-weight: 500;
    }

    /* Chip category labels — slightly more readable */
    .chip-label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.08em;
    }

    /* Empty state sub — slightly tighter line-height with Space Grotesk */
    .empty-sub {
      font-size: 13.5px;
      line-height: 1.55;
    }

    /* Thinking label — slightly lighter weight than body to feel secondary */
    .thinking-label { font-weight: 400; }

    /* Thinking done state — slightly warmer */
    .thinking-spinner.done + .thinking-label { color: var(--lp-teal); opacity: 0.8; }

    /* Input hint — quieter */
    .input-hint { font-size: 10.5px; letter-spacing: 0.01em; }

    /* Suggest-form entrance — slides down from button */
    @keyframes formSlideIn {
      from { opacity: 0; transform: translateY(-6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .suggest-form-wrap {
      animation: formSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* ============================================================
       DELIGHT — micro-interactions and purposeful motion
    ============================================================ */

    /* Message entrance — every bubble slides up gently when appended */
    @keyframes msgIn {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .message {
      animation: msgIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* Thinking step slide-in — each completed step arrives from the left */
    @keyframes stepIn {
      from { opacity: 0; transform: translateX(-6px); }
      to   { opacity: 1; transform: translateX(0); }
    }
    .thinking-step {
      animation: stepIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* Empty state icon — gentle float */
    @keyframes iconFloat {
      0%, 100% { transform: translateY(0); }
      50%       { transform: translateY(-5px); }
    }
    .empty-icon { animation: iconFloat 3.2s ease-in-out infinite; }

    /* Suggestion chips — cascade in on appearance */
    @keyframes chipIn {
      from { opacity: 0; transform: translateY(5px) scale(0.97); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }
    .chip-group .suggestion {
      opacity: 0;
      animation: chipIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* Copy button pop on confirm */
    @keyframes copyFlash {
      0%   { transform: scale(1); }
      35%  { transform: scale(1.14); }
      100% { transform: scale(1); }
    }

    /* Streaming cursor — blink at end of in-progress response */
    @keyframes blink {
      0%, 100% { opacity: 1; }
      50%       { opacity: 0; }
    }
    .stream-cursor {
      display: inline-block;
      width: 2px;
      height: 13px;
      background: var(--lp-teal);
      border-radius: 1px;
      margin-left: 2px;
      vertical-align: text-bottom;
      animation: blink 0.75s ease-in-out infinite;
    }

    /* Thinking spinner — subtle colour pulse when active */
    .thinking-spinner {
      transition: border-color 0.3s;
    }

    /* New chat button — slight lift on hover */
    .new-chat-btn {
      transition: opacity 0.15s, transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .new-chat-btn:hover { opacity: 1; transform: translateY(-1px); }
    .new-chat-btn:active { transform: scale(0.97); }

    /* Respect reduced motion */
    @media (prefers-reduced-motion: reduce) {
      .message, .thinking-step, .chip-group .suggestion,
      .empty-icon, .stream-cursor { animation: none !important; }
      .message { opacity: 1 !important; transform: none !important; }
      .pulse-skeleton-row { animation: none !important; background: rgba(255,255,255,0.06) !important; }
      .pulse-buyer-item   { animation: none !important; opacity: 1 !important; transform: none !important; }
      .empty-icon         { animation: none !important; }
      #empty-greeting, #empty-sub-text { animation: none !important; opacity: 1 !important; transform: none !important; }
      .status-dot         { animation: none !important; }
      .suggest-form-wrap  { animation: none !important; }
      /* Pulse sidebar + CRM new elements */
      .pulse-card, .pulse-summary, .pulse-healthy,
      .pulse-flag-row, .pulse-more-link { animation: none !important; opacity: 1 !important; transform: none !important; }
      .pulse-flag-bar-fill { transition: none !important; transform: scaleX(1) !important; }
      .crm-card { animation: none !important; opacity: 1 !important; transform: none !important; }
    }

    /* ============================================================
       PULSE SIDEBAR — right-side overlay panel
    ============================================================ */

    /* Status dots — always visible at right edge */
    #pulse-dots {
      position: fixed;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      display: none;  /* hidden until first pulse load */
      flex-direction: column;
      gap: 5px;
      padding: 8px 5px;
      background: rgba(0, 26, 21, 0.72);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-radius: 6px 0 0 6px;
      border: 1px solid var(--border);
      border-right: none;
      z-index: 800;
      cursor: pointer;
    }

    #pulse-dots.visible { display: flex; }

    .pulse-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--lp-teal);
      opacity: 0.6;
    }

    .pulse-dot.red    { background: var(--red); opacity: 1; }
    .pulse-dot.amber  { background: var(--amber); opacity: 1; }
    .pulse-dot.teal   { background: var(--lp-teal); opacity: 1; }
    .pulse-dot.grey   { background: rgba(255,255,255,0.2); opacity: 1; }

    /* Pulse toggle button — top-right of viewport */
    #pulse-toggle {
      position: fixed;
      top: 14px;
      right: 14px;
      width: 36px;
      height: 36px;
      background: rgba(0, 38, 32, 0.82);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 950;  /* above pulse panel so always clickable */
      transition: border-color 0.15s, background 0.15s;
      flex-direction: column;
      gap: 3.5px;
      padding: 0;
    }

    @media (max-width: 600px) {
      #pulse-toggle {
        top: 10px;
        right: 10px;
      }
      /* Push mobile topbar buttons left so they don't overlap the pulse toggle */
      .mobile-topbar {
        padding-right: 58px;
      }
    }

    #pulse-toggle:hover {
      border-color: var(--lp-teal-border);
      background: rgba(1, 191, 165, 0.1);
    }

    #pulse-toggle.active {
      border-color: var(--lp-teal);
      background: rgba(1, 191, 165, 0.14);
    }

    /* Hide the floating toggle when the panel is open — close button lives inside the panel header instead */
    #pulse-toggle.active { opacity: 0; pointer-events: none; }

    .ham-line {
      width: 14px;
      height: 1.5px;
      background: var(--text-muted);
      border-radius: 1px;
      transition: background 0.15s;
    }

    #pulse-toggle:hover  .ham-line,
    #pulse-toggle.active .ham-line { background: var(--lp-teal); }

    /* Backdrop — mobile only */
    #pulse-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 900;
    }

    #pulse-backdrop.visible { display: block; }

    /* Pulse panel */
    #pulse-panel {
      position: fixed;
      top: 0;
      right: 0;
      width: 340px;
      min-width: 280px;
      max-width: 520px;
      height: 100vh;
      background: rgba(0, 22, 17, 0.96);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-left: 1px solid var(--border);
      z-index: 920;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 250ms ease;
      overflow: hidden;
    }

    #pulse-panel.open { transform: translateX(0); }

    @media (max-width: 600px) {
      #pulse-panel { width: 100vw !important; min-width: unset; }
    }

    /* Resize drag handle — left edge of panel */
    #pulse-resize-handle {
      position: absolute;
      top: 0;
      left: 0;
      width: 6px;
      height: 100%;
      cursor: ew-resize;
      z-index: 5;
      background: transparent;
      transition: background 0.15s;
    }
    #pulse-resize-handle:hover,
    #pulse-resize-handle.dragging {
      background: rgba(1, 191, 165, 0.18);
    }

    /* "Updating..." badge that appears in timestamp area during background refresh */
    .pulse-updating-badge {
      font-size: 10px;
      color: var(--lp-teal);
      opacity: 0.7;
      display: flex;
      align-items: center;
      gap: 4px;
      animation: pulseFade 1.4s ease-in-out infinite;
    }
    @keyframes pulseFade { 0%,100%{opacity:0.7}50%{opacity:0.35} }

    /* Pulse header */
    .pulse-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 14px 14px 12px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .pulse-title {
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--lp-teal);
      flex: 1;
    }

    .pulse-refresh-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 8px;
      display: flex;
      align-items: center;
      gap: 4px;
      transition: border-color 0.13s, color 0.13s;
      letter-spacing: var(--tracking);
    }

    .pulse-refresh-btn:hover {
      border-color: var(--lp-teal-border);
      color: var(--lp-teal);
    }

    .pulse-refresh-btn.spinning svg {
      animation: spin 0.75s linear infinite;
    }

    .pulse-timestamp {
      font-size: 10px;
      color: var(--text-dim);
      letter-spacing: var(--tracking);
    }

    /* Pulse body — scrollable card list */
    .pulse-body {
      flex: 1;
      overflow-y: auto;
      padding: 10px 10px 20px;
      transition: opacity 0.14s ease;
    }

    .pulse-body.tab-fade { opacity: 0; }

    .pulse-body::-webkit-scrollbar { width: 3px; }
    .pulse-body::-webkit-scrollbar-track { background: transparent; }
    .pulse-body::-webkit-scrollbar-thumb { background: rgba(1, 191, 165, 0.15); border-radius: 2px; }

    /* AI summary strip */
    .pulse-summary {
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      padding: 10px 11px;
      margin-bottom: 10px;
      background: rgba(1, 191, 165, 0.04);
    }

    .pulse-summary-label {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      color: var(--lp-teal);
      margin-bottom: 6px;
      opacity: 0.8;
    }

    .pulse-summary-dot {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--lp-teal);
      animation: pulse 2.2s ease-in-out infinite;
    }

    .pulse-summary-text {
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.6;
    }

    /* Skeleton loading */
    @keyframes shimmer {
      0%   { opacity: 0.45; }
      50%  { opacity: 0.18; }
      100% { opacity: 0.45; }
    }

    .pulse-skeleton {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 11px;
      margin-bottom: 8px;
      animation: shimmer 1.4s ease-in-out infinite;
    }

    .pulse-skeleton-bar {
      height: 9px;
      background: rgba(1, 191, 165, 0.18);
      border-radius: 4px;
      margin-bottom: 7px;
    }

    .pulse-skeleton-bar.short { width: 55%; }
    .pulse-skeleton-bar.long  { width: 80%; }
    .pulse-skeleton-bar.tiny  { width: 35%; margin-bottom: 0; }

    /* Main area — smooth push when Pulse opens on desktop */
    .main {
      transition: margin-right 250ms ease;
    }
    .main.pulse-pushed {
      margin-right: 340px; /* updated by JS when panel is resized */
    }
    @media (max-width: 768px) {
      .main.pulse-pushed { margin-right: 0 !important; }
    }

    /* Pulse cards */
    .pulse-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 9px 11px;
      margin-bottom: 7px;
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s, filter 0.15s;
    }

    .pulse-card:hover {
      filter: brightness(1.12);
      border-color: rgba(255,255,255,0.15);
    }

    .pulse-card.red    { border-left: 2.5px solid var(--red); background: rgba(239, 68, 68, 0.05); }
    .pulse-card.amber  { border-left: 2.5px solid var(--amber);   background: rgba(245, 158, 11, 0.05); }
    .pulse-card.teal   { border-left: 2.5px solid var(--lp-teal); background: rgba(1, 191, 165, 0.04); }
    .pulse-card.neutral { border-left: 2.5px solid rgba(255,255,255,0.15); }

    .pulse-card-header {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 3px;
    }

    .pulse-card-icon {
      font-size: 13px;
      line-height: 1;
      flex-shrink: 0;
    }

    .pulse-card-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-dim);
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .pulse-dismiss-btn {
      flex-shrink: 0;
      background: none;
      border: none;
      color: rgba(255,255,255,0.18);
      font-size: 11px;
      line-height: 1;
      padding: 2px 4px;
      cursor: pointer;
      border-radius: 3px;
      opacity: 0;
      transition: opacity 0.15s, color 0.15s, background 0.15s;
    }
    .pulse-card:hover .pulse-dismiss-btn {
      opacity: 1;
    }
    .pulse-dismiss-btn:hover {
      color: rgba(255,255,255,0.7);
      background: rgba(255,255,255,0.08);
    }

    .pulse-dismissed-header {
      font-size: 9.5px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: rgba(255,255,255,0.2);
      padding: 14px 0 6px;
      border-top: 1px solid rgba(255,255,255,0.06);
      margin-top: 6px;
    }

    .pulse-card-dismissed {
      opacity: 0.3;
      filter: none !important;
      cursor: pointer;
      transition: opacity 0.15s;
    }
    .pulse-card-dismissed:hover { opacity: 0.55; }
    .pulse-card-dismissed.expanded { opacity: 0.78; }

    /* Hide sub text and undismiss button until expanded */
    .pulse-card-dismissed .pulse-card-sub { display: none; }
    .pulse-card-dismissed .pulse-card-type { display: none; }
    .pulse-card-dismissed .pulse-undismiss-btn { display: none; }
    .pulse-card-dismissed.expanded .pulse-card-sub { display: block; }
    .pulse-card-dismissed.expanded .pulse-undismiss-btn { display: flex; }

    .pulse-card-dismissed .pulse-card-value {
      font-size: 13px;
      font-weight: 500;
    }

    .pulse-dismissed-by {
      font-size: 10px;
      color: rgba(255,255,255,0.4);
      white-space: nowrap;
      margin-left: auto;
      flex-shrink: 0;
    }

    /* Un-review button inside dismissed card */
    .pulse-undismiss-btn {
      margin-top: 7px;
      background: none;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 10px;
      font-weight: 600;
      padding: 4px 8px;
      cursor: pointer;
      align-items: center;
      gap: 4px;
      transition: border-color 0.13s, color 0.13s;
      letter-spacing: 0.03em;
    }
    .pulse-undismiss-btn:hover {
      border-color: var(--lp-teal-border);
      color: var(--lp-teal);
    }

    .pulse-card-value {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: -0.03em;
      line-height: 1.1;
      margin-bottom: 3px;
    }

    .pulse-card.red    .pulse-card-value { color: var(--red); }
    .pulse-card.amber  .pulse-card-value { color: var(--amber); }
    .pulse-card.teal   .pulse-card-value { color: var(--lp-teal); }
    .pulse-card.neutral .pulse-card-value { color: var(--text-muted); }

    .pulse-card-sub {
      font-size: 11px;
      color: var(--text-dim);
      line-height: 1.45;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .pulse-card-type {
      font-size: 9px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-dim);
      opacity: 0.5;
      flex-shrink: 0;
    }

    /* Empty / healthy state */
    .pulse-healthy {
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      padding: 12px 13px;
      background: rgba(1, 191, 165, 0.04);
      font-size: 12px;
      color: var(--lp-teal);
      text-align: center;
    }

    /* Card entrance animation */
    @keyframes pulseCardIn {
      from { opacity: 0; transform: translateX(8px); }
      to   { opacity: 1; transform: translateX(0); }
    }

    .pulse-card, .pulse-summary, .pulse-healthy {
      animation: pulseCardIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* ============================================================
       DASHBOARD OVERLAY (full-screen in-page panel)
    ============================================================ */
    /* ============================================================
       SID HISTORY POPUP
    ============================================================ */
    #sid-history-backdrop {
      position: fixed; inset: 0; background: rgba(0,0,0,0.55);
      z-index: 1100; opacity: 0; pointer-events: none;
      transition: opacity 0.18s ease;
    }
    #sid-history-backdrop.visible { opacity: 1; pointer-events: auto; }
    #sid-history-modal {
      position: fixed; z-index: 1101;
      top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.97);
      width: min(700px, 92vw);
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 22px 24px 24px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.45);
      opacity: 0; pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16,1,0.3,1);
    }
    #sid-history-modal.visible {
      opacity: 1; pointer-events: auto;
      transform: translate(-50%, -50%) scale(1);
    }
    .sh-header {
      display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px;
    }
    .sh-title { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.35; word-break: break-all; }
    .sh-close {
      background: none; border: none; color: var(--text-muted); cursor: pointer;
      font-size: 18px; line-height: 1; padding: 2px 4px; opacity: 0.6; flex-shrink: 0;
    }
    .sh-close:hover { opacity: 1; }
    .sh-stats { display: flex; gap: 12px; margin-bottom: 18px; }
    .sh-stat {
      flex: 1; background: var(--surface-2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 14px;
    }
    .sh-stat-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 3px; }
    .sh-stat-val { font-size: 18px; font-weight: 800; letter-spacing: -0.025em; }
    .sh-chart-wrap { position: relative; height: 200px; }
    .sh-days-row { display: flex; gap: 5px; margin-bottom: 14px; }
    .sh-days-btn {
      background: none; border: 1px solid var(--border); border-radius: var(--radius-xs);
      color: var(--text-muted); font-size: 10px; font-weight: 600; padding: 3px 10px; cursor: pointer;
      transition: border-color 0.12s, color 0.12s;
    }
    .sh-days-btn.active { border-color: var(--lp-teal); color: var(--lp-teal); background: rgba(1,191,165,0.07); }
    .sh-days-btn:hover:not(.active) { border-color: var(--lp-teal-border); color: var(--lp-teal); }

    /* ============================================================
       BUYER DRILLDOWN MODAL
    ============================================================ */
    #buyer-modal-backdrop {
      position: fixed; inset: 0; background: rgba(0,0,0,0.55);
      z-index: 1100; opacity: 0; pointer-events: none;
      transition: opacity 0.18s ease;
    }
    #buyer-modal-backdrop.visible { opacity: 1; pointer-events: auto; }
    #buyer-modal {
      position: fixed; z-index: 1101;
      top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.97);
      width: min(900px, 94vw); max-height: 85vh; overflow-y: auto;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 22px 24px 28px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.45);
      opacity: 0; pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16,1,0.3,1);
    }
    #buyer-modal.visible {
      opacity: 1; pointer-events: auto;
      transform: translate(-50%, -50%) scale(1);
    }
    #buyer-modal::-webkit-scrollbar { width: 4px; }
    #buyer-modal::-webkit-scrollbar-thumb { background: rgba(1,191,165,0.2); border-radius: 2px; }
    .bm-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
    .bm-title { flex: 1; }
    .bm-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 3px; }
    .bm-title .bm-sub { font-size: 11px; color: var(--text-dim); }
    .bm-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 4px; opacity: 0.6; flex-shrink: 0; }
    .bm-close:hover { opacity: 1; }
    .bm-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
    .bm-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
    .bm-kpi-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 4px; }
    .bm-kpi-val { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
    .bm-search-row { margin-bottom: 14px; }
    .bm-search {
      width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-body);
      font-size: 12px; padding: 8px 12px; outline: none; letter-spacing: var(--tracking);
    }
    .bm-search:focus { border-color: var(--lp-teal-border); }
    .bm-table { width: 100%; border-collapse: collapse; }
    .bm-table th {
      text-align: left; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.06em; color: var(--text-dim); padding: 4px 8px 8px; white-space: nowrap;
      border-bottom: 1px solid var(--border);
    }
    .bm-table th.r { text-align: right; }
    .bm-table td { padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.035); font-size: 12px; }
    .bm-table td.r { text-align: right; white-space: nowrap; }
    .bm-table tr.vert-group td { background: rgba(1,191,165,0.05); font-weight: 700; font-size: 11px; }
    .bm-table tr:hover td { background: rgba(255,255,255,0.025); }
    .bm-table tr.vert-group:hover td { background: rgba(1,191,165,0.08); }
    .bm-table tr.grand-total td { border-top: 2px solid var(--border); font-weight: 700; color: var(--text); }
    .bm-no-profit { font-size: 10px; color: var(--text-dim); margin-top: 14px; font-style: italic; }

    #pdo-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 10, 8, 0.78);
      backdrop-filter: blur(5px);
      -webkit-backdrop-filter: blur(5px);
      z-index: 1800;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.22s ease;
    }
    #pdo-backdrop.visible { opacity: 1; pointer-events: auto; }

    #pdo {
      position: fixed;
      inset: 0;
      z-index: 1810;
      display: flex;
      padding: 16px;
      pointer-events: none;
      opacity: 0;
      transform: translateY(14px);
      transition: opacity 0.22s ease, transform 0.22s ease;
    }
    #pdo.open { pointer-events: auto; opacity: 1; transform: translateY(0); }

    .pdo-inner {
      flex: 1;
      position: relative;
      background: rgba(0, 20, 15, 0.98);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      display: flex;
      flex-direction: row;
      overflow: hidden;
    }

    .pdo-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 11px 48px 11px 18px; /* right pad clears the abs-positioned close btn */
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      flex-wrap: nowrap;
      min-height: 0;
    }

    /* Custom date range picker row (inline, toggled by JS) */
    #pdo-custom-range {
      display: none;
      align-items: center;
      gap: 5px;
    }
    .pdo-date-input {
      background: rgba(0,0,0,0.25);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      font-family: var(--font-body);
      padding: 4px 8px;
      cursor: pointer;
      letter-spacing: var(--tracking);
      width: 108px;
    }
    .pdo-date-input:focus { border-color: var(--lp-teal-border); outline: none; }
    .pdo-date-input::-webkit-calendar-picker-indicator { filter: invert(0.55); cursor: pointer; }

    .pdo-date-tabs { display: flex; gap: 4px; }
    .pdo-date-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      padding: 4px 11px;
      cursor: pointer;
      transition: border-color 0.13s, color 0.13s, background 0.13s;
    }
    .pdo-date-btn:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }
    .pdo-date-btn.active {
      border-color: var(--lp-teal);
      color: var(--lp-teal);
      background: rgba(1, 191, 165, 0.08);
    }

    .pdo-refresh-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      padding: 4px 11px;
      cursor: pointer;
      display: flex; align-items: center; gap: 5px;
      transition: border-color 0.13s, color 0.13s;
    }
    .pdo-refresh-btn:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }
    .pdo-refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }

    .pdo-timestamp { font-size: 10px; color: var(--text-dim); }

    .pdo-close-btn {
      position: absolute;
      top: 12px;
      right: 14px;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 20px;
      line-height: 1;
      padding: 4px 6px;
      cursor: pointer;
      opacity: 0.55;
      transition: opacity 0.13s;
      z-index: 2;
    }
    .pdo-close-btn:hover { opacity: 1; }
    .pdo-close-btn:focus-visible { opacity: 1; outline: 1px solid var(--lp-teal-border); border-radius: 4px; }

    #pdo-summary { flex-shrink: 0; }
    .pdo-summary-strip {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 10px 20px;
      border-bottom: 1px solid var(--border);
      background: rgba(1, 191, 165, 0.03);
    }
    .pdo-summary-dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      background: var(--lp-teal);
      flex-shrink: 0;
      margin-top: 4px;
      animation: pulse 2.2s ease-in-out infinite;
    }
    .pdo-summary-text { font-size: 13px; color: var(--text-muted); line-height: 1.65; }

    /* Stale data indicator — shown when cached data is being displayed while fresh data loads */
    #pdo-stale-bar {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 5px 20px;
      background: rgba(184, 168, 0, 0.07);
      border-bottom: 1px solid rgba(184, 168, 0, 0.18);
      font-size: 11px;
      color: var(--amber, #b8a800);
      letter-spacing: 0.02em;
    }
    #pdo-stale-bar .stale-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: var(--amber, #b8a800);
      flex-shrink: 0;
      animation: pulse 1.4s ease-in-out infinite;
    }
    #pdo-stale-bar .stale-spinner {
      width: 10px; height: 10px;
      border: 1.5px solid rgba(184, 168, 0, 0.25);
      border-top-color: var(--amber, #b8a800);
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .pdo-body {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
    }
    .pdo-body::-webkit-scrollbar { width: 4px; }
    .pdo-body::-webkit-scrollbar-thumb { background: rgba(1,191,165,0.15); border-radius: 2px; }

    /* Sparklines section */
    .pdo-trends-section {
      margin-top: 24px;
      padding-top: 20px;
      border-top: 1px solid rgba(255,255,255,0.06);
    }
    .pdo-trends-title {
      font-size: 11px; font-weight: 600; color: var(--text-muted);
      letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 14px;
    }
    .pdo-trends-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 14px;
    }
    .pdo-trend-card {
      background: rgba(255,255,255,0.03);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 12px 8px;
    }
    .pdo-trend-card-label {
      font-size: 9.5px; font-weight: 600; color: var(--text-muted);
      margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .pdo-trend-canvas-wrap {
      position: relative; height: 52px;
    }
    .pdo-trend-loading {
      font-size: 8.5px; color: var(--text-dim); padding: 10px 0; text-align: center;
    }

    /* KPI row */
    .pdo-kpi-row {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 20px;
    }
    @media (max-width: 800px) { .pdo-kpi-row { grid-template-columns: repeat(2, 1fr); } }

    .pdo-kpi { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
    .pdo-kpi-teal    { border-left: 3px solid var(--lp-teal); background: rgba(1,191,165,0.04); }
    .pdo-kpi-amber   { border-left: 3px solid var(--amber);        background: rgba(245,158,11,0.04); }
    .pdo-kpi-red     { border-left: 3px solid var(--red);     background: rgba(239,68,68,0.04); }
    .pdo-kpi-neutral { border-left: 3px solid rgba(255,255,255,0.15); }
    .pdo-kpi-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 5px; }
    .pdo-kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin-bottom: 4px; }
    .pdo-kpi-sub   { font-size: 11px; color: var(--text-dim); }
    .pdo-kpi-teal    .pdo-kpi-value { color: var(--lp-teal); }
    .pdo-kpi-amber   .pdo-kpi-value { color: var(--amber); }
    .pdo-kpi-red     .pdo-kpi-value { color: var(--red); }
    .pdo-kpi-neutral .pdo-kpi-value { color: var(--text-muted); }
    .pdo-kpi-clickable { cursor: pointer; transition: opacity 0.15s, box-shadow 0.15s; }
    .pdo-kpi-clickable:hover { opacity: 0.85; box-shadow: 0 0 0 2px rgba(1,191,165,0.35); }

    /* Chart wrap */
    .pdo-chart-wrap {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px;
      margin-bottom: 20px;
      position: relative;
    }
    .pdo-chart-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 14px;
    }

    /* Alert/project columns */
    .pdo-columns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    @media (max-width: 700px) { .pdo-columns { grid-template-columns: 1fr; } }

    .pdo-col-title {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-top: 24px;
      margin-bottom: 8px;
      display: flex; align-items: center; gap: 6px;
    }
    /* First section label on a page needs no top push */
    .pdo-col-title:first-child { margin-top: 0; }
    .pdo-col-title::before {
      content: '';
      display: block;
      width: 3px; height: 11px;
      border-radius: 2px;
      background: var(--lp-teal);
    }

    .pdo-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      margin-bottom: 8px;
      cursor: pointer;
      transition: filter 0.15s, border-color 0.15s;
    }
    .pdo-card:hover { filter: brightness(1.1); border-color: rgba(255,255,255,0.14); }
    .pdo-card:last-child { margin-bottom: 0; }
    .pdo-card-red    { border-left: 3px solid var(--red);     background: rgba(239,68,68,0.05); }
    .pdo-card-amber  { border-left: 3px solid var(--amber);        background: rgba(245,158,11,0.05); }
    .pdo-card-teal   { border-left: 3px solid var(--lp-teal); background: rgba(1,191,165,0.04); }
    .pdo-card-neutral{ border-left: 3px solid rgba(255,255,255,0.15); }
    .pdo-card-row    { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
    .pdo-card-icon   { font-size: 14px; flex-shrink: 0; }
    .pdo-card-label  { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); flex: 1; }
    .pdo-card-badge  { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
    .pdo-card-red    .pdo-card-badge { background: rgba(239,68,68,0.15);    color: var(--red); }
    .pdo-card-amber  .pdo-card-badge { background: rgba(245,158,11,0.15);   color: var(--amber); }
    .pdo-card-teal   .pdo-card-badge { background: rgba(1,191,165,0.12);    color: var(--lp-teal); }
    .pdo-card-neutral .pdo-card-badge{ background: rgba(255,255,255,0.07);  color: var(--text-muted); }
    .pdo-card-sub    { font-size: 12px; color: var(--text-muted); padding-left: 22px; line-height: 1.5; }

    .pdo-empty {
      border: 1px dashed rgba(255,255,255,0.09);
      border-radius: var(--radius-sm);
      padding: 16px;
      text-align: center;
      font-size: 12px;
      color: var(--text-dim);
    }
    .pdo-loading {
      text-align: center;
      padding: 60px 0;
      color: var(--text-dim);
      font-size: 14px;
    }

    /* Buyer grid inside pdo */
    .pdo-buyer-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 10px;
    }
    .pdo-buyer-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      transition: filter 0.15s;
    }
    .pdo-buyer-card:hover { filter: brightness(1.08); }
    .pdo-buyer-teal  { border-left: 3px solid var(--lp-teal); background: rgba(1,191,165,0.04); }
    .pdo-buyer-amber { border-left: 3px solid var(--amber);        background: rgba(245,158,11,0.04); }
    .pdo-buyer-red   { border-left: 3px solid var(--red);     background: rgba(239,68,68,0.04); }
    .pdo-buyer-name {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .pdo-buyer-sold {
      font-size: 26px;
      font-weight: 800;
      letter-spacing: -0.03em;
      line-height: 1;
      margin-bottom: 4px;
    }
    .pdo-buyer-sub {
      font-size: 11px;
      color: var(--text-dim);
      margin-bottom: 8px;
    }
    .pdo-buyer-bar-bg {
      height: 4px;
      background: rgba(255,255,255,0.07);
      border-radius: 2px;
      overflow: hidden;
    }
    .pdo-buyer-bar-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.4s ease;
    }

    /* Single-row header — rows collapsed, keep selectors inert */
    .pdo-header-row1 { display: contents; }
    .pdo-header-row2 { display: contents; }

    /* ============================================================
       PDO SIDEBAR NAV — left panel with icon+label nav items
    ============================================================ */
    .pdo-sidenav {
      width: 168px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      background: rgba(0, 16, 12, 0.85);
      border-right: 1px solid var(--border);
      padding: 14px 10px 16px;
      gap: 2px;
      overflow-y: auto;
    }
    .pdo-sidenav-logo {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 2px 8px 14px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 6px;
    }
    .pdo-sidenav-logo img { height: 17px; width: auto; opacity: 0.85; }
    .pdo-nav-section {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: rgba(240,245,244,0.3);
      padding: 10px 8px 4px;
    }
    .pdo-nav-item {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 9px 10px;
      border-radius: var(--radius-xs);
      border: 1px solid transparent;
      color: var(--text-muted);
      font-size: 12.5px;
      font-weight: 500;
      cursor: pointer;
      background: none;
      text-align: left;
      width: 100%;
      transition: background 0.12s, color 0.12s, border-color 0.12s;
      letter-spacing: var(--tracking);
      white-space: nowrap;
    }
    .pdo-nav-item:hover {
      background: rgba(255,255,255,0.05);
      color: var(--text);
    }
    .pdo-nav-item.active {
      background: rgba(1,191,165,0.12);
      color: var(--lp-teal);
      border-color: var(--lp-teal-border);
      font-weight: 600;
    }
    .pdo-nav-icon {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
      opacity: 0.6;
    }
    .pdo-nav-item.active .pdo-nav-icon { opacity: 1; }
    .pdo-nav-item:hover .pdo-nav-icon { opacity: 0.85; }
    .pdo-nav-badge {
      margin-left: auto;
      font-size: 9.5px;
      font-weight: 700;
      padding: 1px 5px;
      border-radius: 10px;
      min-width: 16px;
      text-align: center;
      flex-shrink: 0;
    }
    .pdo-nav-badge.red { background: rgba(239,68,68,0.2); color: var(--red); }
    .pdo-nav-badge.amber { background: rgba(245,158,11,0.2); color: var(--amber); }
    .pdo-nav-badge.teal { background: rgba(1,191,165,0.15); color: var(--lp-teal); }
    .pdo-sidenav-footer {
      margin-top: auto;
      padding-top: 12px;
      border-top: 1px solid var(--border);
    }

    /* Keep .pdo-view-tabs etc as no-op for backward compat */
    .pdo-view-tabs { display: none; }
    .pdo-view-btn { display: none; }

    /* Separator between data tabs and Projects tab */
    .pdo-view-sep {
      width: 1px;
      background: rgba(255,255,255,0.12);
      margin: 3px 2px;
      align-self: stretch;
      flex-shrink: 0;
    }

    /* Projects tab grid */
    .pdo-projects-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 10px;
      padding: 2px 0 16px;
    }
    .pdo-project-card {
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 8px;
      padding: 12px 13px;
      cursor: pointer;
      transition: background 0.12s, border-color 0.12s;
    }
    .pdo-project-card:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
    .pdo-project-card.urgent { border-color: rgba(245,158,11,0.3); }
    .pdo-project-card.urgent:hover { border-color: rgba(245,158,11,0.5); }
    .pdo-project-card.red-urgent { border-color: rgba(239,68,68,0.3); }
    .pdo-project-card.red-urgent:hover { border-color: rgba(239,68,68,0.5); }
    .pdo-proj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
    .pdo-proj-icon { font-size: 14px; flex-shrink: 0; line-height: 1; margin-top: 1px; }
    .pdo-proj-badge {
      font-size: 8px; font-weight: 700; letter-spacing: 0.05em;
      padding: 2px 5px; border-radius: 3px; flex-shrink: 0; align-self: flex-start;
      text-transform: uppercase;
    }
    .pdo-proj-badge.urgent { background: rgba(245,158,11,0.15); color: var(--amber); }
    .pdo-proj-badge.red    { background: rgba(239,68,68,0.15);   color: var(--red);  }
    .pdo-proj-name { font-size: 11.5px; font-weight: 700; line-height: 1.3; color: var(--text); flex: 1; }
    .pdo-proj-type { font-size: 9px; color: var(--text-dim); opacity: 0.65; margin-bottom: 6px; }
    .pdo-proj-status { font-size: 10px; color: var(--text-muted); line-height: 1.4; }
    .pdo-projects-section-label {
      font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
      color: var(--text-dim); opacity: 0.5; margin: 14px 0 8px;
    }
    .pdo-projects-section-label:first-child { margin-top: 0; }

    /* Vertical table (Leads tab) */
    .pdo-vert-table { width: 100%; border-collapse: collapse; }
    .pdo-vert-table th {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-dim);
      text-align: left;
      padding: 0 10px 10px 10px;
      border-bottom: 1px solid var(--border);
    }
    .pdo-vert-table th:not(:first-child) { text-align: right; }
    .pdo-vert-row td {
      padding: 11px 10px;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      font-size: 13px;
      color: var(--text);
      vertical-align: middle;
    }
    .pdo-vert-row:last-child td { border-bottom: none; }
    .pdo-vert-row td:not(:first-child) { text-align: right; }
    .pdo-vert-name { font-weight: 600; font-size: 12px; }
    .pdo-vert-bar-wrap { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
    .pdo-vert-bar-bg { width: 60px; height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
    .pdo-vert-bar-fill { height: 100%; border-radius: 3px; }
    .pdo-vert-pct-label { font-size: 12px; font-weight: 700; min-width: 38px; text-align: right; }
    .pdo-vert-flag { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-left: 5px; vertical-align: middle; }

    /* Buyer leaderboard (Buyers tab) */
    .pdo-buyer-leaderboard { display: flex; flex-direction: column; gap: 8px; }
    .pdo-buyer-lead-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      transition: border-color 0.13s;
    }
    .pdo-buyer-lead-row:hover { border-color: rgba(1,191,165,0.2); }
    .pdo-buyer-rank {
      font-size: 12px;
      font-weight: 800;
      color: var(--text-dim);
      width: 22px;
      flex-shrink: 0;
      text-align: center;
    }
    .pdo-buyer-rank-1 { color: var(--amber); }
    .pdo-buyer-rank-2 { color: var(--text-muted); }
    .pdo-buyer-rank-3 { color: #a06030; }
    .pdo-buyer-lead-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
    .pdo-buyer-lead-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 2; }
    .pdo-buyer-chip {
      font-size: 10px;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 4px;
      background: rgba(1,191,165,0.09);
      color: var(--lp-teal);
      border: 1px solid rgba(1,191,165,0.18);
      white-space: nowrap;
    }
    .pdo-buyer-lead-sold { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; color: var(--lp-teal); min-width: 40px; text-align: right; }
    .pdo-buyer-lead-pct { font-size: 11px; color: var(--text-dim); min-width: 38px; text-align: right; }

    /* KPI row for Buyers/Leads tabs */
    .pdo-tab-kpi-row {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin-bottom: 20px;
    }
    @media (max-width: 700px) { .pdo-tab-kpi-row { grid-template-columns: repeat(2, 1fr); } }

    /* Scanning indicator */
    .pdo-scanning-note {
      font-size: 11px;
      color: var(--text-dim);
      padding: 8px 0 18px;
      display: flex; align-items: center; gap: 6px;
    }
    .pdo-scanning-dot {
      display: inline-block;
      width: 6px; height: 6px;
      border-radius: 50%;
      background: var(--lp-teal);
      animation: pulse-dot 1.2s ease-in-out infinite;
    }

    /* Pulse date picker bar */
    .pulse-date-bar {
      display: flex;
      gap: 4px;
      padding: 7px 10px 8px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .pulse-date-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.03em;
      padding: 3px 0;
      cursor: pointer;
      transition: border-color 0.13s, color 0.13s, background 0.13s;
      flex: 1;
      text-align: center;
    }

    .pulse-date-btn:hover {
      border-color: var(--lp-teal-border);
      color: var(--lp-teal);
    }

    .pulse-date-btn.active {
      border-color: var(--lp-teal);
      color: var(--lp-teal);
      background: rgba(1, 191, 165, 0.08);
    }

    /* Pulse expand-to-fullscreen button */
    .pulse-expand-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 6px;
      cursor: pointer;
      transition: border-color 0.13s, color 0.13s;
      line-height: 1;
      display: flex;
      align-items: center;
    }

    .pulse-expand-btn:hover,
    .pulse-expand-btn:focus-visible {
      border-color: var(--lp-teal-border);
      color: var(--lp-teal);
      outline: none;
    }

    /* Pulse section labels */
    .pulse-section-label {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: var(--text-dim);
      padding: 10px 2px 5px;
      opacity: 0.7;
    }

    .pulse-section-label:first-child { padding-top: 4px; }

    /* Stats 2-col grid (retained for full dashboard use) */
    .pulse-stats-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 5px;
      margin-bottom: 2px;
    }

    /* ── Glanceable flag list (sidebar only) ─────────────────────────────── */
    .pulse-flag-list {
      display: flex;
      flex-direction: column;
      gap: 2px;
      margin-bottom: 4px;
    }

    .pulse-flag-row {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 9px 8px;
      border-radius: var(--radius-xs);
      cursor: pointer;
      transition: background 0.12s, filter 0.12s;
      position: relative;
      border-left: 2px solid transparent;
      animation: pulseCardIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
    .pulse-flag-row:hover  { filter: brightness(1.15); }
    .pulse-flag-row:focus-visible { outline: 1px solid var(--lp-teal-border); outline-offset: 1px; }

    .pulse-flag-row.red   { background: rgba(239,68,68,0.06);  border-left-color: var(--red);   }
    .pulse-flag-row.amber { background: rgba(245,158,11,0.06); border-left-color: var(--amber); }

    .pulse-flag-sev-dot {
      flex-shrink: 0;
      width: 6px; height: 6px;
      border-radius: 50%;
    }
    .pulse-flag-row.red   .pulse-flag-sev-dot { background: var(--red);   }
    .pulse-flag-row.amber .pulse-flag-sev-dot { background: var(--amber); }

    .pulse-flag-icon {
      flex-shrink: 0;
      font-size: 11px;
      line-height: 1;
    }

    /* label-wrap takes flex:1 so the label+sub stack together occupies the middle space */
    .pulse-flag-label-wrap {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .pulse-flag-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* Sub-text shown on alerts (e.g. "Target: £1.80") */
    .pulse-flag-sub {
      font-size: 9.5px;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* Dismiss button — appears on alert rows only */
    .pulse-flag-dismiss {
      flex-shrink: 0;
      width: 16px; height: 16px;
      background: none;
      border: none;
      color: var(--text-dim);
      font-size: 9px;
      cursor: pointer;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 3px;
      opacity: 0;
      transition: opacity 0.12s, background 0.12s;
    }
    .pulse-flag-row:hover .pulse-flag-dismiss { opacity: 1; }
    .pulse-flag-dismiss:hover { background: rgba(239,68,68,0.2); color: var(--red); }

    .pulse-flag-val {
      flex-shrink: 0;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: -0.01em;
    }
    .pulse-flag-row.red   .pulse-flag-val { color: var(--red);   }
    .pulse-flag-row.amber .pulse-flag-val { color: var(--amber); }

    .pulse-flag-bar {
      position: absolute;
      bottom: 0; left: 2px; right: 2px;
      height: 2px;
      background: rgba(255,255,255,0.07);
      border-radius: 0 0 2px 2px;
      overflow: hidden;
    }
    .pulse-flag-bar-fill {
      height: 100%;
      width: 100%;
      border-radius: 2px;
      transform-origin: left center;
      transform: scaleX(0);
      transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .pulse-flag-bar-fill.red   { background: var(--red);   }
    .pulse-flag-bar-fill.amber { background: var(--amber); }
    .pulse-flag-bar-fill.teal  { background: var(--lp-teal); }

    .pulse-flag-green-note {
      font-size: 10px;
      color: var(--lp-teal);
      opacity: 0.75;
      padding: 3px 2px 6px;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .pulse-flag-count {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--red);
      color: #fff;
      font-size: 9px;
      font-weight: 700;
      border-radius: 3px;
      padding: 1px 5px;
      margin-left: 5px;
      vertical-align: middle;
      line-height: 1.4;
    }

    /* "N more -> full dashboard" overflow button */
    .pulse-more-link {
      display: block;
      width: 100%;
      padding: 7px 10px;
      background: rgba(1,191,165,0.06);
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-xs);
      color: var(--lp-teal);
      font-size: 10px;
      font-weight: 600;
      text-align: center;
      cursor: pointer;
      transition: background 0.12s;
      margin-top: 4px;
    }
    .pulse-more-link:hover { background: rgba(1,191,165,0.13); }
    /* ──────────────────────────────────────────────────────────────────────── */

    /* Buyer row entrance stagger */
    @keyframes buyerRowIn {
      from { opacity: 0; transform: translateX(-6px); }
      to   { opacity: 1; transform: translateX(0); }
    }
    .pulse-buyer-item {
      animation: buyerRowIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* Buyers stale badge — shown when data came from localStorage, cleared when live data arrives */
    .pulse-buyers-stale {
      font-size: 9px;
      color: var(--text-dim);
      text-align: right;
      padding: 5px 2px 0;
      letter-spacing: 0.06em;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 4px;
      opacity: 0.7;
    }
    .pulse-buyers-stale svg {
      animation: spin 1.4s linear infinite;
      flex-shrink: 0;
    }

    /* ---- Spend widget (compact preview, above alerts) ---- */
    #pulse-spend-widget {
      padding: 10px 10px 8px;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      flex-shrink: 0;
    }
    #pulse-spend-widget.sw-hidden { display: none; }
    .sw-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 8px;
    }
    .sw-header-title {
      font-size: 9.5px; font-weight: 700;
      letter-spacing: 0.07em; text-transform: uppercase;
      color: var(--text-dim);
    }
    .sw-header-link {
      font-size: 9px; color: var(--lp-teal); text-decoration: none;
      opacity: 0.7; transition: opacity 0.12s;
    }
    .sw-header-link:hover { opacity: 1; }
    .sw-chips {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 5px; margin-bottom: 8px;
    }
    .sw-chip {
      background: var(--surface-2); border: 1px solid var(--border);
      border-radius: 7px; padding: 5px 6px;
    }
    .sw-chip-val {
      font-size: 12.5px; font-weight: 700;
      color: var(--text); letter-spacing: -0.02em; line-height: 1.2;
    }
    .sw-chip-label {
      font-size: 8px; color: var(--text-dim);
      text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px;
    }
    .sw-vert-list { display: flex; flex-direction: column; gap: 4px; }
    .sw-vert-row {
      display: grid; grid-template-columns: 36px 1fr 42px;
      align-items: center; gap: 6px;
    }
    .sw-vert-code {
      font-weight: 700; color: var(--text-muted);
      font-size: 9.5px; letter-spacing: 0.02em;
    }
    .sw-vert-bar-track {
      height: 4px; background: rgba(255,255,255,0.06);
      border-radius: 2px; overflow: hidden;
    }
    .sw-vert-bar-fill { height: 100%; border-radius: 2px; }
    .sw-vert-cpl {
      text-align: right; font-weight: 700; font-size: 9.5px;
    }
    .sw-footer-link {
      display: block; text-align: center; font-size: 9px;
      color: var(--text-dim); text-decoration: none;
      margin-top: 7px; opacity: 0.5; transition: opacity 0.12s;
    }
    .sw-footer-link:hover { opacity: 1; color: var(--lp-teal); }
    .sw-skeleton { display: flex; gap: 5px; }
    .sw-skeleton-chip {
      flex: 1; height: 42px;
      background: linear-gradient(90deg, var(--surface-2) 25%, rgba(255,255,255,0.04) 50%, var(--surface-2) 75%);
      background-size: 200% 100%;
      animation: sw-shimmer 1.4s ease-in-out infinite;
      border-radius: 7px;
    }
    @keyframes sw-shimmer { 0%{background-position:200%} 100%{background-position:-200%} }

    /* ---- Alerts strip (always-on, top of pulse-body) ---- */
    #pulse-alerts-strip {
      padding: 8px 10px 6px;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      flex-shrink: 0;
    }
    .pulse-alerts-clear {
      display: flex; align-items: center; gap: 5px;
      font-size: 9.5px; color: var(--lp-teal); opacity: 0.8;
      padding: 2px 0;
    }
    .pulse-alerts-clear svg { flex-shrink: 0; }
    .pulse-alerts-baseline {
      display: flex; align-items: center; gap: 5px;
      font-size: 9.5px; color: var(--amber); opacity: 0.85;
      padding: 2px 0;
    }
    .pulse-alert-card {
      background: rgba(255,255,255,0.03);
      border-radius: var(--radius-sm);
      border-left: 2.5px solid var(--border);
      padding: 6px 8px 6px 9px;
      margin-bottom: 5px;
      position: relative;
    }
    .pulse-alert-card.red   { border-left-color: var(--red);   background: rgba(239,68,68,0.05); }
    .pulse-alert-card.amber { border-left-color: var(--amber); background: rgba(245,158,11,0.05); }
    .pulse-alert-card-top {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 3px;
    }
    .pulse-alert-card-label {
      font-size: 9.5px; font-weight: 600; color: var(--text-primary);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      max-width: 140px;
    }
    .pulse-alert-card.red   .pulse-alert-card-label { color: var(--red); }
    .pulse-alert-card.amber .pulse-alert-card-label { color: var(--amber); }
    .pulse-alert-card-actions {
      display: flex; gap: 4px; flex-shrink: 0; margin-left: 6px;
    }
    .pulse-alert-ask-btn, .pulse-alert-dismiss-btn {
      font-size: 8.5px; padding: 2px 6px; border-radius: 3px;
      border: 1px solid var(--border); background: var(--surface-raised);
      color: var(--text-muted); cursor: pointer; line-height: 1.4;
      transition: all 0.12s;
    }
    .pulse-alert-ask-btn:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }
    .pulse-alert-dismiss-btn:hover { border-color: rgba(255,255,255,0.25); color: var(--text-primary); }
    .pulse-alert-card-interp {
      font-size: 9px; color: var(--text-muted); line-height: 1.45;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .pulse-alert-more-btn {
      font-size: 9px; color: var(--text-dim); cursor: pointer;
      padding: 4px 0 0; display: block; text-align: center;
      opacity: 0.7; border: none; background: none; width: 100%;
    }
    .pulse-alert-more-btn:hover { opacity: 1; color: var(--text-muted); }
    .pulse-alerts-history-link {
      font-size: 8.5px; color: var(--text-dim); cursor: pointer;
      display: block; text-align: right; padding: 4px 0 0;
      opacity: 0.6; background: none; border: none; width: 100%;
    }
    .pulse-alerts-history-link:hover { opacity: 1; color: var(--text-muted); }
    /* History panel */
    #pulse-alerts-history {
      display: none;
      max-height: 200px; overflow-y: auto;
      border-top: 1px solid rgba(255,255,255,0.05);
      padding: 6px 0 0;
    }
    #pulse-alerts-history.open { display: block; }
    .pulse-alert-hist-row {
      font-size: 8.5px; color: var(--text-dim);
      padding: 3px 0;
      border-bottom: 1px solid rgba(255,255,255,0.03);
      display: flex; gap: 5px; align-items: flex-start;
    }
    .pulse-alert-hist-sev {
      flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%;
      margin-top: 2px;
    }
    .pulse-alert-hist-sev.red   { background: var(--red); }
    .pulse-alert-hist-sev.amber { background: var(--amber); }
    .pulse-alert-hist-detail { flex: 1; min-width: 0; }
    .pulse-alert-hist-status {
      flex-shrink: 0; font-size: 7.5px; padding: 1px 4px;
      border-radius: 2px; background: rgba(255,255,255,0.06);
      color: var(--text-dim);
    }
    /* prefers-reduced-motion */
    @media (prefers-reduced-motion: reduce) {
      .pulse-alert-card  { transition: none; }
      .pulse-card,
      .pulse-summary,
      .pulse-healthy,
      .pulse-flag-row    { animation: none !important; opacity: 1 !important; transform: none !important; }
      .pulse-flag-bar-fill { transition: none !important; transform: scaleX(1) !important; }
      .crm-card          { animation: none !important; opacity: 1 !important; transform: none !important; }
      .pulse-more-link   { transition: none; }
    }

    /* Condensed buyer list */
    .pulse-buyer-list {
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      overflow: hidden;
    }
    .pulse-buyer-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      min-width: 0;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      transition: background 0.12s;
    }
    .pulse-buyer-item:last-child { border-bottom: none; }
    .pulse-buyer-item:hover { background: rgba(1, 191, 165, 0.04); }
    .pulse-buyer-item:focus-visible { outline: 1px solid var(--lp-teal-border); outline-offset: -1px; }
    .pulse-buyer-rank {
      font-size: 10px;
      font-weight: 700;
      color: var(--text-dim);
      min-width: 16px;
      text-align: right;
    }
    .pulse-buyer-name {
      flex: 1;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .pulse-buyer-bar-wrap {
      width: 50px;
      height: 3px;
      background: rgba(255,255,255,0.08);
      border-radius: 2px;
      overflow: hidden;
      flex-shrink: 0;
    }
    .pulse-buyer-bar-fill {
      height: 100%;
      border-radius: 2px;
      background: var(--lp-teal);
      transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .pulse-buyer-count {
      font-size: 12px;
      font-weight: 800;
      color: var(--lp-teal);
      min-width: 28px;
      text-align: right;
    }

    /* Skeleton loader */
    @keyframes skel-shimmer {
      0%   { background-position: -300px 0; }
      100% { background-position: 300px 0; }
    }
    .pulse-skeleton-list {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .pulse-skeleton-row {
      height: 32px;
      border-radius: var(--radius-sm);
      background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%);
      background-size: 600px 100%;
      animation: skel-shimmer 1.4s ease-in-out infinite;
    }
    .pulse-skeleton-row:nth-child(2) { animation-delay: 0.1s; width: 88%; }
    .pulse-skeleton-row:nth-child(3) { animation-delay: 0.2s; width: 75%; }
    .pulse-skeleton-row:nth-child(4) { animation-delay: 0.3s; width: 80%; }
    .pulse-skeleton-row:nth-child(5) { animation-delay: 0.4s; width: 65%; }

    .pulse-stat-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 8px 9px;
      transition: filter 0.15s;
      cursor: pointer;
    }

    .pulse-stat-card:hover { filter: brightness(1.14); }
    .pulse-stat-card:focus-visible { outline: 1px solid var(--lp-teal-border); outline-offset: 1px; }

    .pulse-stat-card.red     { border-left: 2.5px solid var(--red);     background: rgba(239, 68, 68, 0.05); }
    .pulse-stat-card.amber   { border-left: 2.5px solid var(--amber);        background: rgba(245, 158, 11, 0.05); }
    .pulse-stat-card.teal    { border-left: 2.5px solid var(--lp-teal); background: rgba(1, 191, 165, 0.04); }
    .pulse-stat-card.neutral { border-left: 2.5px solid rgba(255,255,255,0.15); }

    .pulse-stat-card .pulse-card-label  { font-size: 9px; margin-bottom: 3px; }
    .pulse-stat-card .pulse-card-value  { font-size: 16px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 2px; }
    .pulse-stat-card .pulse-card-sub    { font-size: 9.5px; -webkit-line-clamp: 1; }

    .pulse-stat-card.red     .pulse-card-value { color: var(--red); }
    .pulse-stat-card.amber   .pulse-card-value { color: var(--amber); }
    .pulse-stat-card.teal    .pulse-card-value { color: var(--lp-teal); }
    .pulse-stat-card.neutral .pulse-card-value { color: var(--text-muted); }

    /* Mini progress bar inside stat card */
    .pulse-stat-bar {
      height: 3px;
      border-radius: 2px;
      background: rgba(255,255,255,0.07);
      margin-top: 6px;
      overflow: hidden;
    }

    .pulse-stat-bar-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* ============================================================
       PDO SKELETON LOADERS
       ============================================================ */
    @keyframes pdo-shimmer {
      0%   { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }
    .pdo-skel {
      background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
      background-size: 200% 100%;
      animation: pdo-shimmer 1.4s ease-in-out infinite;
      border-radius: 6px;
    }
    .pdo-skel-kpi-strip {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 14px;
    }
    .pdo-skel-kpi {
      height: 56px;
      border-radius: 8px;
    }
    .pdo-skel-filter {
      height: 32px;
      margin-bottom: 16px;
      border-radius: 6px;
    }
    .pdo-skel-divider {
      height: 42px;
      margin-bottom: 6px;
      border-radius: 8px;
    }
    .pdo-skel-divider:nth-child(2) { animation-delay: 0.08s; }
    .pdo-skel-divider:nth-child(3) { animation-delay: 0.16s; }
    .pdo-skel-divider:nth-child(4) { animation-delay: 0.24s; }
    .pdo-skel-divider:nth-child(5) { animation-delay: 0.32s; }
    .pdo-skel-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 12px;
      margin-bottom: 12px;
    }
    .pdo-skel-card {
      height: 120px;
      border-radius: 10px;
    }
    .pdo-skel-card:nth-child(2) { animation-delay: 0.06s; }
    .pdo-skel-card:nth-child(3) { animation-delay: 0.12s; }
    .pdo-skel-card:nth-child(4) { animation-delay: 0.18s; }
    .pdo-skel-row {
      height: 44px;
      margin-bottom: 6px;
      border-radius: 6px;
    }
    .pdo-skel-row:nth-child(2) { animation-delay: 0.06s; width: 95%; }
    .pdo-skel-row:nth-child(3) { animation-delay: 0.12s; width: 88%; }
    .pdo-skel-row:nth-child(4) { animation-delay: 0.18s; width: 92%; }
    .pdo-skel-row:nth-child(5) { animation-delay: 0.24s; width: 85%; }

    /* ============================================================
       CARD DETAIL POPUP
       ============================================================ */
    #card-detail-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.55);
      z-index: 1400;
      backdrop-filter: blur(2px);
    }
    #card-detail-backdrop.visible { display: block; }
    #card-detail-modal {
      display: none;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -48%);
      width: min(480px, 94vw);
      max-height: 82vh;
      overflow-y: auto;
      background: var(--surface);
      border: 1px solid var(--lp-teal-border);
      border-radius: 12px;
      z-index: 1401;
      box-shadow: 0 24px 60px rgba(0,0,0,0.6);
      padding: 20px 22px 22px;
      transition: transform 0.18s cubic-bezier(0.16,1,0.3,1), opacity 0.15s;
      opacity: 0;
    }
    #card-detail-modal.visible {
      display: block;
      opacity: 1;
      transform: translate(-50%, -50%);
    }
    .card-detail-close {
      position: absolute;
      top: 12px;
      right: 14px;
      background: none;
      border: none;
      color: var(--text-dim);
      font-size: 20px;
      cursor: pointer;
      line-height: 1;
      padding: 2px 6px;
      border-radius: 4px;
      transition: color 0.12s, background 0.12s;
    }
    .card-detail-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
    .cd-platform-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
    .cd-plat-badge {
      display: inline-flex; align-items: center; justify-content: center;
      width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
    }
    .cd-vert-tag {
      font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
      color: var(--lp-teal); background: rgba(1,191,165,0.10);
      border: 1px solid rgba(1,191,165,0.22); border-radius: 3px; padding: 2px 6px;
    }
    .cd-buyer-name {
      font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
      color: var(--text); margin-bottom: 2px; line-height: 1.2;
    }
    .cd-sid-row { font-size: 10px; color: var(--text-dim); font-family: monospace; margin-bottom: 16px; }
    .cd-metrics-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px;
    }
    .cd-metric {
      background: rgba(255,255,255,0.03); border: 1px solid var(--border);
      border-radius: 8px; padding: 10px 12px;
    }
    .cd-metric-val { font-size: 20px; font-weight: 800; letter-spacing: -0.025em; line-height: 1; }
    .cd-metric-label { font-size: 9px; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
    .cd-target-row {
      background: rgba(255,255,255,0.02); border: 1px solid var(--border);
      border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
      display: flex; align-items: center; justify-content: space-between; gap: 10px;
    }
    .cd-history-btn {
      width: 100%; padding: 10px; border-radius: 8px;
      background: rgba(1,191,165,0.08); border: 1px solid var(--lp-teal-border);
      color: var(--lp-teal); font-size: 12px; font-weight: 600; cursor: pointer;
      transition: background 0.12s;
    }
    .cd-history-btn:hover { background: rgba(1,191,165,0.16); }

    /* ============================================================
       VERTICAL BUYER POPUP
       ============================================================ */
    #vert-popup {
      position: fixed;
      z-index: 1200;
      background: var(--surface);
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      padding: 12px 14px 10px;
      width: 220px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5);
      opacity: 0;
      transform: translateY(4px);
      transition: opacity 0.15s, transform 0.15s;
      pointer-events: none;
    }
    #vert-popup.visible {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .vert-popup-title {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      color: var(--lp-teal);
      margin-bottom: 8px;
    }
    .vert-popup-row {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 0;
      border-bottom: 1px solid rgba(255,255,255,0.04);
    }
    .vert-popup-row:last-of-type { border-bottom: none; }
    .vert-popup-buyer { flex: 1; min-width: 0; font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .vert-popup-sold  { font-size: 11px; font-weight: 700; color: var(--lp-teal); }
    .vert-popup-close {
      position: absolute;
      top: 8px; right: 10px;
      background: none; border: none;
      color: var(--text-dim); font-size: 14px; line-height: 1;
      cursor: pointer; padding: 2px 4px;
    }
    .vert-popup-close:hover { color: var(--text); }
    .vert-popup-close:focus-visible { outline: 1px solid var(--lp-teal-border); border-radius: 3px; }
    .vert-popup-scanning {
      font-size: 11px;
      color: var(--text-muted);
      padding: 4px 0;
    }

    /* ============================================================
       LOGIN OVERLAY
    ============================================================ */
    #login-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 10, 8, 0.96);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      z-index: 9000;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .login-card {
      background: var(--surface);
      border: 1px solid var(--lp-teal-border);
      border-radius: 16px;
      padding: 40px 36px 36px;
      width: 100%;
      max-width: 360px;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
      animation: msgIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .login-logo {
      display: block;
      height: 22px;
      width: auto;
      margin: 0 auto 28px;
    }

    .login-title {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
      text-align: center;
      margin-bottom: 6px;
    }

    .login-sub {
      font-size: 12.5px;
      color: var(--text-muted);
      text-align: center;
      margin-bottom: 26px;
      line-height: 1.5;
    }

    .login-field {
      width: 100%;
      background: rgba(0, 0, 0, 0.28);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text);
      font-family: var(--font-body);
      font-size: 15px;
      padding: 11px 14px;
      outline: none;
      letter-spacing: var(--tracking);
      margin-bottom: 12px;
      transition: border-color 0.13s;
    }

    .login-field:focus { border-color: var(--lp-teal-border); }

    .login-btn {
      width: 100%;
      background: var(--lp-teal);
      border: none;
      border-radius: var(--radius-sm);
      color: var(--lp-green);
      font-family: var(--font-body);
      font-size: 14.5px;
      font-weight: 700;
      letter-spacing: var(--tracking);
      padding: 12px;
      cursor: pointer;
      transition: opacity 0.15s, transform 0.13s;
    }

    .login-btn:hover { opacity: 0.88; }
    .login-btn:active { transform: scale(0.98); }
    .login-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    .login-error {
      font-size: 12.5px;
      color: var(--red);
      text-align: center;
      margin-top: 12px;
      min-height: 18px;
      letter-spacing: var(--tracking);
    }

    /* ============================================================
       PROFILE PICKER OVERLAY
    ============================================================ */
    #profile-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 10, 8, 0.96);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      z-index: 8900;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .profile-card {
      background: var(--surface);
      border: 1px solid var(--lp-teal-border);
      border-radius: 16px;
      padding: 36px 32px 32px;
      width: 100%;
      max-width: 400px;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
      animation: msgIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .profile-title {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
      text-align: center;
      margin-bottom: 6px;
    }

    .profile-sub {
      font-size: 12.5px;
      color: var(--text-muted);
      text-align: center;
      margin-bottom: 20px;
      line-height: 1.5;
    }

    /* Typeahead wrapper */
    .profile-typeahead-wrap {
      position: relative;
      width: 100%;
    }

    .profile-dropdown {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      background: var(--surface-2);
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius-sm);
      box-shadow: 0 8px 32px rgba(0,0,0,0.45);
      z-index: 10;
      max-height: 240px;
      overflow-y: auto;
    }

    .profile-dropdown::-webkit-scrollbar { width: 4px; }
    .profile-dropdown::-webkit-scrollbar-track { background: transparent; }
    .profile-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

    .profile-drop-item {
      display: flex;
      align-items: center;
      padding: 10px 14px;
      cursor: pointer;
      transition: background 0.1s;
      border-bottom: 1px solid var(--border-soft);
    }

    .profile-drop-item:last-child { border-bottom: none; }

    .profile-drop-item:hover,
    .profile-drop-item.active {
      background: rgba(1, 191, 165, 0.1);
    }

    .profile-drop-name {
      font-size: 13.5px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
      letter-spacing: var(--tracking);
    }

    .profile-drop-role {
      font-size: 11.5px;
      color: var(--text-muted);
      margin-left: 8px;
    }

    /* Profile identity in sidebar footer */
    .profile-identity {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--border-soft);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .profile-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--lp-teal);
      color: #002620;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.02em;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .profile-identity-text {
      flex: 1;
      font-size: 11.5px;
      color: var(--text-muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .profile-identity-name {
      font-weight: 600;
      color: var(--text);
    }

    .profile-switch-btn {
      font-size: 10.5px;
      font-family: var(--font-body);
      color: var(--lp-teal);
      background: none;
      border: none;
      padding: 2px 4px;
      cursor: pointer;
      letter-spacing: var(--tracking);
      opacity: 0.75;
      flex-shrink: 0;
    }

    .profile-switch-btn:hover { opacity: 1; }

    /* ============================================================
       PHASE 4 — Sub-tabs, Home section, Operations/Finance stubs
    ============================================================ */

    /* ============================================================
       PDO MAIN — right content area
    ============================================================ */
    .pdo-main {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* Keep sub-tab styles hidden — sub-tabs removed, views are now flat */
    .pdo-sub-tabs { display: none !important; }
    .pdo-sub-btn { display: none !important; }

    /* Alert chip in header — persistent north star */
    .pdo-alert-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 9px 3px 7px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.13s, border-color 0.13s;
      flex-shrink: 0;
      white-space: nowrap;
    }
    .pdo-alert-chip.clear {
      background: rgba(1,191,165,0.08);
      border: 1px solid var(--lp-teal-border);
      color: var(--lp-teal);
    }
    .pdo-alert-chip.amber {
      background: rgba(245,158,11,0.10);
      border: 1px solid rgba(245,158,11,0.3);
      color: var(--amber);
    }
    .pdo-alert-chip.red {
      background: rgba(239,68,68,0.10);
      border: 1px solid rgba(239,68,68,0.3);
      color: var(--red);
    }
    .pdo-alert-chip-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: currentColor;
      animation: pulse 2.2s ease-in-out infinite;
    }

    /* Horizontal vertical pill filter bar (replaces 118px left sidebar) */
    /* Performance tab two-column layout */
    .pdo-perf-layout {
      display: flex;
      gap: 16px;
      align-items: flex-start;
    }
    .pdo-perf-main {
      flex: 1;
      min-width: 0;
    }
    .pdo-vert-sidebar {
      width: 148px;
      flex-shrink: 0;
      position: sticky;
      top: 0;
      max-height: calc(100vh - 220px);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .pdo-vert-sidebar::-webkit-scrollbar { width: 2px; }
    .pdo-vert-sidebar::-webkit-scrollbar-thumb { background: rgba(1,191,165,0.15); border-radius: 2px; }
    .pdo-vert-sidebar-label {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-dim);
      padding: 0 8px 6px;
    }
    .pdo-vert-sidebar-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      width: 100%;
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid transparent;
      background: none;
      color: var(--text-muted);
      text-align: left;
      cursor: pointer;
      transition: all 0.12s;
    }
    .pdo-vert-sidebar-btn:hover {
      background: rgba(255,255,255,0.04);
      border-color: var(--border);
      color: var(--text);
    }
    .pdo-vert-sidebar-btn.active {
      background: rgba(1,191,165,0.1);
      border-color: rgba(1,191,165,0.3);
      color: var(--lp-teal);
    }
    .pdo-vert-sidebar-count {
      font-size: 10px;
      color: var(--text-dim);
      flex-shrink: 0;
      font-variant-numeric: tabular-nums;
    }
    .pdo-vert-sidebar-btn.active .pdo-vert-sidebar-count {
      color: rgba(1,191,165,0.6);
    }

    .pdo-vert-pill-bar {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      padding: 0 0 10px;
    }
    .pdo-vert-pill {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 20px;
      border: 1px solid var(--border);
      background: none;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.12s;
      white-space: nowrap;
    }
    .pdo-vert-pill:hover { border-color: var(--lp-teal-border); color: var(--text); }
    .pdo-vert-pill.active {
      background: rgba(1,191,165,0.12);
      border-color: var(--lp-teal);
      color: var(--lp-teal);
      font-weight: 700;
    }
    .pdo-vert-pill-dot {
      width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
    }

    /* Home section — KPI strip */
    .pdo-home-kpi-strip {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 20px;
    }
    @media (max-width: 800px) { .pdo-home-kpi-strip { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 480px) { .pdo-home-kpi-strip { grid-template-columns: 1fr 1fr; } }
    .pdo-home-kpi {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
      transition: border-color 0.15s;
    }
    .pdo-home-kpi:hover { border-color: var(--lp-teal-border); }
    /* Primary hero KPI — first tile in a strip, gets elevated treatment */
    .pdo-kpi-primary {
      background: rgba(1, 191, 165, 0.07) !important;
      border-color: rgba(1, 191, 165, 0.22) !important;
    }
    .pdo-kpi-primary .pdo-kpi-value,
    .pdo-kpi-primary .pdo-home-kpi .pdo-kpi-value { font-size: 30px; }
    .pdo-kpi-sub-note {
      font-size: 9px;
      color: var(--text-dim);
      margin-top: 3px;
      letter-spacing: 0.02em;
      line-height: 1.3;
    }

    /* Reusable section spacing classes */
    .pdo-section    { margin-bottom: var(--space-lg); }
    .pdo-section-sm { margin-bottom: var(--space-md); }

    /* Home section panels */
    .pdo-home-section { margin-bottom: var(--space-lg); }
    .pdo-home-section-title {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 10px;
    }

    /* Alert cards in home view */
    .pdo-alert-card {
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      margin-bottom: 8px;
    }
    .pdo-alert-card.red   { background: rgba(239,68,68,0.06);  border: 1px solid rgba(239,68,68,0.25); }
    .pdo-alert-card.amber { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.25); }
    .pdo-alert-sev {
      font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
      margin-right: 8px;
    }
    .pdo-alert-sev.red   { color: var(--red); }
    .pdo-alert-sev.amber { color: var(--amber); }
    .pdo-alert-type { font-size: 13px; font-weight: 600; color: var(--text); }
    .pdo-alert-campaign { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
    .pdo-alert-interp { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; }
    .pdo-alert-action { font-size: 11px; color: var(--lp-teal); margin-top: 5px; opacity: 0.85; }

    /* CPL traffic light grid */
    .pdo-cpl-grid-table { width: 100%; border-collapse: collapse; }
    .pdo-cpl-grid-table th {
      text-align: left; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.05em; color: var(--text-dim); padding: 3px 8px 6px;
      border-bottom: 1px solid var(--border);
    }
    .pdo-cpl-grid-table th:not(:first-child) { text-align: right; }
    .pdo-cpl-grid-table td { padding: 9px 8px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); }
    .pdo-cpl-grid-table td:not(:first-child) { text-align: right; }
    .pdo-cpl-grid-table tr:last-child td { border-bottom: none; }

    /* Operations / Intelligence coming-soon stubs */
    .pdo-coming-soon {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      padding: 48px 24px; color: var(--text-dim); font-size: 14px; text-align: center; gap: 8px;
    }
    .pdo-coming-soon strong { color: var(--text-muted); font-size: 15px; font-weight: 600; }

    /* Generic ops/perf table base */
    .pdo-data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
    .pdo-data-table th {
      font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
      color: var(--text-dim); padding: 4px 10px 8px; border-bottom: 1px solid var(--border);
      text-align: left; white-space: nowrap;
    }
    .pdo-data-table th:not(:first-child) { text-align: right; }
    .pdo-data-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
    .pdo-data-table td:not(:first-child) { text-align: right; }
    .pdo-data-table tr:last-child td { border-bottom: none; }
    .pdo-data-table tr:hover td { background: rgba(255,255,255,0.02); }
    .pdo-table-wrap { overflow-x: auto; }

    /* Status badges */
    .pdo-status-badge {
      display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.05em; padding: 2px 6px; border-radius: 3px;
    }
    .pdo-status-badge.active  { background: rgba(1,191,165,0.15);  color: var(--lp-teal); }
    .pdo-status-badge.paused  { background: rgba(245,158,11,0.15); color: var(--amber); }
    .pdo-status-badge.no_spend { background: rgba(255,255,255,0.06); color: var(--text-dim); }
    .pdo-status-badge.green   { background: rgba(1,191,165,0.15);  color: var(--lp-teal); }
    .pdo-status-badge.amber   { background: rgba(245,158,11,0.15); color: var(--amber); }
    .pdo-status-badge.red     { background: rgba(239,68,68,0.15);  color: var(--red); }

    /* Search input for ops tables */
    .pdo-search-input {
      width: 100%; padding: 8px 12px; background: var(--surface-2);
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: 13px; margin-bottom: 12px;
      font-family: var(--font-body);
    }
    .pdo-search-input:focus { outline: none; border-color: var(--lp-teal-border); }
    .pdo-search-input::placeholder { color: var(--text-dim); }

    /* CPL targets modal */
    .pdo-modal-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999;
      display: flex; align-items: center; justify-content: center; padding: 20px;
    }
    .pdo-modal-box {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 24px; width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto;
    }
    .pdo-modal-header {
      display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
    }
    .pdo-modal-header h3 { font-size: 15px; font-weight: 700; }
    .pdo-modal-close {
      background: none; border: none; color: var(--text-muted); font-size: 18px;
      cursor: pointer; line-height: 1; padding: 2px 6px;
    }
    .pdo-modal-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
    .pdo-modal-add-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
    .pdo-modal-input {
      flex: 1; min-width: 80px; padding: 7px 10px; background: var(--surface-2);
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: 13px; font-family: var(--font-body);
    }
    .pdo-modal-input:focus { outline: none; border-color: var(--lp-teal-border); }
    .pdo-inline-edit {
      background: transparent; border: 1px solid transparent; border-radius: 4px;
      color: var(--text); font-size: 13px; width: 70px; text-align: right; padding: 2px 6px;
      font-family: var(--font-body);
    }
    .pdo-inline-edit:hover { border-color: var(--border); }
    .pdo-inline-edit:focus { outline: none; border-color: var(--lp-teal-border); background: var(--surface-2); }

    /* Finance table */
    .pdo-finance-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
    .pdo-finance-table th {
      font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
      color: var(--text-dim); padding: 4px 8px 8px; border-bottom: 1px solid var(--border);
      white-space: nowrap; text-align: right;
    }
    .pdo-finance-table th:first-child, .pdo-finance-table th:nth-child(2) { text-align: left; }
    .pdo-finance-table td { padding: 8px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); text-align: right; }
    .pdo-finance-table td:first-child, .pdo-finance-table td:nth-child(2) { text-align: left; }
    .pdo-finance-table tr:last-child td { border-bottom: none; }
    .pdo-val-red { color: var(--red); font-weight: 600; }
    .pdo-val-green { color: var(--lp-teal); font-weight: 600; }

    /* Charts grid for volume trends */
    .pdo-charts-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
    }
    .pdo-chart-card {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 14px 16px;
    }
    .pdo-chart-card h4 { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
    .pdo-chart-canvas-wrap { position: relative; height: 110px; }

    /* Panel header with controls */
    .pdo-panel-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
    }
    .pdo-panel-header h3 { font-size: 13px; font-weight: 700; color: var(--text); }
    .pdo-panel-select {
      background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text); font-size: 12px; padding: 5px 10px; cursor: pointer;
      font-family: var(--font-body);
    }
    .pdo-panel-btn {
      background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
      color: var(--text-muted); font-size: 12px; padding: 5px 12px; cursor: pointer;
      transition: border-color 0.13s, color 0.13s;
    }
    .pdo-panel-btn:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }

    /* ---- Phase 4 mobile CSS pass ---- */
    @media (max-width: 680px) {
      /* PDO overlay: full screen on mobile */
      .pdo-overlay-inner {
        width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
      }

      /* Collapse sub-tab rows to horizontal scroll on mobile */
      .pdo-sub-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
      }
      .pdo-sub-btn { font-size: 10px; padding: 5px 10px; }

      /* KPI strip: 2 cols on mobile */
      .pdo-home-kpi-strip {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
      }

      /* Tables: horizontal scroll */
      .pdo-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      .pdo-data-table th, .pdo-data-table td { font-size: 11px; padding: 6px 6px; }

      /* Finance monthly summary: stack on mobile */
      .pdo-finance-months { flex-direction: column; }

      /* Modal: full width on mobile */
      .pdo-modal-box {
        width: calc(100vw - 24px) !important;
        max-width: 100% !important;
        margin: 12px !important;
        padding: 18px !important;
      }

      /* Panel header wrapping */
      .pdo-panel-header { flex-wrap: wrap; }
    }

    /* ============================================================
       CRM — PHASE 2 EXPANSION
       Covers: Sales Pipeline, Team Dashboard, Call Log,
               Nurture Sequences, Xero P&L, User Management
    ============================================================ */

    /* --- Shared CRM primitives --- */
    .crm-title {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
      margin-bottom: 18px;
    }
    .crm-loading {
      padding: 48px 0;
      text-align: center;
      color: var(--text-muted);
      font-size: 13px;
    }
    .crm-error {
      padding: 32px;
      text-align: center;
      color: var(--red);
      font-size: 13px;
      background: rgba(239, 68, 68, 0.06);
      border: 1px solid rgba(239, 68, 68, 0.2);
      border-radius: var(--radius-sm);
    }
    .crm-empty {
      padding: 32px;
      text-align: center;
      color: var(--text-muted);
      font-size: 13px;
      border: 1px dashed var(--border);
      border-radius: var(--radius-sm);
    }
    .crm-empty-col {
      padding: 20px 0;
      text-align: center;
      color: var(--text-muted);
      font-size: 12px;
      font-style: italic;
    }
    .crm-stub-banner {
      background: rgba(245, 158, 11, 0.08);
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-radius: var(--radius-sm);
      color: var(--amber);
      font-size: 12px;
      padding: 10px 14px;
      margin-bottom: 16px;
      line-height: 1.5;
    }

    /* --- KPI strip (shared across CRM + Team) --- */
    .crm-kpi-strip {
      display: flex;
      gap: 10px;
      margin-bottom: 18px;
      flex-wrap: wrap;
    }
    .crm-kpi {
      flex: 1;
      min-width: 120px;
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .crm-kpi-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      opacity: 0.75;
      color: inherit;
    }
    .crm-kpi-value {
      font-size: 20px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: inherit;
    }

    /* --- Top row: vert tabs + flow toggle --- */
    .crm-top-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    /* --- Vertical filter tabs --- */
    .crm-vert-tabs {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
    }
    .crm-vert-tab {
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: 20px;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      padding: 4px 12px;
      cursor: pointer;
      transition: border-color 0.12s, color 0.12s, background 0.12s;
      font-family: var(--font-body);
    }
    .crm-vert-tab:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }
    .crm-vert-tab.active {
      background: var(--lp-teal-soft);
      border-color: var(--lp-teal-border);
      color: var(--lp-teal);
    }

    /* --- Inbound / Outbound flow toggle --- */
    .crm-flow-toggle {
      display: flex;
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
      margin-left: auto;
    }
    .crm-flow-btn {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      padding: 5px 14px;
      cursor: pointer;
      font-family: var(--font-body);
      transition: background 0.12s, color 0.12s;
    }
    .crm-flow-btn.active {
      background: var(--lp-teal-soft);
      color: var(--lp-teal);
    }
    .crm-flow-btn:hover:not(.active) { color: var(--text); }

    /* --- Kanban / Table view toggle --- */
    .crm-view-toggle {
      display: flex;
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
    }
    .crm-view-btn {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      padding: 5px 14px;
      cursor: pointer;
      font-family: var(--font-body);
      transition: background 0.12s, color 0.12s;
    }
    .crm-view-btn.active {
      background: var(--lp-teal-soft);
      color: var(--lp-teal);
    }
    .crm-view-btn:hover:not(.active) { color: var(--text); }

    /* --- Filter bar --- */
    .crm-filter-bar {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      margin-bottom: 18px;
      flex-wrap: wrap;
    }
    .crm-filter-label {
      display: block;
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 4px;
    }
    .crm-select {
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text);
      font-size: 12px;
      font-family: var(--font-body);
      padding: 6px 10px;
      cursor: pointer;
      transition: border-color 0.12s;
      min-width: 140px;
    }
    .crm-select:focus { outline: none; border-color: var(--lp-teal-border); }
    .crm-search {
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text);
      font-size: 12px;
      font-family: var(--font-body);
      padding: 6px 10px;
      transition: border-color 0.12s;
      min-width: 160px;
    }
    .crm-search::placeholder { color: var(--text-muted); }
    .crm-search:focus { outline: none; border-color: var(--lp-teal-border); }
    .crm-add-btn {
      background: var(--lp-teal);
      border: none;
      border-radius: var(--radius-xs);
      color: var(--lp-green);
      font-size: 12px;
      font-weight: 700;
      font-family: var(--font-body);
      padding: 7px 14px;
      cursor: pointer;
      letter-spacing: -0.01em;
      transition: opacity 0.12s, transform 0.1s;
      white-space: nowrap;
    }
    .crm-add-btn:hover { opacity: 0.88; transform: translateY(-1px); }
    .crm-add-btn:active { transform: translateY(0); opacity: 1; }

    /* --- Kanban board --- */
    .crm-kanban {
      display: flex;
      gap: 12px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 8px;
      align-items: flex-start;
    }
    .crm-col {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 12px;
      min-width: 180px;
      flex: 0 0 180px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .crm-col-header {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 4px;
    }
    .crm-col-count {
      font-weight: 500;
      opacity: 0.7;
    }

    /* --- Lead card --- */
    .crm-card {
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 12px;
      cursor: pointer;
      transition: border-color 0.12s, transform 0.1s;
    }
    .crm-card:hover {
      border-color: var(--lp-teal-border);
      transform: translateY(-1px);
    }
    .crm-card-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }
    .crm-card-company {
      font-size: 13px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
      flex: 1;
      min-width: 0;
      line-height: 1.3;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .crm-card-contact {
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 2px;
    }
    .crm-card-source {
      font-size: 10px;
      color: var(--text-muted);
      opacity: 0.7;
      margin-bottom: 4px;
    }
    .crm-card-value {
      font-size: 12px;
      font-weight: 600;
      color: var(--lp-teal);
      margin-bottom: 6px;
    }
    .crm-card-bottom {
      display: flex;
      flex-direction: column;
      gap: 2px;
      margin-bottom: 6px;
    }
    .crm-card-assignee {
      font-size: 10px;
      color: var(--text-muted);
    }
    .crm-suggested {
      font-size: 10px;
      color: var(--amber);
      font-style: italic;
    }
    .crm-card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      margin-top: 4px;
    }
    .crm-card-date {
      font-size: 10px;
      color: var(--text-muted);
      opacity: 0.7;
    }

    /* --- Tag badges (Platinum / Gold / None) --- */
    .crm-tag-platinum {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      background: rgba(168, 85, 247, 0.15);
      color: #a855f7;
      border: 1px solid rgba(168, 85, 247, 0.35);
      border-radius: 4px;
      padding: 2px 6px;
      white-space: nowrap;
    }
    .crm-tag-gold {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      background: rgba(245, 158, 11, 0.12);
      color: var(--amber);
      border: 1px solid rgba(245, 158, 11, 0.3);
      border-radius: 4px;
      padding: 2px 6px;
      white-space: nowrap;
    }
    .crm-tag-none {
      font-size: 9px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      background: transparent;
      color: var(--text-muted);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 2px 6px;
      white-space: nowrap;
    }

    /* --- Vertical badge (shared) --- */
    .crm-vert-badge {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      border-radius: 4px;
      padding: 2px 7px;
      white-space: nowrap;
    }

    /* --- CRM table --- */
    .crm-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .crm-table th {
      text-align: left;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-muted);
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
    }
    .crm-table td {
      padding: 8px 10px;
      border-bottom: 1px solid var(--border-soft);
      color: var(--text);
      vertical-align: middle;
    }
    .crm-table tr:last-child td { border-bottom: none; }
    .crm-table tr:hover td { background: rgba(255,255,255,0.02); }

    /* --- Team AM grid --- */
    .crm-am-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 14px;
    }
    .crm-am-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px;
      transition: border-color 0.12s;
    }
    .crm-am-card:hover { border-color: var(--lp-teal-border); }
    .crm-am-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 14px;
    }
    .crm-am-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--lp-teal-soft);
      border: 1px solid var(--lp-teal-border);
      color: var(--lp-teal);
      font-size: 14px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      letter-spacing: 0;
    }
    .crm-am-name {
      font-size: 14px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
      line-height: 1.2;
    }
    .crm-am-title {
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.3;
    }
    .crm-am-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-bottom: 14px;
    }
    .crm-am-stat {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .crm-am-stat-label {
      font-size: 9px;
      font-weight: 600;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--text-muted);
    }
    .crm-am-stat-val {
      font-size: 14px;
      font-weight: 700;
      letter-spacing: var(--tracking-tight);
      color: var(--text);
    }
    .crm-am-bar-wrap {
      margin-bottom: 12px;
    }
    .crm-am-bar-bg {
      height: 6px;
      background: var(--surface-3);
      border-radius: 3px;
      overflow: hidden;
      margin-bottom: 4px;
    }
    .crm-am-bar-fill {
      height: 100%;
      width: 100%;
      border-radius: 3px;
      transform-origin: left center;
      transform: scaleX(0);
      transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .crm-am-bar-label {
      font-size: 11px;
      font-weight: 600;
    }
    .crm-am-agenda-btn {
      width: 100%;
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      font-family: var(--font-body);
      padding: 7px;
      cursor: pointer;
      transition: border-color 0.12s, color 0.12s;
      letter-spacing: -0.01em;
    }
    .crm-am-agenda-btn:hover { border-color: var(--lp-teal-border); color: var(--lp-teal); }

    /* --- Flag badge (red flags on AM card) --- */
    .crm-flag-badge {
      margin-left: auto;
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      background: rgba(239, 68, 68, 0.12);
      color: var(--red);
      border: 1px solid rgba(239, 68, 68, 0.25);
      border-radius: 4px;
      padding: 2px 7px;
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* --- Agenda modal (inline render, not overlay) --- */
    .crm-agenda-modal {
      background: var(--surface);
      border: 1px solid var(--lp-teal-border);
      border-radius: var(--radius);
      padding: 20px;
      max-width: 520px;
    }
    .crm-agenda-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 10px 0;
      border-bottom: 1px solid var(--border-soft);
      font-size: 13px;
      color: var(--text);
      line-height: 1.5;
    }
    .crm-agenda-item:last-of-type { border-bottom: none; }
    .crm-agenda-num {
      flex-shrink: 0;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--lp-teal-soft);
      border: 1px solid var(--lp-teal-border);
      color: var(--lp-teal);
      font-size: 11px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 1px;
    }

    /* --- Calls form + Nurture form (shared layout) --- */
    .crm-calls-form {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 18px;
      margin-bottom: 20px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 12px;
      align-items: end;
    }
    .crm-calls-form > .crm-title {
      grid-column: 1 / -1;
      margin-bottom: 4px;
    }
    .crm-calls-form > button { align-self: end; }

    /* --- Nurture grid (re-uses crm-am-card styles) --- */
    .crm-nurture-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 14px;
    }

    /* --- Xero scenario sliders --- */
    .crm-xero-sliders {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 18px;
      margin-bottom: 20px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 16px;
    }
    .crm-xero-sliders input[type="range"] {
      width: 100%;
      margin-top: 6px;
      accent-color: var(--lp-teal);
    }

    /* ---- Mobile CRM responsive pass ---- */
    @media (max-width: 680px) {
      .crm-kanban { gap: 8px; }
      .crm-col { min-width: 155px; flex: 0 0 155px; }
      .crm-kpi-strip { gap: 6px; }
      .crm-kpi { min-width: 90px; }
      .crm-kpi-value { font-size: 16px; }
      .crm-am-grid, .crm-nurture-grid { grid-template-columns: 1fr; }
      .crm-filter-bar { gap: 8px; }
      .crm-calls-form { grid-template-columns: 1fr; }
      .crm-top-row { flex-direction: column; align-items: flex-start; }
      .crm-flow-toggle { margin-left: 0; }
    }

    /* ============================================================
       BUYER DETAIL PAGE — bd-* classes
       Vertical > Platform > Campaign drilldown matching Prontify
    ============================================================ */

    /* --- Header --- */
    .bd-header {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 16px;
    }
    .bd-back {
      flex-shrink: 0;
      margin-top: 2px;
    }
    .bd-title-block { flex: 1; }
    .bd-title-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    .bd-buyer-name {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: -0.025em;
      color: var(--text);
      line-height: 1.1;
    }
    .bd-grade {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 800;
      background: rgba(255,255,255,0.06);
      border: 1px solid;
    }
    .bd-trend {
      font-size: 11px;
      font-weight: 600;
    }
    .bd-meta {
      font-size: 10px;
      color: var(--text-dim);
      margin-top: 4px;
    }

    /* --- KPI strip --- */
    .bd-kpi-strip {
      display: flex;
      gap: 10px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }
    .bd-kpi {
      flex: 1;
      min-width: 110px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
    }
    .bd-kpi-highlight {
      border-color: var(--lp-teal-border);
      background: var(--lp-teal-soft);
    }
    .bd-kpi-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .bd-kpi-val {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: -0.025em;
      line-height: 1.1;
    }
    .bd-kpi-stub { color: var(--text-muted) !important; font-size: 18px !important; }
    .bd-stub-tag {
      font-size: 8px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      background: rgba(245, 158, 11, 0.10);
      color: var(--amber);
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-radius: 3px;
      padding: 1px 5px;
    }

    /* --- Spend notice banner --- */
    .bd-spend-notice {
      font-size: 11px;
      color: var(--amber);
      background: rgba(245, 158, 11, 0.07);
      border: 1px solid rgba(245, 158, 11, 0.2);
      border-radius: var(--radius-xs);
      padding: 8px 12px;
      margin-bottom: 16px;
      line-height: 1.5;
    }

    /* --- Section label --- */
    .bd-section-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 10px;
    }

    /* --- Vertical block --- */
    .bd-vert-block {
      margin-bottom: 10px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      overflow: hidden;
    }

    /* --- Shared row layout --- */
    .bd-vert-row,
    .bd-plat-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      cursor: pointer;
      transition: background 0.1s;
    }
    .bd-vert-row {
      background: rgba(255,255,255,0.025);
      border-bottom: 1px solid var(--border);
    }
    .bd-vert-row:hover { background: rgba(1,191,165,0.04); }
    .bd-plat-row {
      background: rgba(0,0,0,0.12);
      border-bottom: 1px solid rgba(255,255,255,0.03);
      padding-left: 28px;
    }
    .bd-plat-row:hover { background: rgba(1,191,165,0.03); }

    .bd-chevron {
      font-size: 9px;
      color: var(--text-dim);
      flex-shrink: 0;
      transition: transform 0.15s;
      width: 10px;
    }
    .bd-chevron-sm {
      font-size: 8px;
      color: var(--text-dim);
      flex-shrink: 0;
      transition: transform 0.15s;
      width: 8px;
    }
    .bd-vert-name {
      font-size: 13px;
      font-weight: 700;
      flex: 1;
    }
    .bd-row-nums {
      display: flex;
      gap: 16px;
      align-items: center;
      flex-shrink: 0;
    }
    .bd-num-dim { font-size: 11px; color: var(--text-dim); }
    .bd-num-sold { font-size: 11px; font-weight: 700; color: var(--lp-teal); }
    .bd-num-st { font-size: 11px; font-weight: 700; min-width: 50px; text-align: right; }

    /* --- Platform badge --- */
    .bd-plat-badge {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      border-radius: 4px;
      padding: 2px 8px;
      flex-shrink: 0;
    }
    .bd-plat-meta     { background: rgba(24,119,242,0.12); color: #4299e1; border: 1px solid rgba(24,119,242,0.3); }
    .bd-plat-google   { background: rgba(66,133,244,0.12); color: #63b3ed; border: 1px solid rgba(66,133,244,0.3); }
    .bd-plat-tiktok   { background: rgba(254,44,85,0.10);  color: #fc8181; border: 1px solid rgba(254,44,85,0.25); }
    .bd-plat-youtube  { background: rgba(255,0,0,0.10);    color: #fc8181; border: 1px solid rgba(255,0,0,0.25); }

    /* --- Campaign rows --- */
    .bd-campaigns-wrap {
      border-bottom: 1px solid var(--border);
    }
    .bd-camp-header,
    .bd-camp-row {
      display: grid;
      grid-template-columns: 1fr 70px 70px 60px 80px 70px 90px 70px;
      gap: 4px;
      padding: 6px 14px 6px 46px;
      font-size: 11px;
      align-items: center;
    }
    .bd-camp-header {
      background: rgba(0,0,0,0.18);
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--text-dim);
      border-bottom: 1px solid rgba(255,255,255,0.04);
    }
    .bd-camp-row {
      border-top: 1px solid rgba(255,255,255,0.03);
      color: var(--text-muted);
    }
    .bd-camp-alt { background: rgba(255,255,255,0.012); }
    .bd-camp-name {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 11px;
      color: var(--text-muted);
    }
    .bd-cell-r { text-align: right; }
    .bd-cell-sold { color: var(--lp-teal); font-weight: 600; }
    .bd-cell-stub { color: var(--text-dim); opacity: 0.5; }

    /* ---- Buyer detail mobile responsive ---- */
    @media (max-width: 680px) {
      .bd-kpi-strip { gap: 6px; }
      .bd-kpi { min-width: 90px; }
      .bd-kpi-val { font-size: 16px !important; }
      .bd-buyer-name { font-size: 17px; }
      .bd-camp-header,
      .bd-camp-row {
        grid-template-columns: 1fr 50px 50px 50px 60px 50px 70px 50px;
        padding-left: 30px;
        font-size: 10px;
        gap: 2px;
      }
      .bd-row-nums { gap: 8px; }
    }

/* ============================================================
   CRM — PLATINUM LEAD ALERTS
   ============================================================ */

.crm-platinum-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(139,92,246,0.15) 0%, rgba(59,130,246,0.1) 100%);
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #fff;
  flex-wrap: wrap;
}
.crm-platinum-icon {
  font-size: 15px;
}
.crm-platinum-chip {
  background: rgba(139,92,246,0.2);
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.crm-platinum-chip:hover {
  background: rgba(139,92,246,0.35);
}

/* Tag picker in lead modal */
.crm-tag-picker {
  display: flex;
  gap: 6px;
}
.crm-tag-pick-btn {
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.1s;
}
.crm-tag-pick-btn.active {
  opacity: 1;
  transform: scale(1.05);
}
.crm-tag-pick-btn:hover { opacity: 0.8; }

/* ============================================================
   CRM — CONSTANTS / SPRINT MODE
   ============================================================ */

.crm-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.crm-mode-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.crm-mode-btn.active {
  background: var(--surface);
  color: var(--text-primary);
}
.crm-mode-btn.crm-mode-sprint.active {
  background: #F59E0B;
  color: #000;
}
.crm-mode-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* Sprint summary bar */
.crm-sprint-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-primary);
}
.crm-sprint-icon {
  font-size: 16px;
}
.crm-sprint-divider {
  color: var(--text-dim);
  margin: 0 2px;
}

/* Stale card highlight */
.crm-card.crm-card-stale {
  border-color: rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.04);
}
.crm-stale-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(245,158,11,0.15);
  color: #F59E0B;
  border: 1px solid rgba(245,158,11,0.4);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ============================================================
   CRM — DRAG AND DROP STATES
   ============================================================ */

/* Card draggable cursor */
.crm-card[draggable="true"] {
  cursor: grab;
}
.crm-card[draggable="true"]:active {
  cursor: grabbing;
}

/* Column body — the card-container inside each kanban column */
.crm-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 60px;
  padding: 0 0 8px;
}

/* Column drop target highlight */
.crm-col.crm-col-drop-active {
  outline: 2px solid var(--lp-teal);
  outline-offset: -2px;
  background: rgba(1, 191, 165, 0.05);
  border-radius: 8px;
}

/* ============================================================
   CRM — LEAD DETAIL MODAL
   ============================================================ */

.crm-lead-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
}

.crm-lead-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 901;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.crm-lead-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.crm-lead-modal-title {
  flex: 1;
}

.crm-lead-modal-title strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.crm-lead-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  margin-top: -2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.crm-lead-modal-close:hover {
  color: var(--text-primary);
}

.crm-lead-modal-body {
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crm-lead-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-lead-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lp-teal);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.crm-lead-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-primary);
}

.crm-lead-key {
  min-width: 110px;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.crm-lead-notes {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.crm-lead-notes:focus {
  outline: none;
  border-color: var(--lp-teal);
}

/* Modal responsive */
@media (max-width: 560px) {
  .crm-lead-modal { width: calc(100vw - 24px); }
  .crm-lead-key { min-width: 88px; }
}

/* ============================================================
   RED FLAG AGENDA MODAL
============================================================ */

#agenda-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1100;
}
#agenda-modal-backdrop.visible { display: block; }

#agenda-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: min(720px, calc(100vw - 32px));
  max-height: 80vh;
  background: var(--bg-card, #111);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  z-index: 1101;
  flex-direction: column;
  overflow: hidden;
}
#agenda-modal.visible { display: flex; }

.pdo-agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdo-agenda-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.pdo-agenda-close:hover { color: var(--text-primary); }

.pdo-agenda-body {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}
.pdo-agenda-content h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--lp-teal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 8px;
}
.pdo-agenda-content h2:first-child { margin-top: 0; }
.pdo-agenda-content ul {
  margin: 0 0 12px;
  padding-left: 18px;
}
.pdo-agenda-content li {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 4px;
}
.pdo-agenda-content p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 8px;
}
.pdo-agenda-loading, .pdo-agenda-error {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 32px 0;
}
.pdo-agenda-error { color: var(--red, #EF4444); }

.pdo-agenda-trigger-btn {
  background: transparent;
  border: 1px solid var(--lp-teal);
  color: var(--lp-teal);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.pdo-agenda-trigger-btn:hover {
  background: var(--lp-teal);
  color: #000;
}

/* ============================================================
   TEAM DASHBOARD — filterable table + AM card badges
============================================================ */

.crm-team-table-wrap {
  margin-top: 24px;
}
.crm-team-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.crm-am-badges-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.crm-am-stale-badge {
  font-size: 10px;
  font-weight: 700;
  background: #EF444422;
  color: #EF4444;
  border: 1px solid #EF444444;
  border-radius: 4px;
  padding: 2px 6px;
}
.crm-am-plat-badge {
  font-size: 10px;
  font-weight: 700;
  background: #F59E0B22;
  color: #F59E0B;
  border: 1px solid #F59E0B44;
  border-radius: 4px;
  padding: 2px 6px;
}
.crm-am-card-active {
  border-color: var(--lp-teal) !important;
  box-shadow: 0 0 0 1px var(--lp-teal);
}

/* ============================================================
   ONBOARDING CHECKLIST — lead modal tab
============================================================ */

.crm-modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.crm-modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: -1px;
}
.crm-modal-tab:hover { color: var(--text-primary); }
.crm-modal-tab.active {
  color: var(--lp-teal);
  border-bottom-color: var(--lp-teal);
}

.crm-checklist-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.crm-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs, 4px);
  cursor: pointer;
  transition: background 0.1s;
}
.crm-checklist-item:hover { background: var(--surface-raised); }
.crm-checklist-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--lp-teal);
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.crm-checklist-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}
.crm-checklist-done .crm-checklist-text {
  color: var(--text-dim);
  text-decoration: line-through;
}
.crm-checklist-meta {
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 12px 8px 37px;
}

/* ── v7.0 Feature Styles ───────────────────────────── */

/* Client View toggle button */
.client-view-btn {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.client-view-btn:hover {
  background: var(--lp-teal-soft);
  border-color: var(--lp-teal-border);
  color: var(--text);
}
.client-view-btn:focus-visible {
  outline: 2px solid var(--lp-teal-border);
  outline-offset: 1px;
}
.client-view-btn.active {
  background: var(--amber);
  color: #000;
  border-color: var(--amber);
}

/* Forecast disclaimer banner */
.forecast-disclaimer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: var(--space-md);
}

/* Forecast table */
.forecast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.forecast-table th,
.forecast-table td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.forecast-table th {
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}
.forecast-table th:first-child,
.forecast-table td:first-child {
  text-align: left;
  font-weight: 500;
}
.forecast-table tr:hover td {
  background: var(--surface-1);
}

/* Forecast sliders */
.forecast-sliders {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: var(--surface-1);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.forecast-slider-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}
.forecast-slider-item label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.forecast-slider-item input[type="range"] {
  accent-color: var(--lp-teal);
}

/* Group entity cards */
.group-entity-card {
  padding: var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  transition: border-color 0.15s;
}
.group-entity-card:hover {
  border-color: var(--lp-teal-border);
}

/* Outbound table */
.outbound-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.outbound-table th,
.outbound-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.outbound-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.outbound-table td {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outbound-table tr:hover td {
  background: var(--surface-1);
}

/* Outbound filters */
.outbound-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: var(--space-md);
}
.outbound-filters select,
.outbound-filters input {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text);
  transition: border-color 0.15s;
}
.outbound-filters select:focus,
.outbound-filters input:focus {
  border-color: var(--lp-teal);
  outline: none;
}

/* Priority badges */
.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.priority-badge.high { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.priority-badge.medium { background: rgba(245, 158, 11, 0.12); color: var(--amber); }
.priority-badge.low { background: rgba(1, 191, 165, 0.12); color: var(--lp-teal); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
}

/* Empty state for v7 features */
.v7-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.v7-empty-state p {
  margin: 8px 0 0;
  font-size: 13px;
}

/* Double-click prevention */
button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive: v7 features */
@media (max-width: 800px) {
  .forecast-sliders { flex-direction: column; }
  .forecast-table { font-size: 11px; }
  .forecast-table th, .forecast-table td { padding: 4px 6px; }
  .outbound-filters { flex-direction: column; }
}
