* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }

.header { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); padding: 24px; border-bottom: 1px solid #475569; }
.header h1 { font-size: 24px; font-weight: 600; color: #f8fafc; }
.header p { color: #94a3b8; margin-top: 4px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.login-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0f172a; display: flex; justify-content: center; align-items: center; z-index: 9999; }
.login-box { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 32px; max-width: 400px; width: 90%; text-align: center; }
.login-box h2 { margin-bottom: 24px; color: #f8fafc; }
.login-box input { width: 100%; padding: 12px 16px; border: 1px solid #475569; border-radius: 8px; background: #0f172a; color: #f8fafc; font-size: 14px; margin-bottom: 16px; }
.login-box input:focus { outline: none; border-color: #3b82f6; }
.login-box .error { color: #dc2626; font-size: 13px; margin-bottom: 12px; display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 20px; }
.stat-card h3 { font-size: 12px; text-transform: uppercase; color: #64748b; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #f8fafc; }
.stat-card .sub { font-size: 13px; color: #94a3b8; margin-top: 4px; }

.section { background: #1e293b; border: 1px solid #334155; border-radius: 12px; margin-bottom: 24px; overflow: hidden; }
.section-header { padding: 16px 20px; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.section-header h2 { font-size: 16px; font-weight: 600; }

.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #475569; color: white; }
.btn-secondary:hover { background: #64748b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }

.project-table { width: 100%; border-collapse: collapse; }
.project-table th { text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase; color: #64748b; border-bottom: 1px solid #334155; background: #0f172a; position: sticky; top: 0; }
.project-table td { padding: 8px 12px; border-bottom: 1px solid #1e293b; font-size: 14px; vertical-align: middle; }
.project-table tbody tr:hover td { background: #0f172a; }

.project-table .col-name { min-width: 180px; }
.project-table .col-badges { min-width: 120px; }
.project-table .col-branch { min-width: 120px; }
.project-table .col-status { min-width: 100px; white-space: nowrap; font-size: 12px; }
.project-table .col-actions { min-width: 320px; }

.folder-row { cursor: pointer; user-select: none; font-weight: 600; color: #f8fafc; }
.folder-row td { padding: 8px 12px; }
.folder-row:hover td { background: #0f172a; }

.tree { padding: 0; overflow-x: auto; overflow-y: hidden; }
.tree-arrow { font-size: 10px; color: #64748b; transition: transform 0.2s; display: inline-block; width: 14px; text-align: center; margin-right: 4px; }
.tree-arrow.open { transform: rotate(90deg); }
.tree-icon { font-size: 14px; margin-right: 4px; }

.col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: #e2e8f0; font-size: 14px; }
.col-badges { white-space: nowrap; }
.col-branch { font-family: monospace; font-size: 12px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-actions { white-space: nowrap; }
.no-preview { color: #64748b; font-size: 12px; }
.btn-copy { background: #475569; color: #e2e8f0; }
.btn-copy:hover { background: #64748b; }
.copy-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #94a3b8; cursor: pointer; }
.copy-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: #3b82f6; cursor: pointer; }

.status-dirty { color: #fbbf24; font-weight: 500; }
.status-clean { color: #6ee7b7; font-weight: 500; }
.status-none { color: #64748b; }

.branch-interactive { cursor: pointer; border-bottom: 1px dashed #64748b; }
.branch-interactive:hover { color: #f8fafc; }
.branch-switch-icon { font-size: 10px; margin-left: 2px; opacity: 0.6; }

.branch-popup { position: fixed; z-index: 1000; background: #1e293b; border: 1px solid #475569; border-radius: 8px; padding: 8px; min-width: 200px; max-height: 300px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.branch-popup-header { font-size: 11px; text-transform: uppercase; color: #64748b; padding: 4px 8px 8px; letter-spacing: 0.5px; }
.branch-popup-list { max-height: 180px; overflow-y: auto; }
.branch-popup-item { padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: monospace; color: #cbd5e1; }
.branch-popup-item:hover { background: #334155; color: #f8fafc; }
.branch-popup-item.active { color: #6ee7b7; font-weight: 600; }
.branch-popup-create { display: flex; gap: 6px; padding: 8px 0 4px; border-top: 1px solid #334155; margin-top: 4px; }
.branch-popup-input { flex: 1; padding: 6px 8px; border: 1px solid #475569; border-radius: 4px; background: #0f172a; color: #f8fafc; font-size: 13px; outline: none; }
.branch-popup-input:focus { border-color: #3b82f6; }
.worktree-branch-input,
.worktree-branch-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #475569;
  border-radius: 4px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 13px;
  outline: none;
}
.worktree-branch-input:focus,
.worktree-branch-select:focus { border-color: #3b82f6; }
.worktree-branch-select { appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; }
.worktree-new-branch { display: flex; align-items: center; gap: 6px; padding: 8px 0; font-size: 13px; color: #94a3b8; cursor: pointer; border-bottom: 1px solid #334155; }
.worktree-new-branch input[type="checkbox"] { width: 15px; height: 15px; accent-color: #3b82f6; cursor: pointer; }
.worktree-create-row { display: flex; justify-content: flex-end; padding-top: 8px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 500; }
.badge-green { background: #065f46; color: #6ee7b7; }
.badge-blue { background: #1e3a5f; color: #93c5fd; }
.badge-gray { background: #374151; color: #9ca3af; }
.badge-purple { background: #3b0764; color: #d8b4fe; }

.termly-sessions { padding: 12px 20px; }
.session-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #334155; }
.session-item:last-child { border-bottom: none; }
.session-info { display: flex; align-items: center; gap: 12px; }
.session-pid { font-family: monospace; color: #64748b; font-size: 13px; }
.session-status { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: pulse 2s infinite; }
.session-code { font-family: monospace; color: #22c55e; font-weight: 600; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.empty { padding: 40px 20px; text-align: center; color: #64748b; }

.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 24px; height: 24px; border: 3px solid #334155; border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 24px; right: 24px; background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 12px 20px; color: #f8fafc; font-size: 14px; opacity: 0; transform: translateY(20px); transition: all 0.3s; z-index: 1000; max-width: 350px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: #16a34a; }
.toast.error { border-color: #dc2626; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 999; }
.modal-overlay.show { display: flex; }
.modal { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 24px; max-width: 400px; width: 90%; text-align: center; }
.modal h3 { margin-bottom: 16px; color: #f8fafc; }
.modal .code { font-size: 32px; font-weight: 700; color: #22c55e; font-family: monospace; letter-spacing: 2px; margin: 20px 0; padding: 16px; background: #0f172a; border-radius: 8px; }
.modal .project-label { font-size: 14px; color: #94a3b8; margin-bottom: 8px; }
.modal .instructions { font-size: 13px; color: #64748b; margin-top: 16px; }
.modal .btn-close { margin-top: 16px; }
