    /* ── CLIENT DETAIL SIDEBAR LAYOUT ───────────────────────────────────────── */
    #app-page.page--client-detail {
      max-width: none;
      padding: 0;
      margin-right: 0;
    }
    .client-detail-layout {
      display: flex;
      align-items: flex-start;
      min-height: calc(100vh - var(--topbar-h));
    }
    .client-detail-sidebar {
      width: 210px;
      flex-shrink: 0;
      position: sticky;
      top: var(--topbar-h);
      height: calc(100vh - var(--topbar-h));
      overflow-y: auto;
      border-right: 0.5px solid var(--border);
      padding: 1rem 0 2rem;
      display: flex;
      flex-direction: column;
      background: var(--bg-secondary);
    }
    .client-sidebar-back {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--text-secondary);
      padding: 6px 1rem;
      background: none;
      border: none;
      cursor: pointer;
      width: 100%;
      text-align: left;
      margin-bottom: 10px;
      transition: color 0.1s;
    }
    .client-sidebar-back:hover { color: var(--text-primary); }
    .client-sidebar-name {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-primary);
      padding: 0 1rem 12px;
      border-bottom: 0.5px solid var(--border);
      margin-bottom: 6px;
      line-height: 1.4;
      word-break: break-word;
    }
    .client-sidebar-nav {
      display: flex;
      flex-direction: column;
      gap: 1px;
      padding-top: 4px;
    }
    .client-sidebar-nav-btn {
      display: flex;
      align-items: center;
      gap: 9px;
      width: 100%;
      padding: 9px 1rem;
      font-size: 13px;
      color: var(--text-secondary);
      background: none;
      border: none;
      cursor: pointer;
      text-align: left;
      transition: background 0.1s, color 0.1s;
      border-radius: 0;
      line-height: 1;
      white-space: nowrap;
    }
    .client-sidebar-nav-btn:hover { background: var(--bg); color: var(--text-primary); }
    .client-sidebar-nav-btn.active {
      background: var(--blue-bg);
      color: var(--blue-mid);
      font-weight: 500;
    }
    .client-sidebar-nav-btn--ai { color: var(--purple-mid); }
    .client-sidebar-nav-btn--ai:hover { background: var(--purple-bg); color: var(--purple-mid); }
    .client-sidebar-nav-btn--ai.active { background: var(--purple-bg); color: var(--purple-mid); font-weight: 500; }
    .client-sidebar-nav-btn svg { flex-shrink: 0; opacity: 0.75; }
    .client-sidebar-nav-btn.active svg,
    .client-sidebar-nav-btn:hover svg { opacity: 1; }
    .client-detail-main {
      flex: 1;
      min-width: 0;
      padding: 2rem 1.5rem;
    }
    /* Mobile: sidebar becomes a horizontal scrollable tab bar */
    @media (max-width: 768px) {
      .client-detail-layout { flex-direction: column; }
      .client-detail-sidebar {
        width: 100%; height: auto; position: static;
        border-right: none; border-bottom: 0.5px solid var(--border);
        padding: 0.5rem 1rem; overflow-x: auto; overflow-y: hidden;
      }
      .client-sidebar-back { display: none; }
      .client-sidebar-name { display: none; }
      .client-sidebar-nav { flex-direction: row; gap: 4px; padding-top: 0; }
      .client-sidebar-nav-btn {
        white-space: nowrap; padding: 5px 12px; border-radius: 20px;
        border: 0.5px solid var(--border-md); flex-shrink: 0;
      }
      .client-sidebar-nav-btn.active {
        background: var(--blue-mid); color: #fff; border-color: var(--blue-mid); font-weight: 400;
      }
      .client-sidebar-nav-btn--ai.active {
        background: var(--purple-mid); color: #fff; border-color: var(--purple-mid);
      }
      .client-detail-main { padding: 1.25rem 1rem; }
    }

    /* ── AI Workspace layout ── */
    .ai-workspace { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 180px); min-height: 500px; border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); margin-top: 4px; }

    /* ── Context panel ── */
    .ai-context-panel { background: var(--bg-secondary); border-right: 0.5px solid var(--border); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 0; }
    .ai-context-title { font-size: 12px; font-weight: 700; color: var(--text-primary); letter-spacing: .02em; }
    .ai-context-sub { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; margin-bottom: 14px; }
    .ai-ctx-section { border-top: 0.5px solid var(--border); padding-top: 10px; margin-top: 10px; }
    .ai-ctx-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
    .ai-ctx-section-hdr { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); margin-bottom: 6px; }
    .ai-ctx-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
    .ai-ctx-row--highlight { background: var(--blue-bg); margin: 4px -8px; padding: 3px 8px; border-radius: 4px; }
    .ai-ctx-lbl { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
    .ai-ctx-val { font-size: 11px; font-weight: 600; color: var(--text-primary); text-align: right; }
    .ai-ctx-val--pos { color: var(--green-mid); }
    .ai-ctx-val--neg { color: var(--red-mid); }
    .ai-ctx-val--warn { color: var(--amber-mid); }
    .ai-ctx-flag { font-size: 10px; color: var(--amber-text); background: var(--amber-bg); border-radius: 4px; padding: 4px 7px; margin-bottom: 4px; line-height: 1.4; }

    /* ── Chat area ── */
    .ai-chat-area { display: flex; flex-direction: column; overflow: hidden; }
    .ai-chat-feed { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
    .ai-chat-bottom { border-top: 0.5px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }

    /* ── Messages ── */
    .ai-msg { display: flex; }
    .ai-msg--user { justify-content: flex-end; }
    .ai-msg--assistant { justify-content: flex-start; }
    .ai-msg-bubble { max-width: 75%; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.55; }
    .ai-msg--user .ai-msg-bubble { background: var(--blue-mid); color: #fff; border-bottom-right-radius: 3px; }
    .ai-msg--assistant .ai-msg-bubble { background: var(--bg-secondary); color: var(--text-primary); border: 0.5px solid var(--border); border-bottom-left-radius: 3px; }
    .ai-msg-bubble--loading { display: flex; align-items: center; gap: 5px; padding: 12px 16px; }

    /* Markdown rendering inside AI chat assistant bubbles */
    .ai-msg--assistant .ai-msg-bubble .md-h1,
    .ai-msg--assistant .ai-msg-bubble .md-h2,
    .ai-msg--assistant .ai-msg-bubble .md-h3 {
      font-weight: 600; color: var(--text-primary); margin: 9px 0 3px;
    }
    .ai-msg--assistant .ai-msg-bubble .md-h1 { font-size: 14px; }
    .ai-msg--assistant .ai-msg-bubble .md-h2 { font-size: 13px; }
    .ai-msg--assistant .ai-msg-bubble .md-h3 {
      font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
      color: var(--text-secondary);
    }
    .ai-msg--assistant .ai-msg-bubble .md-h1:first-child,
    .ai-msg--assistant .ai-msg-bubble .md-h2:first-child,
    .ai-msg--assistant .ai-msg-bubble .md-h3:first-child { margin-top: 0; }
    .ai-msg--assistant .ai-msg-bubble .md-li {
      display: flex; gap: 6px; margin: 2px 0; align-items: baseline;
    }
    .ai-msg--assistant .ai-msg-bubble .md-marker {
      color: var(--text-tertiary); flex-shrink: 0; min-width: 14px;
    }
    .ai-msg--assistant .ai-msg-bubble .md-hr {
      border: 0; border-top: 0.5px solid var(--border); margin: 9px 0;
    }
    .ai-msg--assistant .ai-msg-bubble code {
      background: var(--bg-tertiary); padding: 1px 5px; border-radius: 3px;
      font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    }
    .ai-msg--assistant .ai-msg-bubble strong { font-weight: 600; }
    .ai-typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); animation: ai-typing 1.2s infinite; }
    .ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
    .ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
    @keyframes ai-typing { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

    /* ── Suggestion chips ── */
    .ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
    .ai-chip { font-size: 11px; padding: 5px 11px; border: 0.5px solid var(--border); border-radius: 20px; background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
    .ai-chip:hover { border-color: var(--purple-mid); color: var(--purple-mid); background: var(--purple-bg); }

    /* ── Composer ── */
    .ai-composer { display: flex; align-items: flex-end; gap: 8px; }
    .ai-input { flex: 1; padding: 9px 12px; border: 0.5px solid var(--border); border-radius: 8px; background: var(--bg-secondary); color: var(--text-primary); font-size: 13px; line-height: 1.4; resize: none; outline: none; font-family: inherit; min-height: 38px; max-height: 120px; }
    .ai-input:focus { border-color: var(--purple-mid); }
    .ai-input::placeholder { color: var(--text-tertiary); }
    .ai-send-btn { width: 36px; height: 36px; border-radius: 8px; background: var(--purple-mid); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .ai-send-btn:hover { background: var(--purple-text); }
    .ai-empty-state { padding: 40px; color: var(--text-tertiary); text-align: center; font-size: 13px; }
    /* Chat feed empty state — shown inside the conversation area before the first message.
       Matches the gold-standard .empty-state pattern but tuned for the chat panel's vertical centering. */
    .ai-feed-empty {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      text-align: center; padding: 3rem 1.5rem; flex: 1; min-height: 280px;
    }
    .ai-feed-empty-icon {
      width: 56px; height: 56px; border-radius: 14px;
      background: var(--blue-bg); color: var(--blue-mid);
      display: flex; align-items: center; justify-content: center;
      margin-bottom: 1.25rem;
    }
    .ai-feed-empty-title {
      font-size: var(--font-md); font-weight: 600;
      color: var(--text-primary); margin-bottom: 8px;
    }
    .ai-feed-empty-body {
      font-size: var(--font-sm); color: var(--text-secondary);
      line-height: 1.55; max-width: 360px;
    }

