    /* CRM view is a full-height pane inside the shell. The shell header
       takes var(--lf-nav-h); the rest is ours. */
    .crm-root {
      display: flex;
      flex-direction: column;
      height: calc(100dvh - var(--lf-nav-h));
      overflow: hidden;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      font-size: 14px;
    }
    .crm-root > .top-bar { flex-shrink: 0; }
    a { color: var(--lf-accent-hover); text-decoration: none; }
    a:hover { text-decoration: underline; }

    .auth-screen {
      display: flex; align-items: center; justify-content: center;
      height: 100%;
    }
    .auth-card {
      background: var(--lf-panel);
      border: 1px solid var(--lf-border);
      border-radius: 10px;
      padding: 32px;
      width: 320px;
      text-align: center;
    }
    .auth-card h1 { margin: 0 0 12px; font-size: 20px; }
    .auth-card p { color: var(--lf-text-muted); margin: 0 0 20px; }

    .btn {
      background: var(--lf-accent-bg); color: var(--lf-accent-hover); border: none;
      padding: 10px 18px; border-radius: 6px; cursor: pointer;
      font-size: 13px; font-weight: 600;
    }
    .btn:hover { background: var(--lf-accent-bg-hover); }
    .btn-small { padding: 6px 12px; font-size: 12px; }

    .top-bar {
      display: flex; justify-content: space-between; align-items: center;
      padding: 10px 20px;
      border-bottom: 1px solid var(--lf-border);
      background: var(--lf-nav-bg);
    }
    .top-bar h1 { margin: 0; font-size: 16px; font-weight: 600; }
    .top-bar .user-email { color: var(--lf-text-muted); font-size: 12px; margin-right: 10px; }

    .error { color: var(--lf-error); font-size: 13px; margin-top: 10px; }

    .crm-layout {
      display: grid;
      grid-template-columns: var(--lf-list-w) 1fr var(--lf-sidebar-w);
      grid-template-rows: minmax(0, 1fr);
      gap: 0;
      flex: 1 1 auto;
      min-height: 0;
    }
    .conv-list { border-right: 1px solid var(--lf-border); overflow-y: auto; min-height: 0; }
    .filter-bar {
      padding: 10px 14px; border-bottom: 1px solid var(--lf-border);
      display: flex; gap: 8px; background: var(--lf-panel-alt);
      position: sticky; top: 0; z-index: 5;
    }
    .filter-bar select {
      background: var(--lf-input-bg); color: var(--lf-text); border: 1px solid var(--lf-border);
      padding: 6px 8px; border-radius: 6px; font-size: 12px;
    }
    .filter-toggle {
      display: flex; align-items: center; gap: 4px;
      font-size: 11px; color: var(--lf-text-dim);
      cursor: pointer;
      user-select: none;
      padding: 6px 8px;
    }
    .filter-toggle input[type="checkbox"] {
      cursor: pointer;
      accent-color: var(--lf-accent);
    }
    .conv-row {
      padding: 12px 16px;
      border-bottom: 1px solid var(--lf-border);
      cursor: pointer;
      transition: background 0.1s;
    }
    .conv-row:hover { background: var(--lf-panel-hover); }
    .conv-row.active { background: var(--lf-accent-bg); border-left: 3px solid var(--lf-accent); padding-left: 13px; }
    .conv-row .chan {
      font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
      color: var(--lf-accent-hover);
    }
    .conv-row .chan.unmatched { color: var(--lf-text-muted); }
    .conv-row .subj {
      font-weight: 600; margin: 4px 0;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .conv-row .snip {
      color: var(--lf-text-muted); font-size: 12px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .conv-row .meta {
      display: flex; justify-content: space-between;
      font-size: 11px; color: var(--lf-text-dim); margin-top: 6px;
    }
    .unread-dot {
      display: inline-block; width: 8px; height: 8px;
      background: var(--lf-accent); border-radius: 50%;
      margin-right: 6px; vertical-align: middle;
    }

    .conv-detail {
      overflow-y: auto;
      padding: 28px 36px;
    }

    .conv-sidebar {
      overflow-y: auto;
      padding: 24px 22px;
      border-left: 1px solid var(--lf-border);
      background: var(--lf-panel-alt, rgba(0,0,0,0.12));
    }
    .conv-sidebar .placeholder {
      color: var(--lf-text-dim); font-size: 13px; text-align: center; margin-top: 40px;
    }
    .conv-sidebar .customer-card {
      background: transparent;
      border: 0;
      border-left: 0;
      border-radius: 0;
      padding: 0;
      margin: 0;
    }
    .conv-sidebar .customer-card .cust-top {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }
    .conv-sidebar .customer-card .cust-name {
      font-size: 16px;
    }
    .conv-sidebar .customer-card .cust-stats {
      grid-template-columns: 1fr;
      gap: 8px;
    }
    .conv-sidebar .customer-card .cust-stat {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      padding: 10px 12px;
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      text-decoration: none;
      color: inherit;
    }
    .conv-sidebar .customer-card .cust-stat-link:hover {
      border-color: var(--lf-accent);
      background: var(--lf-accent-bg);
      cursor: pointer;
    }
    .conv-sidebar .customer-card .cust-stat-link::after {
      content: "↗";
      font-size: 9px;
      color: var(--lf-text-dim);
      margin-left: 4px;
      opacity: 0.7;
    }
    .conv-sidebar .customer-card .cust-stat-value {
      font-size: 16px;
    }
    .conv-sidebar .customer-card .cust-stat-label {
      font-size: 10px;
      margin-top: 0;
    }
    .conv-sidebar .customer-card .cust-tags {
      margin-top: 12px;
    }

    .pending-section {
      margin-top: 18px;
      padding-top: 14px;
      border-top: 1px solid var(--lf-border);
    }
    .pending-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .pending-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--lf-warn);
    }
    .pending-total {
      font-size: 14px;
      font-weight: 700;
      color: var(--lf-warn);
      font-feature-settings: "tnum";
    }
    .pending-row {
      padding: 10px 12px;
      border-radius: 6px;
      margin-bottom: 6px;
      border: 1px solid transparent;
    }
    .pending-row.type-active {
      background: var(--lf-warn-bg);
      border-color: var(--lf-warn-border);
    }
    .pending-row.type-mixed {
      background: var(--lf-warn-bg);
      border-color: var(--lf-warn-border);
      border-left: 3px solid var(--lf-purple);
    }
    .pending-row.type-preorder {
      background: var(--lf-purple-bg);
      border-color: var(--lf-purple-border);
      opacity: 0.85;
    }

    .pending-legend {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }
    .pending-legend .legend-item {
      font-size: 10px;
      font-weight: 600;
      padding: 3px 8px;
      border-radius: 999px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .legend-active { background: var(--lf-warn-bg); color: var(--lf-warn); }
    .legend-mixed { background: var(--lf-warn-bg); color: var(--lf-warn); border-left: 2px solid var(--lf-purple); }
    .legend-preorder { background: var(--lf-purple-bg); color: var(--lf-purple); }

    .type-pill {
      display: inline-block;
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      padding: 1px 6px;
      border-radius: 3px;
      margin-left: 6px;
      vertical-align: middle;
    }
    .type-pill.pill-preorder { background: var(--lf-purple-bg); color: var(--lf-purple); }
    .type-pill.pill-mixed { background: var(--lf-purple-bg); color: var(--lf-purple); }

    .pending-items li.item-preorder { color: var(--lf-text-muted); }
    .pending-items li .item-tag {
      font-size: 9px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--lf-purple);
      font-weight: 700;
      margin-left: 4px;
    }
    .pending-link {
      display: block;
      text-decoration: none;
      color: inherit;
    }
    .pending-link:hover .pending-row { filter: brightness(1.08); }
    .pending-row-top {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
    }
    .pending-name {
      font-size: 12px;
      font-weight: 600;
      color: var(--lf-text);
      font-family: 'JetBrains Mono', monospace;
    }
    .pending-amount {
      font-size: 12px;
      font-weight: 700;
      color: var(--lf-text);
      font-feature-settings: "tnum";
    }
    .pending-age {
      font-size: 10px;
      color: var(--lf-text-muted);
      margin-top: 2px;
    }
    .pending-items {
      list-style: none;
      margin: 6px 0 0 0;
      padding: 0;
      border-top: 1px dashed var(--lf-warn-border);
      padding-top: 6px;
    }
    .pending-items li {
      font-size: 11px;
      color: var(--lf-text);
      line-height: 1.5;
    }
    .pending-items li .qty {
      color: var(--lf-text-muted);
      font-weight: 600;
      margin-right: 2px;
    }
    .pending-more {
      font-size: 11px;
      color: var(--lf-text-dim);
      text-align: center;
      margin-top: 4px;
    }

    .reviews-section {
      margin-top: 18px;
      padding-top: 14px;
      border-top: 1px solid var(--lf-border);
    }
    .reviews-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .reviews-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--lf-text-muted);
    }
    .reviews-avg {
      font-size: 12px;
      font-weight: 700;
      color: #e6a700;
      font-feature-settings: "tnum";
    }
    .review-row {
      padding: 10px 12px;
      border-radius: 6px;
      margin-bottom: 6px;
      border: 1px solid var(--lf-border);
      background: var(--lf-surface-2, rgba(255,255,255,0.02));
    }
    .review-link {
      display: block;
      text-decoration: none;
      color: inherit;
    }
    .review-link:hover .review-row { filter: brightness(1.12); border-color: var(--lf-text-muted); }
    .review-head {
      display: flex;
      align-items: baseline;
      gap: 8px;
      margin-bottom: 4px;
    }
    .review-stars {
      font-size: 12px;
      color: #e6a700;
      letter-spacing: 1px;
      font-feature-settings: "tnum";
    }
    .review-verified {
      display: inline-block;
      font-size: 9px;
      font-weight: 700;
      padding: 1px 6px;
      border-radius: 999px;
      background: rgba(52, 199, 89, 0.15);
      color: #34c759;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .review-date {
      margin-left: auto;
      font-size: 10px;
      color: var(--lf-text-muted);
    }
    .review-product {
      font-size: 10px;
      color: var(--lf-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 2px;
    }
    .review-title {
      font-size: 12px;
      font-weight: 700;
      color: var(--lf-text);
      margin-bottom: 3px;
    }
    .review-body {
      font-size: 11px;
      line-height: 1.45;
      color: var(--lf-text-muted);
    }
    .reviews-more {
      font-size: 11px;
      color: var(--lf-text-dim);
      text-align: center;
      margin-top: 4px;
    }

    /* Customer-card RMA section: compact list of this customer's RMA
       requests (open-first). Each row links into the RMA admin view. */
    .cust-rma-section {
      margin-top: 18px;
      padding-top: 14px;
      border-top: 1px solid var(--lf-border);
    }
    .cust-rma-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .cust-rma-label {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--lf-text-muted);
    }
    .cust-rma-summary {
      font-size: 11px;
      color: var(--lf-text-dim);
      font-feature-settings: "tnum";
    }
    .cust-rma-row {
      display: block;
      text-decoration: none;
      color: inherit;
      padding: 10px 12px;
      margin-bottom: 6px;
      border-radius: 6px;
      border: 1px solid var(--lf-border);
      background: var(--lf-panel-alt);
      transition: border-color 0.12s, background 0.12s;
    }
    .cust-rma-row:hover {
      border-color: var(--lf-accent);
      background: var(--lf-panel-hover);
      text-decoration: none;
    }
    .cust-rma-row.closed {
      opacity: 0.7;
    }
    .cust-rma-top {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
    }
    .cust-rma-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--lf-text);
      font-family: 'JetBrains Mono', monospace;
    }
    .cust-rma-status {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 2px 8px;
      border-radius: 999px;
      background: var(--lf-panel);
      color: var(--lf-text-muted);
      flex-shrink: 0;
    }
    .cust-rma-status.rma-status-submitted { background: var(--lf-info-bg); color: var(--lf-info); }
    .cust-rma-status.rma-status-awaiting_unit { background: var(--lf-warn-bg); color: var(--lf-warn); }
    .cust-rma-status.rma-status-received { background: var(--lf-warn-bg); color: var(--lf-warn); }
    .cust-rma-status.rma-status-resolved { background: var(--lf-success-bg); color: var(--lf-success); }
    .cust-rma-status.rma-status-denied { background: var(--lf-error-bg); color: var(--lf-error); }
    .cust-rma-meta {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      margin-top: 4px;
      font-size: 10px;
      color: var(--lf-text-dim);
    }
    .cust-rma-reason {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .conv-sidebar .section-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--lf-text-dim);
      margin: 20px 0 10px;
    }
    .conv-sidebar .section-title:first-child { margin-top: 0; }
    .conv-detail .placeholder {
      color: var(--lf-text-dim); text-align: center; margin-top: 80px;
    }
    .conv-header h2 { margin: 0 0 6px; font-size: 22px; }
    .conv-header-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
    }
    .conv-action-btn {
      padding: 6px 14px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      border: 1px solid var(--lf-border);
      background: var(--lf-panel-alt);
      color: var(--lf-text-muted);
      flex-shrink: 0;
      font-family: inherit;
      white-space: nowrap;
    }
    .conv-action-btn:hover:not(:disabled) {
      background: var(--lf-panel-hover);
      color: var(--lf-text);
    }
    .conv-action-btn:disabled { opacity: 0.6; cursor: wait; }
    .conv-action-btn.close:hover:not(:disabled) {
      border-color: rgba(210, 153, 34, 0.4);
      color: #d29922;
    }
    .conv-action-btn.reopen {
      background: rgba(63, 185, 80, 0.08);
      color: #3fb950;
      border-color: rgba(63, 185, 80, 0.3);
    }
    .conv-action-btn.reopen:hover:not(:disabled) {
      background: rgba(63, 185, 80, 0.18);
    }
    .conv-header .meta .tag-closed {
      background: rgba(210, 153, 34, 0.12);
      color: #d29922;
    }
    .conv-header .meta {
      color: var(--lf-text-muted); font-size: 13px; margin-bottom: 24px;
      display: flex; gap: 14px; flex-wrap: wrap;
    }
    .conv-header .meta .tag {
      background: var(--lf-accent-bg); color: var(--lf-text-muted);
      padding: 2px 10px; border-radius: 12px; font-size: 11px;
    }

    .msg {
      border: 1px solid var(--lf-border); border-radius: 10px;
      padding: 16px 18px; margin-bottom: 14px;
    }
    .msg.inbound { background: var(--lf-panel-alt); }
    .msg.outbound { background: var(--lf-success-bg); border-color: var(--lf-success-border); }
    .msg-header {
      display: flex; justify-content: space-between;
      font-size: 12px; color: var(--lf-text-muted); margin-bottom: 10px;
    }
    .msg-header .from { color: var(--lf-text); font-weight: 600; }
    .msg-body {
      white-space: pre-wrap; word-break: break-word;
      font-size: 14px; line-height: 1.55; color: var(--lf-text);
    }
    .msg-html-frame {
      display: block;
      width: 100%;
      border: 0;
      background: transparent;
      min-height: 80px;
      color-scheme: light;
      /* The email template provides its own centered 600px container
         + background — don't add our own so we don't end up with a
         card-inside-a-card look. Give a little breathing room on
         narrow viewports via a tiny negative margin. */
      margin: 0 -4px;
      max-width: calc(100% + 8px);
    }
    .msg-body .quoted {
      display: block;
      margin-top: 12px;
    }
    .msg-body .quoted summary {
      color: var(--lf-text-dim); cursor: pointer; font-size: 12px;
      list-style: none; user-select: none;
      padding: 4px 8px; border-radius: 5px;
      background: rgba(255,255,255,0.03); display: inline-block;
    }
    .msg-body .quoted summary::-webkit-details-marker { display: none; }
    .msg-body .quoted summary::before { content: "··· "; color: var(--lf-text-dim); }
    .msg-body .quoted summary:hover { background: rgba(255,255,255,0.06); }
    .msg-body .quoted[open] summary::before { content: "▾ "; }
    .msg-body .quoted pre {
      margin: 10px 0 0 0; padding: 10px 14px;
      background: rgba(0,0,0,0.15);
      border-left: 2px solid var(--lf-border);
      border-radius: 0 6px 6px 0;
      color: var(--lf-text-muted); font-size: 12.5px; line-height: 1.5;
      white-space: pre-wrap; word-break: break-word;
      font-family: inherit;
    }

    .empty { padding: 20px; color: var(--lf-text-dim); text-align: center; }

    /* ─── Reply composer (sticky above message list) ──────────────── */
    .reply-composer {
      position: sticky;
      top: 0;
      z-index: 4;
      background: var(--lf-bg);
      border: 1px solid var(--lf-border);
      border-radius: 10px;
      padding: 10px 12px;
      margin: 0 0 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .reply-composer textarea {
      background: var(--lf-panel-alt);
      color: var(--lf-text);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      padding: 10px 12px;
      font-family: inherit;
      font-size: 13.5px;
      line-height: 1.5;
      resize: vertical;
      min-height: 64px;
      outline: none;
      transition: border-color 0.1s;
    }
    .reply-composer textarea:focus {
      border-color: var(--lf-accent);
    }
    .reply-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .reply-status {
      font-size: 12px;
      color: var(--lf-text-dim);
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .reply-status.success { color: #3fb950; }
    .reply-status.warn { color: #d29922; }
    .reply-status.error { color: #ff6b6b; }
    .btn.reply-send {
      padding: 7px 16px;
      font-size: 13px;
      font-weight: 600;
      background: var(--lf-accent);
      color: #fff;
      border: 0;
      border-radius: 7px;
      cursor: pointer;
    }
    .btn.reply-send:hover:not(:disabled) { filter: brightness(1.1); }
    .btn.reply-send:disabled { opacity: 0.6; cursor: wait; }

    /* ─── Suggest Reply button + sentiment badge ──────────────── */
    .btn.suggest-btn {
      padding: 7px 14px;
      font-size: 13px;
      font-weight: 600;
      background: linear-gradient(135deg, #8b5cf6, #6366f1);
      color: #fff;
      border: 0;
      border-radius: 7px;
      cursor: pointer;
      white-space: nowrap;
    }
    .btn.suggest-btn:hover:not(:disabled) { filter: brightness(1.15); }
    .btn.suggest-btn:disabled {
      opacity: 0.7;
      cursor: wait;
      animation: suggest-pulse 1.5s ease-in-out infinite;
    }
    @keyframes suggest-pulse {
      0%, 100% { opacity: 0.7; }
      50% { opacity: 0.4; }
    }
    .suggest-sentiment {
      font-size: 12px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 999px;
      display: inline-block;
      margin-bottom: 8px;
    }
    .sentiment-frustrated { background: #fef2f2; color: #dc2626; }
    .sentiment-confused { background: #fffbeb; color: #d97706; }
    .sentiment-patient { background: #f0fdf4; color: #16a34a; }
    .sentiment-happy { background: #f0fdf4; color: #16a34a; }
    .sentiment-urgent { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

    /* ─── Related conversations (cross-channel per-customer list) ──── */
    .related-section {
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px solid var(--lf-border);
    }
    .related-head {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 8px;
    }
    .related-title {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--lf-text-dim);
      font-weight: 700;
    }
    .related-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .related-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      border-radius: 7px;
      cursor: pointer;
      transition: background 0.1s;
      min-width: 0;
    }
    .related-row:hover { background: var(--lf-panel-hover); }
    .related-row.active {
      background: var(--lf-accent-bg);
      cursor: default;
    }
    .related-row.active .related-subj { color: var(--lf-accent); }
    .related-chan {
      flex-shrink: 0;
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 3px 7px;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.06);
      color: var(--lf-text-muted);
      min-width: 48px;
      text-align: center;
    }
    .related-chan-gmail {
      background: rgba(234, 67, 53, 0.12);
      color: #ea4335;
    }
    .related-chan-shopify-inbox {
      background: rgba(150, 191, 72, 0.12);
      color: #96bf48;
    }
    .related-chan-crisp,
    .related-chan-facebook,
    .related-chan-instagram,
    .related-chan-messenger,
    .related-chan-whatsapp,
    .related-chan-app {
      background: rgba(107, 160, 255, 0.12);
      color: var(--lf-accent);
    }
    .related-body {
      flex: 1 1 auto;
      min-width: 0;
    }
    .related-subj {
      font-size: 12px;
      font-weight: 600;
      color: var(--lf-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
    }
    .related-when {
      font-size: 10px;
      color: var(--lf-text-dim);
      margin-top: 1px;
    }

    /* ─── Message variants (Shopify Inbox bodyType) ─────────────────── */
    .msg-event {
      display: flex;
      align-items: center;
      gap: 10px;
      justify-content: center;
      color: var(--lf-text-dim);
      font-size: 11px;
      padding: 6px 14px;
      margin: 8px 0;
    }
    .msg-event .msg-event-text {
      font-style: italic;
    }
    .msg-event .msg-event-time {
      color: var(--lf-text-dim);
      opacity: 0.7;
    }

    /* Attachment message: image thumb or file link */
    .att-thumb {
      display: block;
      max-width: 320px;
      border-radius: 8px;
      overflow: hidden;
      border: 1px solid var(--lf-border);
    }
    .att-thumb img {
      display: block;
      width: 100%;
      height: auto;
      max-height: 400px;
      object-fit: cover;
    }
    .att-file {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      color: var(--lf-accent);
      font-size: 13px;
      text-decoration: none;
    }
    .att-file:hover { background: var(--lf-panel-hover); text-decoration: none; }

    /* Gmail attachment metadata pills — non-clickable, shown under a
       message body so the operator sees what was attached even though
       the bytes aren't stored yet. Click-to-download lands once
       attachments get uploaded to Firebase Storage. */
    .att-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--lf-border);
    }
    .att-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 999px;
      color: var(--lf-text-muted);
      font-size: 11px;
      cursor: default;
    }
    .att-pill .att-size {
      color: var(--lf-text-dim);
      font-size: 10px;
      font-feature-settings: "tnum";
    }

    /* Media grid: image thumbnails + inline videos side by side. */
    .att-media-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--lf-border);
    }
    .att-media {
      display: inline-block;
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      overflow: hidden;
      text-decoration: none;
    }
    .att-image {
      max-width: 220px;
      max-height: 220px;
      line-height: 0;
    }
    .att-image img {
      display: block;
      max-width: 100%;
      max-height: 220px;
      object-fit: cover;
    }
    .att-image:hover { border-color: var(--lf-accent); }
    .att-video {
      max-width: 360px;
      max-height: 260px;
      width: 100%;
    }
    .att-video video {
      display: block;
      max-width: 100%;
      max-height: 260px;
    }

    /* File grid: non-media downloads (PDF / audio / other). */
    .att-file-grid {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--lf-border);
    }
    .att-download {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      color: var(--lf-text);
      text-decoration: none;
      font-size: 13px;
      max-width: 360px;
      transition: border-color 0.12s, background 0.12s;
    }
    .att-download:hover {
      border-color: var(--lf-accent);
      background: var(--lf-panel-hover);
      text-decoration: none;
    }
    .att-download .att-name {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .att-download .att-size {
      color: var(--lf-text-dim);
      font-size: 11px;
      font-feature-settings: "tnum";
      flex-shrink: 0;
    }
    .att-download .att-dl-arrow {
      color: var(--lf-accent);
      font-weight: 700;
      flex-shrink: 0;
    }

    /* Shared product / discount card */
    .share-card {
      display: flex;
      gap: 12px;
      align-items: center;
      padding: 12px;
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 10px;
      text-decoration: none;
      max-width: 380px;
    }
    .share-card:hover { background: var(--lf-panel-hover); text-decoration: none; }
    .share-card img {
      width: 54px; height: 54px;
      object-fit: cover;
      border-radius: 6px;
      flex-shrink: 0;
    }
    .share-card-body { flex: 1 1 auto; min-width: 0; }
    .share-card-label {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--lf-accent);
      font-weight: 600;
      margin-bottom: 2px;
    }
    .share-card-title {
      font-weight: 600;
      color: var(--lf-text);
      font-size: 14px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .share-card-summary {
      font-size: 12px;
      color: var(--lf-text-muted);
      margin-top: 2px;
    }

    .customer-card {
      background: linear-gradient(180deg, rgba(107,160,255,0.04) 0%, var(--lf-panel) 100%);
      border: 1px solid var(--lf-border);
      border-left: 3px solid var(--lf-accent);
      border-radius: 12px;
      padding: 18px 22px;
      margin-bottom: 24px;
      position: relative;
    }
    .customer-card.loading-state { min-height: 96px; }
    .customer-card .unmatched {
      color: var(--lf-text-dim); font-style: italic; font-size: 13px;
    }
    .cust-top {
      display: flex; justify-content: space-between; align-items: flex-start;
      gap: 14px;
    }
    .cust-identity { flex: 1 1 auto; min-width: 0; }
    .vip-star {
      display: inline-block;
      margin-left: 4px;
      font-size: 0.85em;
      vertical-align: middle;
      filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
    }
    .cust-name {
      font-size: 18px; font-weight: 700; color: var(--lf-text);
      line-height: 1.2; margin: 0;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .cust-contact {
      color: var(--lf-text-muted); font-size: 12.5px; margin-top: 4px;
    }
    .cust-shop-link {
      display: inline-flex; align-items: center; gap: 4px;
      font-size: 12px; font-weight: 600; color: var(--lf-accent);
      padding: 6px 12px; border-radius: 6px;
      background: rgba(107,160,255,0.10); border: 1px solid rgba(107,160,255,0.18);
      text-decoration: none; white-space: nowrap; flex-shrink: 0;
    }
    .cust-shop-link:hover {
      background: rgba(107,160,255,0.20); border-color: rgba(107,160,255,0.35);
      text-decoration: none;
    }
    .cust-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
      gap: 10px;
      margin-top: 16px;
    }
    .cust-stat {
      background: var(--lf-panel-alt);
      border: 1px solid var(--lf-border);
      border-radius: 8px;
      padding: 10px 12px;
      text-align: center;
    }
    .cust-stat-value {
      font-size: 19px; font-weight: 700; color: var(--lf-text); line-height: 1.15;
    }
    .cust-stat-label {
      font-size: 10px; color: var(--lf-text-dim);
      text-transform: uppercase; letter-spacing: 0.6px; margin-top: 4px;
      font-weight: 600;
    }
    .cust-tags { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
    .cust-tag {
      background: rgba(107,160,255,0.12); color: var(--lf-accent);
      font-size: 11px; padding: 3px 10px; border-radius: 10px; font-weight: 500;
    }
    .cust-spinner {
      display: flex; align-items: center; gap: 10px;
      color: var(--lf-text-dim); font-size: 13px;
      padding: 8px 0;
    }
    .cust-spinner::before {
      content: ""; display: inline-block;
      width: 16px; height: 16px;
      border: 2px solid rgba(107,160,255,0.15); border-top-color: var(--lf-accent);
      border-radius: 50%; animation: lf-spin 0.8s linear infinite;
    }
    @keyframes lf-spin { to { transform: rotate(360deg); } }

    .mobile-back {
      display: none;
      background: none; border: 0; color: var(--lf-accent-hover);
      font-size: 14px; font-weight: 600; cursor: pointer;
      padding: 0 0 12px 0;
    }

    .mobile-customer-btn { display: none; }
    .mobile-sidebar-close { display: none; }
    .sidebar-backdrop { display: none; }

    @media (max-width: 1200px) {
      .crm-layout { grid-template-columns: 320px 1fr 280px; }
    }
    @media (max-width: 1000px) {
      .crm-layout { grid-template-columns: 320px 1fr; }
      /* Sidebar becomes a slide-in overlay on the right side of the
       * middle panel. Hidden by default; toggled via body.customer-visible
       * when the user taps the right-arrow chevron on a selected conversation. */
      .conv-sidebar {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: min(360px, 92vw);
        border-left: 1px solid var(--lf-border);
        background: var(--lf-panel);
        /* Above the shared admin nav (z-index 9999) so the sidebar acts
         * as a full-height drawer — the whole screen is covered on mobile,
         * not just the space below the nav bar. */
        z-index: 10001;
        transform: translateX(100%);
        transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
        box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
        padding-top: 18px;
      }
      body.customer-visible .conv-sidebar { transform: translateX(0); }
      /* Chevron tab button — only appears when a conversation is selected
       * so we're not prompting the user to open an empty sidebar. */
      body.conv-selected .mobile-customer-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        width: 28px;
        height: 56px;
        background: var(--lf-panel);
        border: 1px solid var(--lf-border);
        border-right: 0;
        border-radius: 8px 0 0 8px;
        color: var(--lf-accent);
        font-size: 20px;
        font-weight: 700;
        cursor: pointer;
        /* Same stack as the nav (9999) but just above, so the tab floats
         * over the nav without being obscured when scrolled. */
        z-index: 9998;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
      }
      body.customer-visible .mobile-customer-btn { display: none; }
      /* Sticky close button pinned to the visible top of the sidebar so it
       * never scrolls out of view. Matches the inbox mobile-back button in
       * tone (subtle, not competing with content). */
      .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: sticky;
        top: 0;
        float: right;
        margin: -6px -6px 6px 0;
        width: 32px;
        height: 32px;
        background: var(--lf-panel-alt, rgba(0,0,0,0.15));
        border: 1px solid var(--lf-border);
        border-radius: 50%;
        color: var(--lf-text-muted);
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        z-index: 2;
      }
      .mobile-sidebar-close:hover {
        background: var(--lf-panel-hover);
        color: var(--lf-text);
      }
      /* Dim the rest of the screen and capture taps to close. Only active
       * when the sidebar is open. */
      .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        /* One below the sidebar, one above the shared admin nav. */
        z-index: 10000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
      }
      body.customer-visible .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
      }
    }
    @media (max-width: 768px) {
      .top-bar { padding: 8px 14px; }
      .top-bar h1 { font-size: 15px; }
      .top-bar .user-email { display: none; }

      .crm-layout { grid-template-columns: 1fr; }
      .conv-list { border-right: 0; }
      .conv-detail { padding: 14px 16px; }
      /* .conv-sidebar stays as a fixed slide-in overlay — inherited from
       * the <=1000px breakpoint. Don't `display:none` it here or the
       * toggle button can't reveal it. */

      body.conv-selected .conv-list { display: none; }
      body:not(.conv-selected) .conv-detail { display: none; }

      .mobile-back { display: inline-block; }

      .conv-header h2 { font-size: 18px; }
      .msg { padding: 12px 14px; }
    }
