/* === Files View === */
.files-header-actions { display: flex; gap: 8px; }

.files-locations {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.files-locations::-webkit-scrollbar { display: none; }
.files-locations:empty { display: none; }
.loc-chip {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.loc-chip:active { opacity: 0.7; }
/* Dead-mount chip (2026-08-30, mount-liveness gate): a /Volumes SMB share
   that failed the liveness probe. Server marks with loc.dead=true; renderer
   in client/js/modules/files.js sets .loc-chip-dead + disabled. Greyed and
   non-clickable so the team sees "the drive is unreachable" instead of
   "the drive vanished." */
.loc-chip-dead {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}

/* === Code Tree (PWA codebase visualization — admin only) === */
.loc-chip-code { border-color: rgba(46, 213, 115, 0.4); color: #2ed573; }
.files-tree { flex: 1; overflow: hidden; display: flex; font-size: 0.82rem; }
.files-tree.hidden { display: none; }
.ct-tree-col { flex: 1; overflow-y: auto; padding: 0 8px 16px; min-width: 0; }
/* Split mode (file open): tree slides to a narrow far-left column, preview
   takes the middle — VS-Code layout with the DM rail staying on the right. */
.files-tree.ct-split .ct-tree-col { flex: 0 0 280px; border-right: 1px solid var(--glass-border); }
.ct-preview-col { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.ct-preview-col.hidden { display: none; }
.ct-preview-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; }
.ct-preview-header .ct-copy { opacity: 1; }
.ct-preview-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Real-path subtitle under the preview filename (tree-locate) — where the file
   actually lives, shown even when the tree can't walk there. */
.ct-preview-path { display: block; font-size: 0.68rem; font-weight: 400; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-preview-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 0 6px; flex-shrink: 0; }
.ct-preview-close:hover { color: var(--text-primary); }
.ct-preview-body { flex: 1; overflow: auto; min-height: 0; }
.ct-preview-code { margin: 0; padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; line-height: 1.5; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.ct-preview-media { max-width: 100%; max-height: 100%; display: block; margin: 16px auto; }
.ct-preview-frame { width: 100%; height: 100%; border: none; }
.ct-preview-other { padding: 24px; color: var(--text-muted); text-align: center; }
/* Truncation note shown atop a capped DM-attachment text preview (in-pane + overlay). */
.ct-preview-trunc, .dm-preview-trunc { padding: 8px 16px; font-size: 0.72rem; color: var(--text-muted); background: var(--glass-bg); border-bottom: 1px solid var(--glass-border); }
.ct-preview-binnote { padding: 10px 16px 0; font-size: 0.72rem; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ct-row.ct-active { background: rgba(46, 213, 115, 0.12); }
.ct-row.ct-active .ct-name { color: #2ed573; }

/* === DM file-reference attachments (Slack-style: INSIDE the composer) ===
   With refs queued, .dm-compose.has-refs becomes the unified Slack box —
   one bordered container holding the text input on top and the attachments
   below it. The textarea sheds its own border/background inside that box. */
.dm-compose.has-refs { flex-wrap: wrap; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 18px; background: rgba(255, 255, 255, 0.06); margin: 8px 12px; margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); padding: 4px 8px; }
/* Inside the DM panel the composer no longer reaches the screen edge — the
   panel stops at the nav top and the nav owns the home-indicator inset
   (#482) — so the env() term above double-counts there. Plain 8px. #general
   keeps the base rule. */
.dm-sidebar .dm-compose.has-refs { margin-bottom: 8px; }
.dm-compose.has-refs textarea { border: none; background: transparent; padding: 10px 8px; }
.dm-compose.has-refs textarea:focus { border: none; }
.dm-file-refs { display: none; }
.dm-compose.has-refs .dm-file-refs { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; padding: 2px 8px 10px; }
.dm-file-ref { position: relative; display: inline-flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 8px 14px 8px 8px; max-width: 300px; }
.dm-file-ref-tile { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; background: rgba(255, 255, 255, 0.09); border-radius: 9px; overflow: hidden; }
.dm-file-ref-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Slack images: bare rounded thumbnail, no card chrome, no text. */
.dm-file-ref-img { padding: 0; background: none; border: none; border-radius: 12px; }
.dm-file-ref-img .dm-file-ref-tile { width: 96px; height: 96px; border-radius: 12px; }
/* PR attachment card: orange ⇅ tile to match the PRs theme color. */
.dm-file-ref-pr .dm-file-ref-tile { color: #ffa502; }
.dm-file-ref-cron .dm-file-ref-tile { color: #81ecec; }
.dm-file-ref-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.dm-file-ref-name { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-file-ref-sub { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-file-ref-x { position: absolute; top: -7px; right: -7px; width: 21px; height: 21px; border-radius: 50%; background: #1c1c28; border: 1.5px solid rgba(255, 255, 255, 0.35); color: #fff; cursor: pointer; font-size: 0.85rem; line-height: 1; display: none; align-items: center; justify-content: center; padding: 0; z-index: 1; }
.dm-file-ref:hover .dm-file-ref-x { display: flex; }
.dm-file-ref-x:hover { background: #3a3a4d; }
/* Touch has no hover — keep the remove control reachable. */
@media (max-width: 768px) { .dm-file-ref-x { display: flex; } }
/* Tree-row attach button mirrors ct-copy's reveal-on-hover behavior */
.ct-attach { opacity: 0; flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 0.8rem; padding: 2px 6px; transition: opacity 0.12s; }
.ct-row:hover .ct-attach { opacity: 1; }
/* Touch has no hover — keep the attach button visible (it's the only
   attach route on mobile, where drag doesn't exist). */
@media (max-width: 768px) { .ct-attach { opacity: 1; } }
/* Pin-to-room + unpin — reveal on hover like the attach button. */
.ct-pin, .ct-unpin { opacity: 0; flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 0.8rem; padding: 2px 6px; transition: opacity 0.12s; }
.ct-row:hover .ct-pin, .ct-row:hover .ct-unpin { opacity: 1; }
.ct-unpin { color: var(--text-muted); font-size: 1rem; line-height: 1; }
.ct-unpin:hover { color: #ff6b6b; }
@media (max-width: 768px) { .ct-pin, .ct-unpin { opacity: 1; } }
/* Room picker — floating menu off the 📌 button. */
.ct-room-picker { position: fixed; z-index: 10000; min-width: 180px; max-height: 320px; overflow-y: auto; background: #1c1c28; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); padding: 4px; }
.ct-picker-head { font-size: 0.7rem; color: var(--text-muted); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.ct-picker-room { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text-primary); padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.82rem; }
.ct-picker-room:hover { background: rgba(255, 255, 255, 0.08); }

/* === PR Panel (read-only PR list beside the code tree — admin only) === */
.loc-chip-pr { border-color: rgba(255, 165, 2, 0.4); color: #ffa502; }
.loc-chip-rooms { border-color: rgba(84, 160, 255, 0.4); color: #54a0ff; }
.loc-chip-jasework { border-color: rgba(190, 142, 255, 0.4); color: #be8eff; }
.loc-chip-mini { border-color: rgba(34, 211, 238, 0.4); color: #22d3ee; }
.loc-chip-studio { border-color: rgba(45, 212, 191, 0.4); color: #2dd4bf; }
.loc-chip-lucid { border-color: rgba(250, 204, 21, 0.4); color: #facc15; }
.loc-chip-cron { border-color: rgba(129, 236, 236, 0.4); color: #81ecec; }
/* Greyed tree rows — credentials / signed third-party contracts. Visible name,
   no preview. Server-enforced (preview 403); this is the matching display. */
.ct-row.ct-sensitive .ct-name { color: var(--text-muted); opacity: 0.7; }
.ct-row.ct-sensitive .ct-icon { opacity: 0.6; }
.ct-lock { flex-shrink: 0; font-size: 0.75rem; opacity: 0.7; padding: 2px 6px; }
.ct-preview-restricted { padding: 28px 22px; color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; }
.pr-loading { padding: 24px; color: var(--text-muted); text-align: center; }
.pr-state-toggle { margin-left: auto; display: flex; gap: 4px; }
.pr-state-btn { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-muted); padding: 3px 10px; border-radius: 10px; font-size: 0.7rem; cursor: pointer; }
.pr-state-btn.active { color: #ffa502; border-color: rgba(255, 165, 2, 0.4); }
.pr-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; min-height: 32px; }
.pr-row:hover { background: rgba(255, 255, 255, 0.06); }
.pr-row.pr-merged { opacity: 0.6; }
.pr-number { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: #ffa502; flex-shrink: 0; }
.pr-title { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { color: var(--text-muted); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.pr-file-delta { margin-left: auto; flex-shrink: 0; font-size: 0.7rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pr-add { color: #2ed573; }
.pr-del { color: #ff6b6b; }
.pr-gh-link { color: var(--text-muted); text-decoration: none; flex-shrink: 0; padding: 0 4px; }
.pr-gh-link:hover { color: var(--text-primary); }
/* Attach-PR button mirrors ct-attach's reveal-on-hover behavior. */
.pr-attach { opacity: 0; flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 0.8rem; padding: 2px 6px; transition: opacity 0.12s; }
.pr-row:hover .pr-attach { opacity: 1; }
@media (max-width: 768px) { .pr-attach { opacity: 1; } }
.pr-file { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 40px; border-radius: 6px; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; color: var(--text-secondary); }
.pr-file:hover { background: rgba(255, 255, 255, 0.06); }
.pr-file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Cron Jobs panel (read-only crontab + launchd tree — admin only) === */
.cron-group { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px; cursor: pointer; min-height: 30px; }
.cron-group:hover { background: rgba(255, 255, 255, 0.06); }
.cron-group-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--text-primary); }
.cron-group-count { color: var(--text-muted); font-size: 0.7rem; }
.cron-empty { color: var(--text-muted); font-size: 0.72rem; font-style: italic; padding: 5px 8px; }
.cron-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 28px; border-radius: 6px; min-height: 32px; }
.cron-row:hover { background: rgba(255, 255, 255, 0.06); }
.cron-sched { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #81ecec; flex-shrink: 0; min-width: 110px; font-size: 0.78rem; }
.cron-cmd { color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.cron-tag { flex-shrink: 0; font-size: 0.65rem; padding: 2px 7px; border-radius: 10px; background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-muted); }
.cron-tag-room { color: #54a0ff; border-color: rgba(84, 160, 255, 0.4); }
.cron-tag-run { color: #2ed573; border-color: rgba(46, 213, 115, 0.4); }
.cron-tag-loaded { color: var(--text-muted); }
.cron-tag-off { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.4); }
.cron-act { flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 0.8rem; padding: 2px 5px; opacity: 0.55; transition: opacity 0.12s; }
.cron-act:hover { opacity: 1; }
.cron-row:hover .cron-act { opacity: 0.85; }
.cron-log-meta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; color: var(--text-muted); padding: 8px 12px; word-break: break-all; }
.cron-log-pre { max-height: 60vh; overflow: auto; }
.ct-header { display: flex; align-items: center; gap: 10px; padding: 8px 4px; position: sticky; top: 0; background: var(--bg-primary); z-index: 1; }
.ct-back { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-secondary); padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; cursor: pointer; }
.ct-root-label { font-weight: 700; color: var(--text-primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ct-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; cursor: pointer; min-height: 28px; }
.ct-row:hover { background: rgba(255, 255, 255, 0.06); }
.ct-row:hover .ct-copy { opacity: 1; }
.ct-chevron { width: 12px; flex-shrink: 0; font-size: 0.7rem; color: var(--text-muted); transition: transform 0.12s; }
.ct-chevron.open { transform: rotate(90deg); }
.ct-icon { flex-shrink: 0; font-size: 0.85rem; }
.ct-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-folder .ct-name { color: var(--text-primary); }
.ct-size { margin-left: auto; flex-shrink: 0; font-size: 0.68rem; color: var(--text-muted); }
.ct-copy { opacity: 0; flex-shrink: 0; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; padding: 2px 6px; transition: opacity 0.12s; }
.ct-dim { opacity: 0.45; }
.ct-loading { opacity: 0.6; }

.files-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  overflow: hidden;
}

.bc-up {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-secondary);
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.bc-up:active { background: var(--glass-hover); }

.bc-segments {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.bc-segments::-webkit-scrollbar { display: none; }

.bc-segment {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 6px 8px;
  min-height: 36px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  border-radius: 6px;
}
.bc-segment:last-child { color: var(--text-primary); font-weight: 600; }
.bc-segment:active { background: var(--glass-bg); }

.bc-sep { color: var(--text-muted); opacity: 0.4; font-size: 0.8rem; flex-shrink: 0; }

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 16px;
}

.file-icon { font-size: 1.5rem; flex-shrink: 0; width: 32px; text-align: center; }
/* Colored SVG file-type icons (FileIcons). Sized per container. */
.fic { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ct-icon .fic { width: 16px; height: 16px; }
.file-icon .fic { width: 22px; height: 22px; }
.dm-file-ref-tile .fic { width: 24px; height: 24px; }

.file-info { flex: 1; min-width: 0; }

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.file-chevron { color: var(--text-muted); flex-shrink: 0; opacity: 0.5; }

.file-download-icon { color: var(--accent-red); flex-shrink: 0; opacity: 0.6; }

.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  flex: 1;
}
.files-empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.files-empty-text { font-size: 0.9rem; color: var(--text-muted); }

.files-loading, .files-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.files-error { color: #ff4757; }

.files-upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.4);
  margin: 0 16px 16px;
  border-radius: 10px;
}
.files-upload-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.files-upload-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-yellow));
  transition: width 0.2s ease;
}
.files-upload-progress span { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.file-preview-icon { color: var(--text-muted); flex-shrink: 0; opacity: 0.5; }

/* === File Preview Modal === */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.preview-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  gap: 12px;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.preview-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}
.preview-filename {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-download-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.preview-download-btn:active { background: var(--glass-hover); }
.preview-content-area {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-overflow-scrolling: touch;
}
.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-video {
  max-width: 100%;
  max-height: 100%;
}
.preview-pdf {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}
.preview-code {
  width: 100%;
  padding: 16px;
  margin: 0;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  align-self: flex-start;
}
.preview-audio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}
.preview-audio-icon { font-size: 4rem; }
.preview-audio-name { color: var(--text-secondary); font-size: 0.9rem; text-align: center; }
.preview-audio-wrap audio { width: 280px; max-width: 90vw; }
.preview-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 40px;
}

/* === Clipboard View === */
.clipboard-search {
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.clipboard-search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
.clipboard-search input:focus { border-color: var(--accent-red); }
.clipboard-search input::placeholder { color: var(--text-muted); }

.clipboard-entry { cursor: pointer; position: relative; transition: all 0.2s; }
.clipboard-entry-content {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
  line-height: 1.4;
  -webkit-user-select: text;
  user-select: text;
  margin-bottom: 8px;
}
.clipboard-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.clipboard-label {
  background: rgba(255, 107, 107, 0.15);
  color: var(--accent-red);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}
.clipboard-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 32px;
  min-width: 32px;
  opacity: 0.5;
  line-height: 1;
}
.clipboard-delete:active { opacity: 1; color: #ff4757; }

.clipboard-entry.copied {
  border-color: rgba(46, 213, 115, 0.5);
  background: rgba(46, 213, 115, 0.1);
}

.clipboard-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  flex: 1;
}
.clipboard-empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.clipboard-empty-text { font-size: 0.9rem; color: var(--text-muted); }

/* === Clipboard Paste Picker === */
.skey-clip { padding: 8px 10px; display: flex; align-items: center; justify-content: center; }
.skey-clip svg { display: block; }

.clip-pick-modal { max-height: 70vh; display: flex; flex-direction: column; }
.clip-pick-list { overflow-y: auto; max-height: 50vh; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.clip-pick-item {
  padding: 10px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.8rem;
}
.clip-pick-item:active { transform: scale(0.98); background: var(--glass-hover); }
.clip-pick-content {
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* === Build Notes === */
.build-note-card { padding: 14px; cursor: pointer; transition: border-color 0.15s; }
.build-note-card:active { transform: scale(0.995); }
.build-note-expanded { border-color: rgba(255, 107, 107, 0.3); cursor: default; }
.build-note-expanded:active { transform: none; }
.build-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.build-note-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.build-note-handle {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}
.build-note-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: capitalize;
  white-space: nowrap;
  flex-shrink: 0;
}
.build-note-status-open { background: rgba(112, 161, 255, 0.15); color: #70a1ff; }
.build-note-status-in-progress { background: rgba(254, 202, 87, 0.15); color: #feca57; }
.build-note-status-done { background: rgba(46, 213, 115, 0.15); color: #2ed573; }
.build-note-status-wont-fix { background: rgba(180, 180, 180, 0.15); color: #999; }
.build-note-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 10px;
}
.build-note-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.build-note-status-select {
  margin-left: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.build-note-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 32px;
  min-width: 32px;
  opacity: 0.5;
  line-height: 1;
}
.build-note-delete:active { opacity: 1; color: #ff4757; }
.build-notes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  flex: 1;
}
.build-notes-empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.build-notes-empty-text { font-size: 0.9rem; color: var(--text-muted); }

.build-note-reply-count {
  font-size: 0.75rem;
  color: var(--accent-red);
  opacity: 0.8;
  cursor: pointer;
}
.build-note-thread {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}
.build-note-reply {
  padding: 8px 0 8px 12px;
  border-left: 2px solid var(--glass-border);
  margin-bottom: 8px;
  margin-left: 4px;
}
.build-note-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}
.build-note-reply-author {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.build-note-reply-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.build-note-reply-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.build-note-reply-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.build-note-reply-input {
  flex: 1;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  resize: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.4;
}
.build-note-reply-input:focus { border-color: var(--accent-red); }
.build-note-reply-input::placeholder { color: var(--text-muted); }
.build-note-reply-send {
  background: var(--accent-red);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.build-note-reply-send:active { opacity: 0.8; }

.build-note-private {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(162, 155, 254, 0.15);
  color: #a29bfe;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.build-note-is-private { border-color: rgba(162, 155, 254, 0.2); }
.build-note-private-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  cursor: pointer;
}
.build-note-private-toggle input[type="checkbox"] {
  accent-color: var(--accent-red);
  width: 16px;
  height: 16px;
}

/* === Login Form Toggle === */
.login-form.hidden { display: none; }
.login-toggle {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.login-toggle:active { color: var(--accent-red); }

/* === Header User Name === */
.header-user-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 6px;
  margin-left: 8px;
}

/* === Session Viewers (terminal status bar) === */
.session-viewers {
  font-size: 0.7rem;
  color: var(--accent-yellow);
  margin-left: auto;
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

/* === Users Management Modal === */
.users-modal {
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.users-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.users-modal-header h3 { margin: 0; }
.users-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px;
}
.user-card-info { margin-bottom: 8px; }
.user-card-name { font-size: 0.95rem; font-weight: 600; }
.user-card-username { font-size: 0.8rem; color: var(--text-muted); }
.user-card-login { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.user-card-sessions { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.session-chip {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(112, 161, 255, 0.15);
  color: #70a1ff;
  font-weight: 500;
}
.user-card-actions { display: flex; gap: 6px; }

/* === Session Checkboxes (add/edit user) === */
.session-checkboxes {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}
.session-check-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.session-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.session-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-red);
}

/* === DM Badge === */
.dm-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
#btn-messages { position: relative; }

/* === DM Panel (slides from right) === */
.dm-sidebar {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  right: 0;
  /* max(0, env - gap): only the inset actually inside the webview counts —
     mirrors .bottom-nav's collapsed padding so the panel bottom lands on the
     real nav top (mis-sized iOS webview: env is bogus, gap eats it; gap 0 →
     formula reduces to the old nav-height + env). Task cfb71950. */
  bottom: calc(var(--nav-height) + max(0px, env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
  width: 35%; /* calendar-proportioned rail everywhere (Jase 2026-06-12) — left view keeps ~65% */
  z-index: 150;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.dm-sidebar.open { transform: translateX(0); }

/* Terminal-behind-the-DM layer: surfaced in-place inside the thread panel by
   the header terminal toggle. The live #terminal-container + #special-keys are
   reparented into .dm-terminal-host while shown, so they inherit their normal
   flex sizing inside this column. The panel width never changes — the 35% rail
   is the base width above, so chat and terminal share identical dimensions. */
.dm-terminal-layer { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #000; }
.dm-terminal-layer.hidden { display: none; }

/* Ops Feed panel (PR-5) — covers the dm window in-place like the terminal layer. */
.dm-ops-feed-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-secondary, #12121a); }
.dm-ops-feed-panel.hidden { display: none; }
.dm-ops-feed-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.08)); }
.dm-ops-feed-title { font-weight: 600; font-size: 0.9rem; }
.dm-ops-feed-status { font-size: 0.72rem; color: var(--text-secondary, #8a8a9a); }
.dm-ops-feed-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; }
.ops-feed-item { padding: 8px 10px; border-radius: 8px; background: var(--bg-tertiary, rgba(255,255,255,0.04)); margin-bottom: 6px; font-size: 0.8rem; }
.ops-feed-item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.ops-feed-kind { font-weight: 600; }
.ops-feed-room { color: var(--text-secondary, #8a8a9a); font-size: 0.72rem; }
.ops-feed-ts { margin-left: auto; color: var(--text-secondary, #8a8a9a); font-size: 0.68rem; white-space: nowrap; }
.ops-feed-detail { color: var(--text-primary, #e8e8f0); word-break: break-word; }
.ops-feed-verdict { display: inline-block; margin-top: 4px; font-size: 0.66rem; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.ops-feed-verdict.escalated, .ops-feed-verdict.routed { background: rgba(255,180,0,0.18); color: #ffb400; }
.ops-feed-verdict.idle, .ops-feed-verdict.fixed { background: rgba(120,120,140,0.18); color: var(--text-secondary, #8a8a9a); }
.ops-feed-verdict.untriaged { background: rgba(90,160,255,0.18); color: #5aa0ff; }
.ops-feed-empty { text-align: center; color: var(--text-secondary, #8a8a9a); padding: 34px 10px; font-size: 0.82rem; }
.dm-terminal-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* [ Chat | Terminal ] thread tabs — Slack-channel-tab treatment: quiet text
   buttons on a hairline, active tab underlined. Row renders only for room
   threads with a tmux session. */
/* View trio — the one switcher (Chat | Bot | Terminal), sitting where the old
   [Chat|Terminal] tab row sat: a strip under the thread header. Icons share a
   grouped container so they read as one control; the active view carries the
   dm-panel-btn-active treatment (exactly one lit — tri-state via
   syncViewSwitcher). */
/* Switch row — the strip under the thread header. Chat|Bot selectors on the
   left, the pinned per-pane terminal tab row on the right. The strip chrome
   (padding + hairline) lives here now; the trio and tab row are its children. */
.dm-view-switchrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.dm-view-trio {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.dm-view-trio .btn-icon { padding: 5px 12px; border-radius: 6px; }
/* Pinned pane-tab row: the wrapper's space-between right-aligns the whole block;
   this container takes the remaining width and scrolls internally (its base
   .tmux-tabs overflow-x:auto) rather than pushing the trio off the row. Keep the
   default flex-start so an overflow scroll can still reach the first tab. */
.dm-tmux-tabs {
  flex: 0 1 auto;
  min-width: 0;
  background: transparent;
  padding: 0;
}

.dm-sidebar-scrim {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  /* Same gap-corrected anchor as .dm-sidebar above (task cfb71950). */
  bottom: calc(var(--nav-height) + max(0px, env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.dm-sidebar-panel { display: flex; flex-direction: column; height: 100%; }
.dm-sidebar-panel.hidden { display: none; }

/* Swipe-back drag (follow-up to #488, Jase msgId 722db8f8): while a
   horizontal drag is live, the two panels layer iOS-style — thread on top
   following the finger, conversation list beneath easing in from -30%
   (parallax). .dm-swiping lives only for the gesture; JS sets the
   transforms inline and clears everything on release. touch-action: pan-y
   keeps vertical scrolling native so no preventDefault is needed. */
#dm-sidebar-thread { touch-action: pan-y; }
.dm-sidebar.dm-swiping { overflow: hidden; }
/* The panels carry no background of their own (the sidebar behind them
   does), and the drag is the only time two panels paint stacked — without
   an opaque surface the inbox ghosts through the sliding thread (Jase
   msgId 0327b70c). Gesture-lifetime only, like the rest of this block. */
.dm-sidebar.dm-swiping .dm-sidebar-panel { position: absolute; inset: 0; background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary)); }
/* Soft left shadow: the moving card reads as a layer above the inbox. */
.dm-sidebar.dm-swiping #dm-sidebar-thread { z-index: 2; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35); }
/* !important required: the global .hidden utility (styles.css Utilities) is
   display:none !important, and importance beats specificity — without it the
   drag runs over an empty background (Jase msgId e1f35943). Between two
   importants, this id-carrying selector wins. */
.dm-sidebar.dm-swiping #dm-sidebar-convos { display: flex !important; z-index: 1; }
.dm-sidebar-panel.dm-swipe-anim { transition: transform 0.2s ease-out; }

.dm-sidebar-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--glass-border);
}
.dm-sidebar-header h2 { font-size: 1.1rem; font-weight: 700; flex: 1; }

.dm-thread-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--glass-border);
}
.dm-thread-header h2 { font-size: 1.1rem; font-weight: 700; }

/* Terminal toggle in DM headers — visible everywhere. (Was desktop-hidden when
   the bottom nav covered terminal access; now it's the primary entry point for
   the terminal-behind-the-DM layer.) */
@media (max-width: 768px) {
  .dm-sidebar {
    display: none !important;
  }
  .dm-sidebar.open {
    display: block !important;
    position: fixed;
    inset: 0;
    top: calc(var(--header-height) + var(--safe-top)) !important;
    /* Same gap-corrected anchor as the base rule (task cfb71950). */
    bottom: calc(var(--nav-height) + max(0px, env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap))) !important;
    width: 100% !important;
    height: auto !important;
    right: 0 !important;
    border-left: none;
    border-top: none;
    border-radius: 0;
    transform: none !important;
    z-index: 150;
  }
  .dm-sidebar-scrim { display: none !important; }
  .dm-sidebar-scrim.open {
    opacity: 0.3;
    pointer-events: auto;
    display: block !important;
    /* Start the scrim BELOW the app header — same offset as the panel above
       (.dm-sidebar.open, :1293). The base scrim is top:0 (z-index 149), which
       on mobile (where .open gets pointer-events:auto) covered the z-100
       .app-header and swallowed a 2nd tap on #btn-messages → the scrim's
       tap-outside handler ran toggleSidebar(false) → the panel closed. With the
       scrim no longer over the header, the badge tap reaches the button
       (openToList) and the panel stays open, matching desktop. Desktop is
       unaffected — .open never gets pointer-events:auto outside this query. */
    top: calc(var(--header-height) + var(--safe-top));
  }

}

