/* ═══════════════════════════════════════════════════════
   repos-detail.css — Repos detail panel, file list, drag-drop,
                      clone version picker, rules tab
   ═══════════════════════════════════════════════════════ */

/* ── Live Activity ── */
.live-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.live-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: none; flex-shrink: 0; }
.live-dot.connected { background: #22c55e; animation: pulse-live 2s ease-in-out infinite; }
@keyframes pulse-live { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); } 50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34,197,94,0); } }
.live-count { color: var(--text-muted); font-size: 0.75rem; }
.live-controls { display: flex; gap: 0.5rem; align-items: center; }
.live-feed { max-height: calc(100vh - 180px); overflow-y: auto; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.8125rem; line-height: 1.6; }
.live-item { display: grid; grid-template-columns: 70px auto 1fr; gap: 0.5rem; padding: 0.375rem 1rem; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05)); align-items: center; transition: background 0.15s; }
.live-item:hover { background: var(--bg-hover, rgba(255,255,255,0.03)); }
.live-item.is-new { animation: flash-new 1s ease-out; }
@keyframes flash-new { 0% { background: rgba(34,197,94,0.15); } 100% { background: transparent; } }
.live-time { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.live-route { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 3px; font-size: 0.6875rem; font-weight: 600; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.live-route[data-type="memory"]  { background: #7c3aed20; color: #a78bfa; }
.live-route[data-type="planner"] { background: #2563eb20; color: #60a5fa; }
.live-route[data-type="repo"]    { background: #06b6d420; color: #22d3ee; }
.live-route[data-type="docs"]    { background: #16a34a20; color: #4ade80; }
.live-route[data-type="session"] { background: #ea580c20; color: #fb923c; }
.live-route[data-type="project"] { background: #d9731620; color: #f59e0b; }
.live-route[data-type="other"]   { background: #64748b20; color: #94a3b8; }
.live-payload { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-payload .live-key { color: #22d3ee; margin-right: 0.5rem; }
.live-paused-banner { text-align: center; padding: 0.5rem; background: #f59e0b20; color: #f59e0b; font-size: 0.8125rem; font-weight: 600; }

/* ── Clone Version Picker ── */
.clone-btn-group { display: inline-flex; gap: 0; }
.clone-btn-group button:first-child { border-radius: 6px 0 0 6px !important; border-right: none !important; }
.clone-dropdown-arrow { border-radius: 0 6px 6px 0 !important; padding: 4px 10px !important; border-left: 1px solid rgba(255,255,255,.12) !important; font-size: 11px; }
.clone-version-popup { background: var(--bg2, #1e2130); border: 1px solid var(--border, #2d3148); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.55); padding: 4px 0; min-width: 280px; overflow: hidden; }
.cvp-item { padding: 10px 16px; cursor: pointer; font-size: 13px; color: var(--text, #cdd6f4); display: flex; align-items: center; gap: 10px; border-left: 3px solid transparent; transition: background .12s, border-color .12s; }
.cvp-item:hover { background: var(--bg-hover, #2d3148); border-left-color: var(--accent, #6c8ef4); }
.cvp-date-row { gap: 6px; flex-wrap: wrap; }
.cvp-divider { height: 1px; background: var(--border, #2d3148); margin: 6px 0; }
.cvp-section-label { padding: 6px 16px 4px; font-size: 10px; font-weight: 700; color: var(--accent, #6c8ef4); text-transform: uppercase; letter-spacing: .06em; }
.cvp-versions-list { max-height: 280px; overflow-y: auto; }
.cvp-versions-list::-webkit-scrollbar { width: 4px; }
.cvp-versions-list::-webkit-scrollbar-thumb { background: var(--border, #2d3148); border-radius: 4px; }
.cvp-ver-item { padding: 10px 16px !important; }
.cvp-ver-date { font-size: 12px; font-family: monospace; color: var(--text, #cdd6f4); }
.cvp-more { padding: 6px 16px; font-size: 11px; color: var(--text-dim, #8892b0); font-style: italic; }

/* ── File History Panel ── */
#file-history-panel { position: fixed; right: 20px; bottom: 20px; width: 520px; max-width: 95vw; max-height: 60vh; overflow-y: auto; background: #1e2130; border: 1px solid #2d3148; border-radius: 10px; box-shadow: 0 10px 32px rgba(0,0,0,.6); z-index: 8000; font-size: 13px; }
.fhp-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #2d3148; font-size: 13px; color: #cdd6f4; position: sticky; top: 0; background: #1e2130; }
.fhp-header button { background: none; border: none; color: #888; cursor: pointer; font-size: 16px; padding: 0 4px; }
.fhp-header button:hover { color: #fff; }
.fhp-body { padding: 8px 0; }
.fhp-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid #2d314820; }
.fhp-row:last-child { border-bottom: none; }
.fhp-num { color: #6c8ef4; font-weight: 600; min-width: 28px; font-size: 12px; }
.fhp-date { color: #8892b0; flex: 1; font-size: 12px; }
.fhp-current { background: #4caf5033; color: #4caf50; border-radius: 3px; padding: 1px 5px; font-size: 10px; margin-left: 4px; }
.fhp-actions { display: flex; gap: 4px; }
.fhp-actions button { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: #2d3148; border: none; color: #cdd6f4; cursor: pointer; white-space: nowrap; }
.fhp-actions button:hover { background: #3d4168; }
.btn-hist { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: #2d3148; border: none; color: #8892b0; cursor: pointer; white-space: nowrap; }
.btn-hist:hover { color: #cdd6f4; background: #3d4168; }
.hist-cell { width: 1%; white-space: nowrap; }

/* ── Repos Filter Bar ── */
.repos-filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0 14px; }
.repos-filter-bar input[type=search] { flex: 1; min-width: 160px; max-width: 360px; background: var(--bg2, #131520); border: 1px solid var(--border, #2d3148); border-radius: 8px; color: var(--text, #cdd6f4); padding: 8px 14px; font-size: 13px; outline: none; }
.repos-filter-bar input[type=search]:focus { border-color: var(--accent, #6c8ef4); box-shadow: 0 0 0 2px rgba(108,142,244,.15); }
.repos-filter-bar select { background: var(--bg2, #131520); border: 1px solid var(--border, #2d3148); border-radius: 8px; color: var(--text, #cdd6f4); padding: 7px 12px; font-size: 13px; cursor: pointer; min-height: 38px; }
.repos-owner-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.repo-owner-pill { background: var(--bg2, #1e2130); border: 1px solid var(--border, #2d3148); border-radius: 20px; color: var(--text-dim, #8892b0); font-size: 12px; padding: 4px 14px; cursor: pointer; transition: all .15s; min-height: 30px; }
.repo-owner-pill:hover { border-color: var(--accent, #6c8ef4); color: var(--text, #cdd6f4); }
.repo-owner-pill.active { background: rgba(108,142,244,.15); border-color: var(--accent, #6c8ef4); color: var(--accent, #6c8ef4); }
.repos-count { color: var(--text-dim, #8892b0); font-size: 12px; white-space: nowrap; margin-left: auto; }

/* ── Repos List / Row / Detail ── */
.repos-list { display: flex; flex-direction: column; gap: 0; }
.repo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; cursor: pointer; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 3px; background: var(--bg2); transition: background .15s, border-color .15s; user-select: none; }
.repo-row:hover { background: var(--bg-hover); border-color: var(--accent); }
.repo-row.repo-row-open { background: var(--bg-hover); border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.repo-row-name { font-weight: 600; font-size: 13px; color: var(--text); flex-shrink: 0; }
.repo-row-desc { font-size: 11px; color: var(--text-dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-row-commit { font-size: 11px; color: var(--text-dim); flex: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.repo-row-meta { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.repo-row-date { font-size: 11px; color: var(--text-dim); flex-shrink: 0; margin-left: auto; }
.repo-detail { border: 1px solid var(--accent); border-top: none; border-radius: 0 0 8px 8px; background: var(--bg3, var(--bg2)); margin-bottom: 3px; overflow: hidden; }
.repo-detail-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.repo-detail-title { font-size: 14px; font-weight: 700; color: var(--text); }
.repo-detail-desc { font-size: 12px; color: var(--text-dim); margin-left: 8px; }
.repo-detail-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.repo-detail-close { margin-left: 4px; }
.repo-detail-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 14px; font-size: 11px; color: var(--text-dim); border-bottom: 1px solid var(--border); background: var(--bg2); }
.repo-detail-commit { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-file-list { max-height: 400px; overflow-y: auto; padding: 6px 0; }
.repo-file-row { display: flex; align-items: center; padding: 4px 14px; gap: 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.repo-file-row:hover { background: var(--bg-hover); }
.repo-file-name { font-family: monospace; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-file-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Shared button sizes */
.btn-xs { font-size: 11px; padding: 2px 6px; border-radius: 4px; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text); line-height: 1.4; }
.btn-xs:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sm { font-size: 12px; padding: 4px 10px; border-radius: 5px; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text); }
.btn-sm:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-repos-view { background: #1e2130; border: 1px solid #2d3148; border-radius: 7px; color: #8892b0; font-size: 16px; padding: 4px 10px; cursor: pointer; line-height: 1; }
.btn-repos-view:hover { color: #cdd6f4; border-color: #6c8ef4; }

/* Drag and drop */
.repo-drag-handle { color: var(--text-dim, #8892b0); cursor: grab; font-size: 14px; padding: 0 4px; flex-shrink: 0; opacity: 0.4; transition: opacity .15s; user-select: none; line-height: 1; }
.repo-row:hover .repo-drag-handle { opacity: 1; }
.repo-drag-handle:active { cursor: grabbing; }
.repo-row-dragging { opacity: 0.45; background: var(--bg-hover, #2d3148) !important; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.repo-drop-above { border-top: 2px solid var(--accent, #6c8ef4) !important; }
.repo-drop-below { border-bottom: 2px solid var(--accent, #6c8ef4) !important; }

/* ── Pinned Rules ── */
.rules-wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px; }
.rules-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.rules-header h2 { font-size: 18px; font-weight: 700; flex: 1; }
.rules-subtitle { font-size: 13px; color: var(--text-dim); width: 100%; margin-top: -10px; }
.rules-container { display: flex; flex-direction: column; gap: 4px; }
.rule-row { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: border-color .15s; }
.rule-row:hover { border-color: var(--accent, #6c8ef4); }
.rule-row.rule-inactive { opacity: 0.55; }
.rule-row-main { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; user-select: none; }
.rule-priority { min-width: 22px; text-align: center; font-size: 12px; font-weight: 700; color: var(--accent, #6c8ef4); background: var(--accent-dim, rgba(108,142,244,.15)); border-radius: 4px; padding: 2px 5px; flex-shrink: 0; }
.rule-body { flex: 1; min-width: 0; }
.rule-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-short { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.rule-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rule-chevron { font-size: 11px; color: var(--text-muted); flex-shrink: 0; transition: transform .15s; }
.rule-expand { padding: 0 14px 12px 48px; border-top: 1px solid var(--border); }
.rule-full-text { font-size: 13px; color: var(--text); white-space: pre-wrap; line-height: 1.6; padding-top: 10px; }
.rule-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.btn-active    { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; }
.btn-inactive  { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; opacity: 0.5; }
.btn-danger-xs { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; color: var(--red, #e57373); }
.rules-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--border); padding: 8px 18px; border-radius: 20px; font-size: 13px; color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.3); z-index: 999; }
.rules-toast-error { border-color: var(--red, #e57373); color: var(--red, #e57373); }
