/* ============================================================
   Conversations page (STEP 4.5) — 100% match of
   _design/zain-os/project/Conversations - B.html
   Agent workspace + drill-in overlay. No design changes.
   ============================================================ */

/* ───── Workspace head ───── */
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.workspace-head h1 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 4px 0; color: var(--text); }
.workspace-head .sub { font-size: 13px; color: var(--text-secondary); }
.workspace-head .sub .brand { color: var(--brand); font-weight: 600; }
.workspace-head-actions { display: flex; gap: 8px; align-items: center; }
.cv-add-lead { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; background: var(--brand); color: #fff; border: 0; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.cv-add-lead:hover { background: var(--brand-hover); }
.cv-add-lead svg { width: 12px; height: 12px; }

/* Conversation search (last-4 digits / name) */
.cv-search-wrap {
  position: relative;
}
.cv-search-input {
  height: 32px;
  width: 240px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease, width 140ms ease;
}
.cv-search-input::placeholder { color: var(--text-tertiary); }
.cv-search-input:focus {
  border-color: var(--brand);
  background: rgba(232,97,58,0.05);
  width: 320px;
}
.cv-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  z-index: 60;
  padding: 4px;
}
.cv-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 120ms ease;
}
.cv-search-row:hover, .cv-search-row.is-active {
  background: rgba(232,97,58,0.10);
}
.cv-search-row-main { min-width: 0; flex: 1; }
.cv-search-row-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-search-row-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-search-row-tail {
  color: var(--brand);
  font-weight: 700;
  margin-left: 6px;
}
.cv-search-row-state {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.cv-state-agent  { background: rgba(120,180,120,0.18); color: #b8e0b8; }
.cv-state-needs  { background: rgba(232,97,58,0.18);   color: var(--brand); }
.cv-state-you    { background: rgba(232,150,40,0.18);  color: #ffd082; }
.cv-state-closed { background: rgba(255,255,255,0.06); color: var(--text-tertiary); }
.cv-search-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Live-sync indicator + refresh button */
.cv-sync { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-pill); font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); letter-spacing: 0.02em; }
.cv-sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); flex-shrink: 0; }
.cv-sync[data-state="live"] .cv-sync-dot { background: #6A8A70; box-shadow: 0 0 0 3px rgba(106,138,112,0.15); animation: cv-sync-pulse 1.4s ease-in-out infinite; }
.cv-sync[data-state="polling"] .cv-sync-dot { background: #C99A52; }
.cv-sync[data-state="waiting"] .cv-sync-dot { background: #C99A52; animation: cv-sync-pulse 1.4s ease-in-out infinite; }
.cv-sync[data-state="waiting"] { color: #C99A52; }
@keyframes cv-sync-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.cv-refresh-btn { width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--border-light); color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.cv-refresh-btn:hover { color: var(--brand); border-color: var(--brand-dim); }
.cv-refresh-btn svg { width: 13px; height: 13px; }
.cv-refresh-btn:active svg { animation: cv-refresh-spin 0.6s linear; }
@keyframes cv-refresh-spin { to { transform: rotate(360deg); } }

/* ───── Agent status hero ───── */
.agent-hero {
  display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
  padding: 18px 22px;
  background: radial-gradient(ellipse at top left, rgba(232,97,58,0.10), transparent 60%), var(--card);
  border: 1px solid var(--brand-dim); border-radius: var(--r-md);
  margin-bottom: 20px; position: relative; overflow: hidden;
}
.agent-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.agent-orb {
  width: 64px; height: 64px; border-radius: 50%; background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; position: relative;
  box-shadow: 0 0 0 8px rgba(232,97,58,0.08), 0 0 0 16px rgba(232,97,58,0.04);
}
.agent-orb svg { width: 28px; height: 28px; }
.agent-orb.is-paused { background: var(--text-tertiary); box-shadow: none; }
.agent-orb:not(.is-paused)::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid var(--brand); opacity: 0.4; animation: ping 2.2s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.4; } 100% { transform: scale(1.35); opacity: 0; } }
.agent-hero-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.agent-hero-status { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.08em; }
.agent-hero-status .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.agent-hero-status.is-paused { color: var(--text-tertiary); }
.agent-hero-status.is-paused .live-dot { background: var(--text-tertiary); animation: none; }
.agent-hero-title { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.agent-hero-title .activity-word { color: var(--brand); font-weight: 700; }
.agent-hero-title .count { font-variant-numeric: tabular-nums; }
.agent-hero-meta { display: flex; gap: 18px; font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.agent-hero-meta .stat strong { color: var(--text); font-weight: 600; }

.pause-all-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit;
}
.pause-all-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft, rgba(161,63,40,0.1)); }
.pause-all-btn svg { width: 13px; height: 13px; }

/* ───── Metric strip ───── */
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.metric-strip .metric-card { padding: 14px 18px; gap: 6px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-md); display: flex; flex-direction: column; }
.metric-strip .metric-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.metric-strip .metric-value { font-size: 22px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.metric-strip .metric-sub { font-size: 11px; color: var(--text-tertiary); }
.metric-strip .spark { display: flex; align-items: flex-end; gap: 2px; height: 20px; margin-top: 4px; }
.metric-strip .spark span { width: 4px; background: var(--brand-dim); border-radius: 1px; }
.metric-strip .spark span:last-child { background: var(--brand); }

/* ───── Board ───── */
.board {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
  min-height: 500px;
}
.column { background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-md); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.column.is-urgent { border-color: var(--brand-dim); background: linear-gradient(180deg, var(--brand-subtle) 0%, var(--card) 80px); }
.col-header { padding: 12px 14px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.col-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); }
.col-title svg { width: 14px; height: 14px; }
.col-count { font-size: 11px; font-weight: 700; color: var(--text-secondary); background: var(--hover); border-radius: var(--r-pill); padding: 2px 8px; font-variant-numeric: tabular-nums; }
.column.is-urgent .col-title { color: var(--brand); }
.column.is-urgent .col-count { background: var(--brand); color: #fff; }
.col-desc { font-size: 10px; color: var(--text-tertiary); padding: 0 14px 10px; font-weight: 500; letter-spacing: 0.02em; }
.col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 720px; }
.col-body-empty { color: var(--text-tertiary); font-size: 11px; font-style: italic; text-align: center; padding: 20px 8px; }

/* ───── Conversation card ───── */
.conv-card { background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--r-sm); padding: 12px; cursor: pointer; transition: border-color 150ms, transform 150ms; display: flex; flex-direction: column; gap: 8px; position: relative; }
.conv-card:hover { border-color: var(--brand-dim); transform: translateY(-1px); }
.conv-card.is-urgent { border-color: var(--brand); background: var(--brand-subtle); }
.conv-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }

.conv-card-top { display: flex; align-items: center; gap: 8px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--hover); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; position: relative; text-transform: uppercase; }
.avatar-sm .chan-dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--bg); display: inline-flex; align-items: center; justify-content: center; }
.avatar-sm .chan-dot svg { width: 6px; height: 6px; color: var(--brand); }
.conv-card-top .name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.conv-card-top .time { font-size: 10px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ar { font-family: var(--font-arabic); }

.conv-card-meta { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-secondary); flex-wrap: wrap; }
.conv-card-meta .unit { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
.conv-card-meta .score { color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.conv-card-meta .score.cold { color: var(--text-tertiary); }

.conv-card-preview { font-size: 12px; color: var(--text-secondary); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-wrap: break-word; }
.conv-card-preview.from-agent::before { content: "Agent: "; color: var(--brand); font-weight: 600; }
.conv-card-preview.from-zain::before { content: "You: "; color: var(--brand); font-weight: 600; }
.conv-card-preview.from-them::before { content: "→ "; color: var(--text-tertiary); font-weight: 700; }

.agent-reasoning { display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; background: var(--brand-soft); border: 1px solid var(--brand-dim); border-radius: 4px; font-size: 10px; color: var(--brand); font-weight: 500; line-height: 1.35; }
.agent-reasoning svg { width: 11px; height: 11px; flex-shrink: 0; margin-top: 1px; }

.why-escalated { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--brand); color: #fff; border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 1.35; }
.why-escalated svg { width: 11px; height: 11px; flex-shrink: 0; }

.card-actions { display: flex; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border-light); }
.card-actions .chip-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 26px; padding: 0 8px; background: transparent; border: 1px solid var(--border-light); border-radius: 4px; font-size: 10px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit; }
.card-actions .chip-btn:hover { border-color: var(--brand-dim); color: var(--brand); background: var(--brand-soft); }
.card-actions .chip-btn svg { width: 10px; height: 10px; }
.card-actions .chip-btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.card-actions .chip-btn.primary:hover { background: var(--brand-hover); }

.qual-steps { display: flex; gap: 3px; margin-top: 2px; }
.qual-steps .step { flex: 1; height: 3px; background: var(--hover); border-radius: 2px; }
.qual-steps .step.done { background: var(--brand); }
.qual-steps .step.active { background: var(--brand-dim); }

.hint-double { position: absolute; top: 8px; right: 8px; padding: 2px 6px; background: var(--brand); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 3px; opacity: 0; transition: opacity 150ms; pointer-events: none; }
.conv-card:hover .hint-double { opacity: 1; }

/* Drag and drop between columns */
.conv-card { cursor: grab; }
.conv-card:active { cursor: grabbing; }
.cv-ghost { opacity: 0.35; background: var(--hover) !important; border-style: dashed !important; }
.cv-chosen { box-shadow: 0 0 0 2px var(--brand); }
.col-body[data-cv-dropzone] { min-height: 80px; }
.col-body[data-cv-dropzone].drag-over { background: var(--brand-soft); outline: 1px dashed var(--brand-dim); outline-offset: -4px; border-radius: 4px; }

/* Sparkles "AI suggest" loading spinner */
.tool-btn.is-loading svg { animation: cv-suggest-spin 0.9s linear infinite; color: var(--brand); }
@keyframes cv-suggest-spin { to { transform: rotate(360deg); } }
.tool-btn#cv-suggest-btn:hover { background: var(--brand-soft); color: var(--brand); }

/* Dim closed cards */
.conv-card.is-closed { opacity: 0.72; }

/* Board empty state */
.board-empty {
  grid-column: 1 / -1;
  padding: 60px 20px; text-align: center; color: var(--text-tertiary);
  background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-md);
}
.board-empty svg { width: 32px; height: 32px; color: var(--text-tertiary); margin-bottom: 12px; }
.board-empty .title { font-size: 15px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.board-empty .sub { font-size: 12px; color: var(--text-secondary); }

/* ───── Drill-in overlay ───── */
.drill-scrim { position: fixed; inset: 0; background: rgba(10,8,7,0.55); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 220ms ease; z-index: 200; }
.drill-scrim.is-open { opacity: 1; pointer-events: auto; }
.drill {
  position: fixed;
  top: 50%; left: 50%;
  width: min(1400px, calc(100vw - 60px));
  height: min(900px, calc(100vh - 40px));
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px;
  display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto 1fr;
  grid-template-areas: "head head" "thread ctx";
  transform: translate(-50%, -50%) scale(0.96); opacity: 0; pointer-events: none;
  transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 180ms ease;
  z-index: 210; box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(232,97,58,0.08);
  min-height: 0; overflow: hidden;
}
.drill.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }

.drill-head { grid-area: head; display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border-light); background: var(--bg); border-radius: 20px 20px 0 0; }
.drill-head .avatar-md { width: 32px; height: 32px; border-radius: 50%; background: var(--hover); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; position: relative; text-transform: uppercase; }
.drill-head .avatar-md .chan-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; }
.drill-head .avatar-md .chan-dot svg { width: 7px; height: 7px; color: var(--brand); }
.drill-head .who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.drill-head .who-name { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.drill-head .score-badge { font-size: 11px; font-weight: 700; background: var(--brand); color: #fff; border-radius: var(--r-pill); padding: 1px 8px; font-variant-numeric: tabular-nums; }
.drill-head .score-badge.cold { background: var(--hover); color: var(--text-tertiary); }
.drill-head .who-meta { font-size: 11px; color: var(--text-secondary); }
.drill-head .drill-actions { display: flex; gap: 4px; }
.drill-head .icon-btn { width: 32px; height: 32px; border-radius: 6px; background: transparent; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; }
.drill-head .icon-btn:hover { background: var(--hover); color: var(--text); }
.drill-head .icon-btn svg { width: 15px; height: 15px; }
.drill-head .close-btn { margin-left: 4px; }

.drill-thread { grid-area: thread; display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--border-light); }

.drill-toolbar { padding: 10px 20px; display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border-light); background: var(--bg); align-items: center; }
.drill-toolbar .tb-lbl { font-size: 10px; color: var(--text-tertiary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; }
.drill-toolbar .tb-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit; }
.drill-toolbar .tb-btn:hover { border-color: var(--brand-dim); color: var(--text); }
.drill-toolbar .tb-btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.drill-toolbar .tb-btn.primary:hover { background: var(--brand-hover); }
.drill-toolbar .tb-btn svg { width: 12px; height: 12px; }

.agent-control { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--brand-subtle); border-bottom: 1px solid var(--brand-dim); }
.agent-control.is-paused { background: var(--hover); border-bottom-color: var(--border); }
.agent-status { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 12px; min-width: 0; }
.agent-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-in-out infinite; flex-shrink: 0; }
.agent-control.is-paused .agent-status .dot { background: var(--text-tertiary); animation: none; }
.agent-status .lbl { font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; flex-shrink: 0; }
.agent-control.is-paused .agent-status .lbl { color: var(--text-secondary); }
.agent-status .detail { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-pill); font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer; flex-shrink: 0; font-family: inherit; }
.toggle-btn:hover { border-color: var(--brand-dim); color: var(--text); }
.toggle-btn svg { width: 12px; height: 12px; }

.thread-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.thread-empty { padding: 40px 20px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.day-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--text-tertiary); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.day-divider::before, .day-divider::after { content: ""; height: 1px; background: var(--border-light); flex: 1; }
/* WhatsApp-style layout: lead LEFT, you/agent RIGHT.
   - Lead inbound → from-them → flex-start (LEFT)
   - AI agent reply → from-agent → flex-end (RIGHT, with distinct style)
   - Zain manual reply → from-us → flex-end (RIGHT, solid brand)
*/
.msg-row { display: flex; flex-direction: column; margin-bottom: 10px; }
.msg-row.from-them { align-items: flex-start; }
.msg-row.from-us { align-items: flex-end; }
.msg-row.from-agent { align-items: flex-end; }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; word-wrap: break-word; color: var(--text); }
.bubble.from-them { background: #332F2B; color: var(--text); border-bottom-left-radius: 4px; }
.bubble.from-us { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.from-agent { background: var(--brand-soft); border: 1px solid var(--brand-dim); color: var(--text); border-bottom-right-radius: 4px; }
/* Sender label above agent/zain bubbles (WhatsApp-style differentiation) */
.msg-row.from-agent::before { content: 'Zain agent · auto'; display: block; font-size: 9px; font-weight: 700; color: var(--brand); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; padding-right: 4px; font-family: var(--font-mono); }
.msg-row.from-us::before { content: 'You'; display: block; font-size: 9px; font-weight: 700; color: var(--brand); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; padding-right: 4px; font-family: var(--font-mono); }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 10px; color: var(--text-tertiary); padding: 0 4px; font-variant-numeric: tabular-nums; }
.msg-meta .read { color: var(--brand); }
.msg-meta .author { font-weight: 600; }

/* Optimistic send states — the bubble shows up instantly with a status chip */
.bubble.is-pending { opacity: 0.72; }
.bubble.is-pending.sent { opacity: 1; }
.bubble.is-failed { opacity: 0.9; border: 1px solid var(--danger); }

.msg-status { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.02em; }
.msg-status svg { width: 10px; height: 10px; }
.msg-status.sending { color: var(--text-secondary); }
.msg-status.sending svg { animation: cv-spin 1.2s linear infinite; }
.msg-status.sent { color: var(--brand); }
.msg-status.delivered { color: var(--brand); display: inline-flex; align-items: center; }
.msg-status.delivered .second-check { margin-left: -7px; }
.msg-status.failed { color: var(--danger); }

.msg-retry {
  border: 1px solid var(--brand); background: transparent; color: var(--brand);
  padding: 1px 7px; border-radius: 10px; font-size: 9.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.msg-retry:hover { background: var(--brand); color: #fff; }

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

/* Send button spinner state */
.composer .send-btn.is-sending { opacity: 0.7; pointer-events: none; }
.composer .send-btn.is-sending svg { animation: cv-spin 0.9s linear infinite; }

.bubble .pdf-attach { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bubble .pdf-attach .pdf-icon { width: 32px; height: 38px; background: rgba(0,0,0,0.2); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.bubble .pdf-attach .pdf-name { font-size: 12px; font-weight: 600; }
.bubble .pdf-attach .pdf-sub { font-size: 10px; opacity: 0.75; }

.system-event { align-self: center; max-width: 80%; padding: 6px 12px; background: var(--hover); border: 1px solid var(--border-light); border-radius: var(--r-pill); font-size: 10px; color: var(--text-secondary); margin: 6px 0; display: inline-flex; align-items: center; gap: 6px; }
.system-event svg { width: 11px; height: 11px; }
.system-event.brand { border-color: var(--brand-dim); background: var(--brand-subtle); color: var(--brand); }

/* Voice message bubble (inbound) */
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 200px; cursor: pointer; }
.voice-msg .play { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.08); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.voice-msg .play svg { width: 12px; height: 12px; color: var(--text); }
.bubble.from-them .voice-msg .play { background: rgba(255,255,255,0.08); }
.bubble.from-agent .voice-msg .play,
.bubble.from-us .voice-msg .play { background: rgba(0,0,0,0.2); }
.voice-msg .wave { flex: 1; height: 16px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px); opacity: 0.55; }
.voice-msg .dur { font-size: 10px; opacity: 0.75; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.voice-transcript { margin-top: 6px; padding: 8px 10px; background: rgba(0,0,0,0.25); border-radius: 8px; font-size: 11px; color: var(--text-secondary); font-style: italic; line-height: 1.4; }
.voice-transcript .vt-lbl { font-size: 9px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; font-style: normal; font-family: var(--font-mono); }

.suggestions { display: flex; gap: 6px; padding: 8px 20px 0; flex-wrap: wrap; }
.suggestion { padding: 6px 12px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-pill); font-size: 12px; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.suggestion:hover { border-color: var(--brand-dim); color: var(--text); }
.suggestion svg { width: 10px; height: 10px; color: var(--brand); }

.composer { border-top: 1px solid var(--border-light); padding: 12px 20px 14px; background: var(--bg); }
.composer-tabs { display: flex; gap: 2px; margin-bottom: 10px; }
.composer-tab { padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--text-tertiary); border-radius: var(--r-sm); cursor: pointer; background: transparent; border: 0; font-family: inherit; }
.composer-tab.is-active { color: var(--brand); background: var(--brand-soft); }
.composer-box { background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-md); padding: 10px 12px; display: flex; align-items: flex-end; gap: 10px; }
.composer-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.composer-box textarea { flex: 1; background: transparent; border: 0; outline: 0; resize: none; color: var(--text); font-size: 14px; line-height: 1.45; min-height: 22px; max-height: 140px; padding: 2px 0; font-family: inherit; }
.composer-box textarea::placeholder { color: var(--text-tertiary); }
.composer-tools { display: flex; align-items: center; gap: 2px; }
.tool-btn { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; background: transparent; border: 0; }
.tool-btn:hover { background: var(--hover); color: var(--text); }
.tool-btn svg { width: 15px; height: 15px; }
.send-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border: 0; }
.send-btn:hover { background: var(--brand-hover); }
.send-btn svg { width: 14px; height: 14px; }
.composer-hint { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--text-tertiary); padding: 0 4px; }
.composer-hint strong { color: var(--text); }
.composer-hint kbd { font-family: var(--font-mono); font-size: 9px; border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; background: var(--card); }

/* ───── Context rail ───── */
.drill-ctx { grid-area: ctx; background: var(--bg); overflow-y: auto; min-height: 0; }
.ctx-header { padding: 18px 20px; border-bottom: 1px solid var(--border-light); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ctx-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; border: 1px solid var(--brand-dim); text-transform: uppercase; }
.ctx-name { font-size: 15px; font-weight: 600; color: var(--text); }
.ctx-name-ar { font-size: 14px; color: var(--text-secondary); font-family: var(--font-arabic); }
.ctx-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ctx-tags .badge { padding: 2px 8px; border-radius: var(--r-pill); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ctx-tags .badge-soft { background: var(--brand-soft); color: var(--brand); }
.ctx-tags .badge-outline { border: 1px solid var(--border); color: var(--text-secondary); }
.ctx-section { padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.ctx-section:last-child { border-bottom: 0; }
.ctx-label { font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.ctx-label .btn-inline { background: transparent; border: 0; color: var(--brand); cursor: pointer; font-family: inherit; font-size: 10px; font-weight: 600; padding: 0; }
.ctx-label .btn-inline:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 12px; }
.kv .k { color: var(--text-secondary); }
.kv .v { color: var(--text); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }
.kv .v.brand { color: var(--brand); }
.kv .v.muted { color: var(--text-tertiary); font-style: italic; }

.unit-chip { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--r-sm); cursor: pointer; text-decoration: none; color: inherit; }
.unit-chip:hover { border-color: var(--brand-dim); }
.unit-chip .u-thumb { width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0; overflow: hidden; background: var(--bg-900, #1a1815); border: 1px solid var(--border-light); }
.unit-chip .u-info { flex: 1; min-width: 0; }
.unit-chip .u-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.unit-chip .u-sub { font-size: 10px; color: var(--text-secondary); font-family: var(--font-mono); }
.unit-chip .u-price { font-size: 11px; font-weight: 600; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }

.activity-item { display: flex; gap: 10px; padding: 8px 0; font-size: 11px; }
.activity-item .a-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-dim); margin-top: 6px; flex-shrink: 0; }
.activity-item .a-title { color: var(--text); font-weight: 500; }
.activity-item .a-meta { color: var(--text-tertiary); font-size: 10px; margin-top: 2px; }

.briefing { background: var(--brand-subtle); border: 1px solid var(--brand-dim); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.briefing .b-lbl { font-size: 9px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; gap: 6px; }
.briefing .b-lbl svg { width: 11px; height: 11px; }
.briefing .b-row { display: flex; gap: 6px; font-size: 11px; line-height: 1.4; }
.briefing .b-row .b-k { color: var(--text-tertiary); font-weight: 600; min-width: 48px; flex-shrink: 0; }
.briefing .b-row .b-v { color: var(--text); word-break: break-word; }

/* Template popover (above composer) */
.template-popover { position: absolute; left: 20px; right: 20px; bottom: calc(100% + 6px); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; display: none; flex-direction: column; gap: 4px; box-shadow: var(--shadow-md); z-index: 5; max-height: 300px; overflow-y: auto; }
.template-popover.is-open { display: flex; }
.template-popover .tmpl-label { font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 10px 4px; }
.template-popover .tmpl-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-family: inherit; color: var(--text); }
.template-popover .tmpl-item:hover { background: var(--hover); }
.template-popover .tmpl-item .ti-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; font-family: var(--font-mono); }
.template-popover .tmpl-item .ti-text { font-size: 13px; line-height: 1.4; }
.template-popover .tmpl-item.ar .ti-text { font-family: var(--font-arabic); direction: rtl; text-align: right; }

.composer { position: relative; }

/* Presentation picker modal (inline overlay on top of drill) */
.pres-picker-scrim { position: fixed; inset: 0; background: rgba(10,8,7,0.65); z-index: 250; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
.pres-picker-scrim.is-open { opacity: 1; pointer-events: auto; }
.pres-picker { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); width: 520px; max-width: calc(100vw - 40px); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; transform: scale(0.96); transition: transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1); }
.pres-picker-scrim.is-open .pres-picker { transform: scale(1); }
.pres-picker-head { padding: 16px 20px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 12px; }
.pres-picker-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.pres-picker-head .close { width: 26px; height: 26px; border-radius: 6px; background: transparent; border: 0; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pres-picker-head .close:hover { background: var(--hover); color: var(--text); }
.pres-picker-head .close svg { width: 14px; height: 14px; }
.pres-picker-search { padding: 10px 20px 0; }
.pres-picker-search input { width: 100%; height: 32px; padding: 0 12px; background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font-size: 13px; font-family: inherit; }
.pres-picker-search input:focus { outline: none; border-color: var(--brand-dim); }
.pres-picker-body { flex: 1; overflow-y: auto; padding: 10px 20px 16px; display: flex; flex-direction: column; gap: 6px; }
.pres-picker-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--r-sm); cursor: pointer; transition: border-color 150ms; text-align: left; font-family: inherit; color: var(--text); }
.pres-picker-item:hover { border-color: var(--brand-dim); }
.pres-picker-item .p-thumb { width: 36px; height: 36px; border-radius: 6px; overflow: hidden; background: var(--bg-900, #1a1815); border: 1px solid var(--border-light); flex-shrink: 0; }
.pres-picker-item .p-info { flex: 1; min-width: 0; }
.pres-picker-item .p-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres-picker-item .p-sub { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }
.pres-picker-item .p-price { font-size: 12px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pres-picker-item .p-queue-status { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; min-width: 70px; text-align: right; white-space: nowrap; }
.pres-picker-item.is-queued { opacity: 0.85; }
.pres-picker-item.is-queued .p-queue-status { color: var(--text-secondary); }
.pres-picker-item.is-sending { opacity: 0.7; pointer-events: none; }
.pres-picker-item.is-sending .p-queue-status { color: var(--brand); }
.pres-picker-item.is-done { opacity: 0.55; pointer-events: none; }
.pres-picker-item.is-done .p-queue-status { color: var(--success, #4ade80); }
.pres-picker-item.is-failed .p-queue-status { color: var(--danger, #ef4444); }
.pres-picker-foot { padding: 12px 20px; border-top: 1px solid var(--border-light); font-size: 11px; color: var(--text-tertiary); }

/* Info popover (drill-head info button) */
.info-popover { position: absolute; top: 52px; right: 24px; width: 280px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; display: none; flex-direction: column; gap: 10px; box-shadow: var(--shadow-md); z-index: 4; }
.info-popover.is-open { display: flex; }
.info-popover .ip-title { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
.info-popover .ip-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.info-popover .ip-row .k { color: var(--text-secondary); min-width: 80px; flex-shrink: 0; }
.info-popover .ip-row .v { color: var(--text); font-weight: 500; flex: 1; word-break: break-word; font-variant-numeric: tabular-nums; }
.info-popover .ip-row .v.brand { color: var(--brand); }
.info-popover .ip-foot { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.info-popover .ip-foot button { flex: 1; height: 28px; padding: 0 10px; background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-secondary); font-size: 11px; font-weight: 500; cursor: pointer; font-family: inherit; }
.info-popover .ip-foot button:hover { border-color: var(--brand-dim); color: var(--text); }

@media (max-width: 1100px) {
  .drill { width: calc(100vw - 32px); height: calc(100vh - 32px); grid-template-columns: 1fr; grid-template-areas: "head" "thread"; }
  .drill-ctx { display: none; }
}
@media (max-width: 1200px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .board { grid-template-columns: 1fr; } .metric-strip { grid-template-columns: 1fr; } }

/* ============================================================
   Responsive (additive — does not alter desktop ≥1025px)
   No tables on this page; layout-only adjustments.
   ============================================================ */

/* Tablet / iPad portrait */
@media (max-width: 1024px) {
  /* Workspace header wraps */
  .workspace-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .workspace-head-actions { flex-wrap: wrap; gap: 8px; }

  /* Agent hero compacts */
  .agent-hero { grid-template-columns: auto 1fr; padding: 14px 16px; gap: 14px; }
  .agent-hero .pause-all-btn { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .agent-orb { width: 56px; height: 56px; }
  .agent-orb svg { width: 24px; height: 24px; }
  .agent-hero-title { font-size: 16px; }
  .agent-hero-meta { gap: 12px; }

  /* Metric strip + board fold to 2-up at ≤1024 (already 2-up at ≤1200; this is harmless reinforcement) */
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Hover-only affordances visible by default */
  .conv-card .hint-double { opacity: 1; }
  .card-actions { display: flex; }

  /* Drill: stack to single column (was hiding ctx at 1100; here also collapses cleanly) */
  .drill { width: calc(100vw - 24px); height: calc(100vh - 24px); grid-template-columns: 1fr; grid-template-areas: "head" "thread"; }
  .drill-ctx { display: none; }
  .drill-head { padding: 12px 16px; }
  .drill-toolbar { padding: 8px 14px; gap: 6px; }
  .thread-scroll { padding: 12px 14px; }
  .composer { padding: 10px 14px 12px; }
}

/* Phone */
@media (max-width: 640px) {
  .workspace-head h1 { font-size: 20px; }
  .workspace-head .sub { font-size: 12px; }
  .workspace-head-actions { width: 100%; }
  .cv-add-lead {
    width: 100%;
    justify-content: center;
    height: 40px;
    min-height: 36px;
    font-size: 14px;
  }
  .cv-sync { height: 32px; }
  .cv-refresh-btn { width: 32px; height: 32px; min-height: 32px; }

  /* Agent hero: stack everything */
  .agent-hero {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 14px 14px;
    gap: 12px;
  }
  .agent-orb { width: 48px; height: 48px; }
  .agent-orb svg { width: 22px; height: 22px; }
  .agent-hero-title { font-size: 15px; }
  .agent-hero-meta { font-size: 11px; flex-direction: column; gap: 4px; }
  .pause-all-btn { width: 100%; justify-content: center; }

  /* Metric strip: 1 col */
  .metric-strip { grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
  .metric-strip .metric-card { padding: 12px 14px; }
  .metric-strip .metric-value { font-size: 20px; }

  /* Board: single column, taller per column */
  .board { grid-template-columns: 1fr; gap: 10px; min-height: 0; }
  .column { min-height: 0; }
  .col-body { max-height: 480px; }
  .col-header { padding: 10px 12px; }

  /* Conv cards: tighter */
  .conv-card { padding: 10px; }
  .conv-card-top .name { font-size: 12.5px; }

  /* Drill: full-screen overlay */
  .drill {
    width: 100vw;
    height: 100vh;
    top: 0; left: 0;
    transform: none;
    border-radius: 0;
    border: 0;
  }
  .drill.is-open { transform: none; }
  .drill-head { padding: 10px 12px; border-radius: 0; gap: 8px; }
  .drill-head .avatar-md { width: 28px; height: 28px; font-size: 10px; }
  .drill-head .who-name { font-size: 13px; }
  .drill-toolbar { padding: 6px 12px; gap: 6px; }
  .drill-toolbar .tb-btn { height: 32px; min-height: 32px; padding: 0 10px; font-size: 11px; }
  .agent-control { padding: 8px 12px; }
  .thread-scroll { padding: 10px 12px; }
  .bubble { max-width: 84%; font-size: 13px; padding: 8px 12px; }

  /* Composer: bigger touch targets, ≥16px input to block iOS zoom */
  .composer { padding: 8px 12px 10px; }
  .composer-box { padding: 8px 10px; }
  .composer-box textarea { font-size: 16px; min-height: 24px; }
  .tool-btn { width: 36px; height: 36px; }
  .tool-btn svg { width: 16px; height: 16px; }
  .send-btn { width: 36px; height: 36px; }
  .composer-hint { font-size: 9.5px; }

  /* Suggestions wrap */
  .suggestions { padding: 6px 12px 0; }
  .suggestion { font-size: 11px; padding: 5px 10px; }

  /* Presentation picker fits screen */
  .pres-picker { width: 100%; max-width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .pres-picker-scrim { align-items: stretch; justify-content: stretch; }

  /* Info popover docks to top */
  .info-popover { right: 12px; left: 12px; width: auto; top: 60px; }
}

/* Touch tap targets */
@media (hover: none) and (pointer: coarse) {
  .cv-add-lead,
  .pause-all-btn,
  .drill-toolbar .tb-btn,
  .toggle-btn,
  .card-actions .chip-btn,
  .composer-tab { min-height: 36px; }
  .tool-btn,
  .send-btn,
  .cv-refresh-btn,
  .drill-head .icon-btn { min-width: 36px; min-height: 36px; }
  /* Reveal hover-only affordances on touch */
  .conv-card .hint-double { opacity: 1; }
}

/* ============================================================
   Additional mobile gaps — search box width, drill back button,
   ctx-rail accessibility on small viewports.
   ============================================================ */

/* Tablet/iPad — search input grows with its container */
@media (max-width: 1024px) {
  .cv-search-wrap { flex: 1 1 220px; min-width: 0; }
  .cv-search-input { width: 100%; font-size: var(--fs-13); }
  .cv-search-input:focus { width: 100%; }
  /* Anchor results dropdown to the wrap, not to viewport right edge */
  .cv-search-results {
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
  }
  .workspace-head-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Phone — input becomes full width, dropdown spans full width */
@media (max-width: 640px) {
  .cv-search-wrap {
    flex: 1 1 100%;
    width: 100%;
  }
  .cv-search-input,
  .cv-search-input:focus {
    width: 100%;
    height: 40px;
    font-size: 16px; /* prevent iOS zoom */
  }
  .cv-search-results {
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
    max-height: 60vh;
  }
  .cv-search-row { padding: 11px 12px; }
  .cv-search-row-name { font-size: 14px; }
  /* Workspace actions row at phone — full-width children stack nicely */
  .workspace-head-actions { gap: 6px; }
  .cv-sync { flex: 1 1 auto; min-width: 0; }
  /* Drill thread on a phone fills the full screen — make sure the close
     button is comfortably reachable with a thumb (top-right, generous tap). */
  .drill-head .close-btn {
    width: 40px;
    height: 40px;
    margin-left: 4px;
  }
  .drill-head .close-btn svg { width: 18px; height: 18px; }
  /* Drill head actions cluster — hide non-essential icon-btns to save space
     for close + main info. */
  .drill-head .drill-actions { gap: 2px; }
  /* Toolbar buttons take available width when wrapped */
  .drill-toolbar .tb-lbl { width: 100%; margin-bottom: 2px; }
  /* Composer suggestions don't overflow */
  .suggestions { gap: 5px; }
  .suggestion { font-size: 11.5px; padding: 6px 10px; min-height: 32px; }
  /* Conv-card meta row wraps gracefully */
  .conv-card-meta { gap: 4px; }
  /* Drill scrim is invisible behind full-screen drill — disable to save GPU */
  .drill-scrim { background: transparent; backdrop-filter: none; }
  /* Sync indicator: shrink label on phone */
  .cv-sync .cv-sync-label { display: none; }
  /* Agent control row in drill wraps to keep toggle reachable */
  .agent-control { flex-wrap: wrap; gap: 8px; }
  .agent-status { min-width: 0; }
  .toggle-btn { flex-shrink: 0; }
  /* Presentation picker items don't overflow */
  .pres-picker-item { padding: 12px 10px; gap: 10px; }
  .pres-picker-item .p-name { font-size: 13px; }
  .pres-picker-item .p-queue-status { min-width: 56px; font-size: 9px; }
}

/* Touch — ensure search rows and drill controls are comfortable */
@media (hover: none) and (pointer: coarse) {
  .cv-search-row { min-height: 44px; }
  .pres-picker-item { min-height: 48px; }
  .info-popover .ip-foot button { min-height: 36px; }
}
