/* ===== Nexus — Project Command Center ===== */

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-0: #07070a;
    --bg-1: #0c0c11;
    --bg-2: #131319;
    --bg-3: #1a1a23;
    --bg-4: #22222e;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --text-0: #f4f4f5;
    --text-1: #a1a1aa;
    --text-2: #71717a;
    --text-3: #52525b;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-dim: rgba(129,140,248,0.10);
    --accent-glow: rgba(129,140,248,0.25);
    --success: #4ade80;
    --success-dim: rgba(74,222,128,0.10);
    --warning: #fbbf24;
    --warning-dim: rgba(251,191,36,0.10);
    --danger: #f87171;
    --danger-dim: rgba(248,113,113,0.10);
    --info: #38bdf8;
    --info-dim: rgba(56,189,248,0.10);
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --transition: 0.2s ease;
}

html { background: var(--bg-0); color: var(--text-0); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent-dim); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }

/* --- Layout --- */
#app { display: flex; min-height: 100vh; }

#sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

#main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-height: 100vh;
}

#topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--topbar-h);
    background: rgba(7,7,10,0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
}

#topbar.topbar-minimal .search-box { display: none; }
#topbar.topbar-minimal { justify-content: flex-end; }

#content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* --- Sidebar --- */
.sidebar-header { padding: 20px 20px 24px; }

.logo {
    display: flex; align-items: center; gap: 10px;
}

.logo-icon {
    width: 28px; height: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
    font-size: 18px; font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-0), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1; padding: 0 12px;
    display: flex; flex-direction: column; gap: 2px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.nav-item svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.nav-item:hover {
    color: var(--text-0);
    background: var(--bg-3);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
    color: var(--text-0);
    background: var(--accent-dim);
}

.nav-item.active svg { opacity: 1; color: var(--accent); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.scan-info {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: var(--text-3);
}

.pulse-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}

/* --- Topbar --- */
.search-box {
    flex: 1; max-width: 480px;
    position: relative;
    display: flex; align-items: center;
}

.search-icon {
    position: absolute; left: 12px;
    width: 16px; height: 16px;
    color: var(--text-3);
    pointer-events: none;
}

#search {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px 8px 36px;
    color: var(--text-0);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

#search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

#search::placeholder { color: var(--text-3); }

.search-kbd {
    position: absolute; right: 10px;
    padding: 2px 6px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    pointer-events: none;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover { color: var(--text-0); border-color: var(--border-hover); background: var(--bg-3); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon.spinning svg { animation: spin 0.8s linear infinite; }

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

.mobile-only { display: none; }

/* --- Views Common --- */
.view { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-header { margin-bottom: 24px; }
.view-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.view-header .subtitle { color: var(--text-2); font-size: 13px; margin-top: 4px; }

.section { margin-bottom: 32px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-1);
    display: flex; align-items: center; gap: 8px;
}
.link { font-size: 12px; color: var(--text-2); transition: color var(--transition); }
.link:hover { color: var(--accent); }

/* --- Stats Bar --- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--stat-color, var(--accent));
    opacity: 0.7;
}

.stat-value {
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px; color: var(--text-2);
    margin-top: 2px;
}

/* --- Cards Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.card:hover {
    border-color: var(--border-hover);
    background: var(--bg-3);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 10px;
}

.card-title {
    font-size: 15px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

.card-desc {
    font-size: 12px; color: var(--text-2);
    line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
    min-height: 36px;
}

.card-meta {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
}

.card-meta-item {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-2);
}

.card-meta-item svg { width: 12px; height: 12px; }

.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.card-links {
    display: flex; gap: 6px;
}

.card-link {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    transition: all var(--transition);
}

.card-link:hover { color: var(--accent); background: var(--accent-dim); }
.card-link svg { width: 14px; height: 14px; }
.card-link-add { background: transparent; border: 1px dashed var(--border); color: var(--text-3); cursor: pointer; }
.card-link-add:hover { color: var(--accent); border-color: var(--accent); border-style: solid; }

/* --- Status --- */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.01em;
}

.status-active { color: var(--success); background: var(--success-dim); }
.status-recent { color: var(--info); background: var(--info-dim); }
.status-idle { color: var(--warning); background: var(--warning-dim); }
.status-archived { color: var(--text-3); background: rgba(82,82,91,0.15); }
.status-local { color: var(--text-2); background: rgba(113,113,122,0.1); }
.status-unknown { color: var(--text-3); background: rgba(82,82,91,0.1); }

.dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-active { background: var(--success); }
.dot-recent { background: var(--info); }
.dot-idle { background: var(--warning); }
.dot-archived { background: var(--text-3); }
.dot-local { background: var(--text-2); }
.dot-warning { background: var(--warning); }
.dot-dirty { background: var(--danger); }
.dot-clean { background: var(--success); }

/* --- Tech Badges --- */
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--bg-4);
    color: var(--text-1);
    border: 1px solid var(--border);
}

/* --- Attention Items --- */
.attention-list { display: flex; flex-direction: column; gap: 6px; }

.attention-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.attention-item:hover { background: var(--bg-3); }
.attention-item .name { font-weight: 600; font-size: 13px; }
.attention-item .detail { font-size: 12px; color: var(--text-2); }

/* --- Activity Timeline --- */
.timeline { display: flex; flex-direction: column; }

.timeline-date {
    padding: 8px 0 6px;
    font-size: 11px; font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.timeline-item:last-child { border-bottom: none; }
.timeline-item:hover { background: var(--bg-2); margin: 0 -8px; padding: 10px 8px; border-radius: var(--radius-sm); }

.timeline-avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
    color: var(--text-0);
}

.timeline-body { flex: 1; min-width: 0; }

.timeline-project {
    font-size: 11px; font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.timeline-message {
    font-size: 13px; color: var(--text-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-time {
    font-size: 11px; color: var(--text-3);
    font-family: var(--mono);
    flex-shrink: 0;
    margin-top: 2px;
}

.timeline-hash {
    font-size: 11px; color: var(--text-3);
    font-family: var(--mono);
}

/* --- Projects Table View --- */
.table-wrap {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px; font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-3);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table th:hover { color: var(--text-1); }
.table th.sorted { color: var(--accent); }
.table th .sort-arrow { margin-left: 4px; font-size: 10px; }

.table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tr { transition: background var(--transition); cursor: pointer; }
.table tbody tr:hover { background: var(--bg-3); }
.table tbody tr:last-child td { border-bottom: none; }

.table .name-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.table .path-cell { font-family: var(--mono); font-size: 11px; color: var(--text-2); max-width: 250px; overflow: hidden; text-overflow: ellipsis; }

/* --- View Controls --- */
.view-controls {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex; gap: 4px;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-2);
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.filter-btn:hover { color: var(--text-0); border-color: var(--border-hover); }
.filter-btn.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(129,140,248,0.2); }

.view-toggles {
    display: flex; gap: 4px;
}

.view-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    transition: all var(--transition);
}

.view-toggle:hover { color: var(--text-1); border-color: var(--border-hover); }
.view-toggle.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(129,140,248,0.2); }
.view-toggle svg { width: 16px; height: 16px; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    color: var(--text-0);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.btn:hover { background: var(--bg-4); border-color: var(--border-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn svg { width: 14px; height: 14px; }

/* --- Detail View --- */
.detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 24px;
}

.detail-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.detail-path { font-family: var(--mono); font-size: 12px; color: var(--text-2); margin-top: 4px; }
.detail-desc { color: var(--text-1); font-size: 14px; margin-top: 8px; line-height: 1.6; }

.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.detail-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.detail-section h3 {
    font-size: 12px; font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-2); }
.info-value { color: var(--text-0); font-weight: 500; font-family: var(--mono); font-size: 12px; }

/* --- Modal --- */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    /* Keep above any .modal-backdrop rule that escapes via position:fixed
       + high z-index (see habit-modal override), otherwise the panel
       gets blurred by the backdrop-filter. */
    z-index: 1001;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%; max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } }

.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-sm);
    background: var(--bg-3);
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover { color: var(--text-0); background: var(--bg-4); }
.modal-close svg { width: 16px; height: 16px; }

/* --- Loading --- */
.loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 400px;
    color: var(--text-2);
    gap: 16px;
}

.spinner {
    width: 32px; height: 32px;
    border: 2px solid var(--bg-4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Empty State --- */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 300px;
    color: var(--text-2);
    text-align: center;
}

.empty-state h2 { font-size: 18px; color: var(--text-1); margin-bottom: 8px; }
.empty-state p { font-size: 13px; margin-bottom: 16px; }

/* --- Git status colors --- */
.git-clean { color: var(--success); }
.git-dirty { color: var(--danger); }
.git-ahead { color: var(--warning); }

/* --- Commit list --- */
.commit-list { display: flex; flex-direction: column; }

.commit-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.commit-item:last-child { border-bottom: none; }

.project-links { display: flex; gap: 8px; flex-wrap: wrap; }
.project-link-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    background: var(--bg-3); color: var(--text-1);
    text-decoration: none; font-size: 13px; font-weight: 500;
    border: 1px solid var(--border); transition: all 0.15s;
}
.project-link-btn:hover { background: var(--accent); color: var(--bg-0); border-color: var(--accent); }
.project-link-btn svg { width: 14px; height: 14px; }

.commit-hash {
    font-family: var(--mono); font-size: 11px;
    color: var(--accent); flex-shrink: 0;
    padding: 2px 6px;
    background: var(--accent-dim);
    border-radius: 4px;
}

.commit-msg { color: var(--text-0); flex: 1; }
.commit-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

/* --- Back link --- */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-2); font-size: 13px;
    margin-bottom: 16px;
    transition: color var(--transition);
}

.back-link:hover { color: var(--accent); }
.back-link svg { width: 16px; height: 16px; }

/* --- Count badge --- */
.count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bg-4);
    font-size: 10px; font-weight: 700;
    color: var(--text-2);
}

/* --- Tabs --- */
.tabs {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover { color: var(--text-0); background: var(--bg-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab svg { width: 14px; height: 14px; }

.tab-content { animation: fadeIn 0.15s ease; }

/* --- Type Badge --- */
.type-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid var(--border);
}
.type-badge-link {
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s, transform .1s, border-color .15s, background .15s;
}
.type-badge-link:hover {
    filter: brightness(1.25);
    transform: translateY(-1px);
    /* Match the card-link hover: border + fill in the badge's own color
       (set via inline style → currentColor). */
    border-color: currentColor;
    background: color-mix(in srgb, currentColor 22%, transparent) !important;
}
.type-badge-link::after {
    content: " ↗";
    opacity: .7;
    font-size: 9px;
    margin-left: 2px;
}

/* --- Client Badge --- */
.client-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px; font-weight: 500;
    color: var(--text-1);
    background: var(--bg-3);
    border: 1px solid var(--border);
}

/* --- Online Badge --- */
.online-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 500;
    text-decoration: none;
}

.online-badge.online { color: var(--success); }
.online-badge.offline { color: var(--text-3); }
.dot-offline { background: var(--text-3); }

/* --- Detail Meta Row --- */
.detail-meta-row {
    display: flex; align-items: center; gap: 8px;
    margin-top: 6px;
}

/* --- Card Meta Info --- */
.card-meta-info {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}

/* --- Card Indicators --- */
.card-indicators {
    display: flex; align-items: center; gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.indicator {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px; font-weight: 500;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    white-space: nowrap;
}

.indicator svg { width: 10px; height: 10px; }

.indicator-ok { color: var(--success); border-color: rgba(74,222,128,0.15); background: var(--success-dim); }
.indicator-warn { color: var(--warning); border-color: rgba(251,191,36,0.15); background: var(--warning-dim); }
.indicator-off { color: var(--text-3); }
.indicator-hosting { color: var(--info); border-color: rgba(56,189,248,0.15); background: var(--info-dim); }
.indicator-client { color: var(--accent); border-color: rgba(129,140,248,0.15); background: var(--accent-dim); }

.card-commit {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Markdown Body --- */
.doc-content {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 32px;
}

/* --- Metadocs Layout --- */
.metadocs-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
}

.metadocs-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metadoc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-1);
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius);
    text-align: left;
    white-space: nowrap;
}

.metadoc-item:hover { background: var(--bg-2); color: var(--text-0); }
.metadoc-item.active { background: var(--accent); color: #fff; }
.metadoc-item svg { width: 14px; height: 14px; flex-shrink: 0; }

@media (max-width: 768px) {
    .metadocs-layout { grid-template-columns: 1fr; }
    .metadocs-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
}

.markdown-body {
    color: var(--text-0);
    line-height: 1.7;
    font-size: 14px;
}

.markdown-body h1 { font-size: 24px; font-weight: 700; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 20px; font-weight: 600; margin: 20px 0 10px; }
.markdown-body h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
.markdown-body h4 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 12px; padding-left: 24px; }
.markdown-body li { margin: 4px 0; }
.markdown-body a { color: var(--accent); }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body code { font-family: var(--mono); font-size: 12px; background: var(--bg-4); padding: 2px 6px; border-radius: 4px; color: var(--accent); }
.markdown-body pre { background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; overflow-x: auto; margin: 12px 0; }
.markdown-body pre code { background: none; padding: 0; color: var(--text-0); }
.markdown-body blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 12px 0; color: var(--text-1); }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.markdown-body th, .markdown-body td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; font-size: 13px; }
.markdown-body th { background: var(--bg-3); font-weight: 600; color: var(--text-1); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown-body strong { color: var(--text-0); font-weight: 600; }

/* --- Todo Styles --- */
details.todo-group { margin-bottom: 20px; }
details.todo-group > summary { list-style: none; cursor: pointer; user-select: none; }
details.todo-group > summary::-webkit-details-marker { display: none; }
details.todo-group > summary::before {
    content: '▸'; display: inline-block; margin-right: 6px;
    transition: transform 0.15s ease; color: var(--text-2); font-size: 10px;
}
details.todo-group[open] > summary::before { transform: rotate(90deg); }

.todo-group-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0;
    font-size: 12px; font-weight: 600;
    color: var(--text-1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.todo-group-header:hover { color: var(--text-0); }

.todo-list { display: flex; flex-direction: column; }

.todo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    border-radius: 0;
}

.todo-item:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.todo-item:last-child { border-bottom: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.todo-item:only-child { border-radius: var(--radius-sm); }

.todo-item:hover { background: var(--bg-2); }

.todo-item.todo-done { opacity: 0.5; }
.todo-item.todo-done .todo-title { text-decoration: line-through; }

.todo-check {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.todo-content {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 8px;
}

.todo-title {
    font-size: 13px; font-weight: 500;
    color: var(--text-0);
}

.todo-project {
    font-size: 10px; font-weight: 500;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--accent-dim);
    color: var(--accent);
    white-space: nowrap;
}

.todo-date {
    font-size: 11px;
    color: var(--text-2);
    font-family: var(--mono);
    white-space: nowrap;
}

.todo-overdue { color: var(--danger); font-weight: 600; }

.todo-list-done .todo-item { opacity: 0.4; }
.todo-list-done .todo-item:hover { opacity: 0.7; }

.todo-check-readonly {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px dashed var(--border);
    color: var(--text-3);
    font-size: 11px;
    cursor: help;
    flex-shrink: 0;
}
.todo-project-sourced { background: linear-gradient(90deg, rgba(129,140,248,0.06), transparent 40%); }
.todo-project-sourced .todo-title { font-style: italic; }
.todo-blocked .todo-check-readonly { color: var(--danger); border-color: var(--danger); }
.todo-in-progress .todo-check-readonly { color: var(--warning); border-color: var(--warning); }
.todo-source-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.todo-filters select { min-width: 130px; }

.done-section {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.done-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
    list-style: none;
}

.done-toggle::-webkit-details-marker { display: none; }
.done-toggle svg { width: 14px; height: 14px; }
.done-toggle:hover { color: var(--text-0); }

/* --- Inline Form --- */
.inline-form {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.inline-form form {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}

.inline-input {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-0);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    flex: 1;
    min-width: 180px;
}

.inline-input:focus { border-color: var(--accent); }

.inline-select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-0);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
}

.inline-select:focus { border-color: var(--accent); }

/* --- Form Groups (Modals) --- */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px; font-weight: 500;
    color: var(--text-1);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-0);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.form-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 16px;
}

/* --- Calendar Styles --- */
.calendar-nav {
    display: flex; align-items: center; justify-content: center; gap: 20px;
    margin-bottom: 20px;
}

.calendar-month {
    font-size: 18px; font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.calendar-grid {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--bg-3);
    border-bottom: 1px solid var(--border);
}

.cal-day-name {
    padding: 10px;
    text-align: center;
    font-size: 11px; font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-body {
    display: grid; grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    min-height: 90px;
    padding: 6px 8px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}

.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--bg-3); }

.cal-day.cal-empty {
    background: var(--bg-1);
    cursor: default;
}

.cal-day-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 12px; font-weight: 500;
    color: var(--text-1);
    margin-bottom: 4px;
}

.cal-today .cal-day-num {
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.cal-event {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px; font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity var(--transition);
}

.cal-event:hover { opacity: 0.8; }

/* --- Color Picker --- */
.color-picker {
    display: flex; gap: 6px; flex-wrap: wrap;
}

.color-option {
    cursor: pointer;
}

.color-option input { display: none; }

.color-option span {
    display: block;
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.color-option input:checked + span {
    border-color: var(--text-0);
    box-shadow: 0 0 0 2px var(--bg-0);
}

/* --- Dashboard Layout --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.dashboard-side {
    display: flex; flex-direction: column; gap: 20px;
}

.mini-list {
    display: flex; flex-direction: column;
}

.mini-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.mini-item:last-child { border-bottom: none; }

.mini-text {
    flex: 1; min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-0);
}

.mini-meta {
    font-size: 11px;
    color: var(--text-2);
    font-family: var(--mono);
    white-space: nowrap;
}

/* --- Buttons Extra --- */
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,0.2); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-full { width: 100%; }

.hidden { display: none !important; }

/* --- Settings --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
}

.settings-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-section h3 {
    font-size: 14px; font-weight: 600;
    margin-bottom: 14px;
}

.settings-desc {
    font-size: 12px; color: var(--text-2);
    margin-bottom: 12px;
}

/* --- Shared Tag --- */
.shared-tag {
    font-size: 9px; font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--accent-dim);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --- Login --- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%; max-width: 380px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-error {
    background: var(--danger-dim);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 12px;
}

.login-links {
    display: flex; gap: 12px; justify-content: center;
    margin-top: 16px;
}

.link-btn {
    font-size: 12px; color: var(--text-2);
    background: none; border: none;
    cursor: pointer; font-family: var(--font);
}

.link-btn:hover { color: var(--accent); }

/* --- Invite --- */
.invite-result {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 12px;
}

.invite-url-input {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text-0);
    font-family: var(--mono);
    font-size: 11px;
}

.invite-list { display: flex; flex-direction: column; gap: 6px; }

.invite-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.invite-code { font-family: var(--mono); color: var(--accent); }
.invite-status { font-weight: 500; }
.invite-date { color: var(--text-2); }

.members-list { display: flex; flex-direction: column; gap: 4px; }

.member-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.member-item:last-child { border-bottom: none; }
.member-name { font-weight: 500; }
.member-role { font-size: 11px; color: var(--text-2); }

/* --- Google Calendar --- */
.gcal-section h3 svg { width: 16px; height: 16px; display: inline; vertical-align: -2px; }

.gcal-connected, .gcal-disconnected {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px;
}

.gcal-connected .btn, .gcal-disconnected .btn { margin-left: auto; }

.gcal-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(66,133,244,0.1);
    color: #4285f4;
    font-size: 11px; font-weight: 500;
}

.gcal-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4285f4;
    margin-right: 2px;
    flex-shrink: 0;
}

.cal-event-google {
    opacity: 0.85;
    font-style: italic;
}

.gcal-legend {
    display: flex; align-items: center; gap: 6px;
    margin-top: 12px;
    font-size: 11px; color: var(--text-2);
}

.form-msg {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-top: 8px;
}

.form-msg.success { background: var(--success-dim); color: var(--success); }
.form-msg.error { background: var(--danger-dim); color: var(--danger); }
.form-hint { font-size: 11px; color: var(--text-2); margin-top: 4px; display: block; }
.form-hint a { color: var(--accent); }
.form-hint code { font-family: var(--mono); font-size: 10px; background: var(--bg-3); padding: 1px 4px; border-radius: 3px; }

/* --- No Sidebar (Login) --- */
.no-sidebar #sidebar { display: none; }
.no-sidebar #main { margin-left: 0; }

/* --- Toggle Switch --- */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; cursor: pointer;
    font-weight: 500; color: var(--text-0);
    padding: 0.25rem 0;
}
.toggle-row + .form-hint { margin-top: 0.5rem; }
.toggle-row input { display: none; }
.toggle-switch {
    position: relative; width: 46px; height: 26px;
    background: var(--bg-4);
    border-radius: 13px; flex-shrink: 0;
    transition: background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
}
.toggle-switch::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: linear-gradient(180deg, #fafafa, #d4d4d4);
    border-radius: 50%;
    transition: left 0.25s cubic-bezier(.4,.2,.2,1.4), background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(0,0,0,0.15);
}
.toggle-row:hover .toggle-switch { box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 0 0 3px rgba(255,255,255,0.04); }
.toggle-row input:checked + .toggle-switch {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover, var(--accent)));
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 0 0 0 rgba(0,0,0,0);
}
.toggle-row input:checked + .toggle-switch::after {
    left: 23px;
    background: linear-gradient(180deg, #ffffff, #ececec);
    box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.toggle-row input:focus-visible + .toggle-switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- FAB stack (shared bottom-right column for all floating buttons) --- */
#fab-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10001;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}
#fab-stack > * { pointer-events: auto; }
/* Strip per-FAB fixed positioning when inside the stack — stack handles layout. */
#fab-stack > .br-fab,
#fab-stack > #social-chat-widget,
#fab-stack > #social-chat-widget .scw-fab {
    position: static;
    bottom: auto; right: auto; top: auto; left: auto;
}
/* Normalize FAB sizes inside the stack so they line up evenly. */
#fab-stack > .br-fab,
#fab-stack > #social-chat-widget .scw-fab {
    width: 52px;
    height: 52px;
}
/* Badge on scw-fab still needs the parent to be positioned. */
#fab-stack > #social-chat-widget .scw-fab { position: relative; }

/* --- Bug Reporter --- */
.br-fab {
    position: fixed; bottom: 2rem; right: 1.5rem;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--bg-3); border: 2px solid var(--danger);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 10001;
    box-shadow: 0 2px 12px rgba(248,113,113,0.3); transition: all 0.2s;
}
.br-fab:hover { transform: scale(1.1); box-shadow: 0 4px 20px rgba(248,113,113,0.5); border-color: #fca5a5; }
.br-fab svg { width: 26px; height: 26px; stroke: var(--danger); }
.br-fab:hover svg { stroke: #fca5a5; }

body.br-selecting { cursor: crosshair !important; }
body.br-selecting * { cursor: crosshair !important; }
body.br-selecting .br-fab { cursor: pointer !important; }

.br-overlay {
    position: fixed; pointer-events: none;
    border: 2px solid var(--danger); background: rgba(248,113,113,0.12);
    border-radius: 4px; z-index: 99999;
    transition: top 0.08s, left 0.08s, width 0.08s, height 0.08s; display: none;
}

.br-modal-wrap {
    position: fixed; inset: 0; z-index: 10002;
    display: flex; align-items: flex-start; justify-content: center;
    background: rgba(0,0,0,0.5);
}
.br-modal {
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: 12px; max-width: 460px; width: 90vw; margin-top: 10vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.br-modal-header {
    padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.br-modal-header h2 { margin: 0; font-size: 1.1rem; }
.br-modal-close {
    background: none; border: none; color: var(--text-2);
    font-size: 1.5rem; cursor: pointer; padding: 0 4px; line-height: 1;
}
.br-modal-close:hover { color: var(--text-0); }
.br-modal-body { padding: 1.2rem; }

.br-field { margin-bottom: 1rem; }
.br-label {
    display: block; font-size: 0.8rem; color: var(--text-2);
    margin-bottom: 0.3rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.br-info code {
    background: rgba(255,255,255,0.06); padding: 0.25rem 0.5rem;
    border-radius: 4px; font-size: 0.85rem; color: var(--accent); display: inline-block;
}
.br-path small { color: var(--text-2); font-size: 0.75rem; margin-top: 0.2rem; display: block; }

.br-type-toggle { display: flex; gap: 0.5rem; }
.br-type-option { cursor: pointer; }
.br-type-option input { display: none; }
.br-type-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 1rem; border-radius: 20px; font-size: 0.85rem; font-weight: 500;
    border: 1.5px solid var(--border); color: var(--text-2);
    background: transparent; transition: all 0.2s;
}
.br-type-option input:checked + .br-type-bug {
    border-color: var(--danger); color: var(--danger); background: var(--danger-dim);
}
.br-type-option input:checked + .br-type-feature {
    border-color: var(--accent); color: var(--accent); background: var(--accent-dim);
}

.br-textarea {
    width: 100%; background: rgba(255,255,255,0.04);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-0); padding: 0.7rem; font-size: 0.9rem;
    font-family: inherit; resize: vertical; min-height: 80px;
}
.br-textarea:focus { outline: none; border-color: var(--accent); }

.br-submit {
    width: 100%; padding: 0.7rem; border: none; border-radius: 8px;
    background: var(--accent); color: #fff; font-size: 0.9rem;
    font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.br-submit:hover { background: var(--accent-hover); }

.br-toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
    padding: 0.6rem 1.2rem; border-radius: 8px; font-size: 0.85rem;
    color: #fff; z-index: 10010; animation: br-fade-in 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.br-toast.success { background: var(--success); color: #000; }
.br-toast.error { background: var(--danger); }
.br-toast.info { background: var(--info); color: #000; }
@keyframes br-fade-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* --- Responsive --- */
@media (max-width: 900px) {
    .card-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .calendar-body .cal-day { min-height: 60px; }
    .cal-event { font-size: 9px; }
}

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    .search-kbd { display: none; }

    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }

    #main { margin-left: 0; }
    #content { padding: 16px; }

    .view-header h1 { font-size: 20px; }
    .stat-value { font-size: 22px; }

    .inline-form form { flex-direction: column; }
    .inline-input { min-width: unset; width: 100%; }
    .inline-form .btn { width: 100%; justify-content: center; }

    .cal-day { min-height: 50px; padding: 4px; }
    .cal-day-num { width: 20px; height: 20px; font-size: 11px; }
    .cal-event { display: none; }
    .cal-day.has-events::after {
        content: '';
        display: block;
        width: 4px; height: 4px;
        border-radius: 50%;
        background: var(--accent);
        margin: 2px auto 0;
    }
}

/* ===== Habits ===== */
.view-habits .view-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.habit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }
.habit-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-card, #151828);
    border: 1px solid var(--border, #242842);
    border-radius: 10px;
    transition: border-color .15s;
}
.habit-row:hover { border-color: var(--accent, #7c5cff); }
.habit-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.habit-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.habit-text { min-width: 0; }
.habit-name { font-weight: 600; color: var(--text, #e8e8f0); margin-bottom: 2px; }
.habit-meta { font-size: 12px; color: var(--text-dim, #8a8aa8); }
.habit-last7 { display: flex; gap: 4px; }
.hb-dot {
    display: inline-block; width: 12px; height: 12px; border-radius: 50%;
    background: var(--border, #242842);
}
.hb-done  { background: var(--success, #22c55e); }
.hb-skip  { background: var(--warning, #f59e0b); }
.hb-miss  { background: var(--danger, #ef4444); opacity: .6; }
.habit-actions { display: flex; gap: 8px; }
.habit-check {
    width: 40px; height: 40px; border-radius: 10px;
    border: 2px solid var(--border, #242842); background: transparent;
    color: var(--text-dim, #8a8aa8); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; transition: all .15s;
}
.habit-check:hover { border-color: var(--accent, #7c5cff); color: var(--text, #e8e8f0); }
.habit-check.checked { background: var(--success, #22c55e); border-color: var(--success, #22c55e); color: #fff; }
.habit-check.checked svg { width: 20px; height: 20px; }
.icon-btn {
    width: 32px; height: 32px; padding: 0;
    background: transparent; border: none; color: var(--text-dim, #8a8aa8);
    cursor: pointer; border-radius: 6px;
}
.icon-btn:hover { background: var(--border, #242842); color: var(--danger, #ef4444); }

.habit-form {
    background: var(--bg-card, #151828); padding: 20px; border-radius: 10px;
    border: 1px solid var(--border, #242842); margin-bottom: 16px;
    display: flex; flex-direction: column; gap: 16px;
}
.habit-form input[type=text], .habit-form select, .habit-form input[type=number] {
    background: var(--bg, #0e1020); border: 1px solid var(--border, #242842);
    color: var(--text, #e8e8f0); padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.habit-form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.habit-form-row label { min-width: 80px; font-size: 13px; color: var(--text-dim, #8a8aa8); }
.icon-picker, .color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-pick {
    width: 36px; height: 36px; border-radius: 8px; border: 2px solid transparent;
    background: var(--bg, #0e1020); font-size: 18px; cursor: pointer;
}
.icon-pick.selected, .icon-pick:hover { border-color: var(--accent, #7c5cff); }
.color-pick {
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
}
.color-pick.selected { border-color: #fff; transform: scale(1.15); }
.habit-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.habit-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.habit-stat-card {
    background: var(--bg-card, #151828); border: 1px solid var(--border, #242842);
    border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center;
}
.habit-stat-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.habit-stat-name { font-weight: 600; font-size: 14px; }
.habit-stat-meta { font-size: 12px; color: var(--text-dim, #8a8aa8); }

@media (max-width: 640px) {
    .habit-row { grid-template-columns: 1fr auto; }
    .habit-last7 { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Dashboard habits widget */
.today-habits { display: flex; flex-direction: column; gap: 6px; }
.today-habit {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: transparent;
    border: 1px solid var(--border, #242842); border-radius: 8px;
    color: var(--text, #e8e8f0); cursor: pointer; text-align: left;
    transition: all .15s;
}
.today-habit:hover { border-color: var(--h-color, var(--accent)); }
.today-habit.done { background: color-mix(in srgb, var(--h-color) 15%, transparent); border-color: var(--h-color); }
.today-habit .th-icon { font-size: 16px; }
.today-habit .th-name { flex: 1; font-size: 13px; }
.today-habit .th-mark { font-size: 16px; color: var(--h-color); font-weight: 700; }

/* Habits — modal + heatmap */
.habit-main[data-action="detail"] { cursor: pointer; }
.habit-main[data-action="detail"]:hover .habit-name { color: var(--accent, #7c5cff); }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal {
    background: var(--bg-card, #151828); border: 1px solid var(--border, #242842);
    border-radius: 14px; padding: 24px; max-width: 760px; width: 100%;
    max-height: 90vh; overflow: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: space-between; margin-top: 20px; gap: 8px; }

.stat-row-mini {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0;
}
.stat-row-mini > div {
    background: var(--bg, #0e1020); padding: 12px; border-radius: 8px;
    border: 1px solid var(--border, #242842); text-align: center;
}
.sm-val { font-size: 20px; font-weight: 700; color: var(--text, #e8e8f0); }
.sm-lab { font-size: 11px; color: var(--text-dim, #8a8aa8); text-transform: uppercase; margin-top: 2px; }

.heatmap { overflow-x: auto; padding: 12px 0; }
.hm-months { display: grid; grid-auto-flow: column; grid-auto-columns: 14px; font-size: 10px; color: var(--text-dim, #8a8aa8); margin-bottom: 4px; margin-left: 0; }
.hm-month { grid-row: 1; }
.hm-grid { display: flex; gap: 3px; }
.hm-week { display: flex; flex-direction: column; gap: 3px; }
.hm-cell {
    width: 11px; height: 11px; border-radius: 2px;
    background: var(--border, #242842); display: block;
}
.hm-void { visibility: hidden; }
.hm-done { background: var(--success, #22c55e); }
.hm-skip { background: var(--warning, #f59e0b); opacity: .7; }
.hm-empty { background: var(--border, #242842); }

@media (max-width: 640px) {
    .stat-row-mini { grid-template-columns: repeat(2, 1fr); }
    .modal { padding: 16px; }
}

.gcal-hint {
    margin-top: 16px; padding: 12px 16px;
    background: color-mix(in srgb, var(--accent, #7c5cff) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, #7c5cff) 30%, transparent);
    border-radius: 8px; font-size: 13px;
    color: var(--text-dim, #8a8aa8);
}
.gcal-hint strong { color: var(--text, #e8e8f0); }

/* Card hover affordance */
.card[data-project-id] { cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.card[data-project-id]:hover { transform: translateY(-2px); border-color: var(--accent, #7c5cff); box-shadow: 0 4px 18px rgba(124, 92, 255, 0.18); }

/* ========== Todo v2 — compact row + accordion/modal detail ========== */
.todo-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.todo-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.todo-row:last-child { border-bottom: none; }
.todo-row.todo-done .todo-title { text-decoration: line-through; opacity: 0.55; }
.todo-row.todo-expanded { background: var(--bg-2, rgba(255,255,255,0.02)); }

.todo-item-v2 {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.todo-item-v2:hover { background: rgba(255,255,255,0.03); }

.todo-pri-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}
.todo-pri-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-3);
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
}
.todo-item-v2 .todo-title {
    font-size: 14px;
    color: var(--text-0);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.todo-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}
.todo-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-2, rgba(255,255,255,0.04));
    color: var(--text-2);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.pill-project { background: rgba(96,165,250,0.10); color: #93c5fd; border-color: rgba(96,165,250,0.25); }
.pill-section { background: rgba(168,85,247,0.10); color: #c4b5fd; border-color: rgba(168,85,247,0.22); }
.pill-date { color: var(--text-2); }
.pill-overdue { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,0.3); }
.pill-blocked { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,0.3); }
.pill-progress { background: rgba(251,191,36,0.12); color: var(--warning); border-color: rgba(251,191,36,0.3); }

.todo-detail {
    padding: 14px 18px 18px 32px;
    border-top: 1px dashed var(--border);
    animation: expandIn 0.18s ease-out;
}
@keyframes expandIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.todo-detail-desc {
    font-size: 13px;
    color: var(--text-1);
    margin-bottom: 12px;
    white-space: pre-wrap;
    line-height: 1.5;
}
.todo-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px 20px;
    margin-bottom: 12px;
}
.todo-detail-row {
    font-size: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.todo-detail-row .label {
    color: var(--text-3);
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}
.todo-detail-label {
    color: var(--text-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.todo-detail-peers {
    margin-bottom: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.todo-peer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.todo-peer-list li {
    font-size: 12px;
    color: var(--text-2);
    display: flex;
    gap: 8px;
    align-items: center;
}
.todo-detail-footer {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Modal style for todo detail — explicit to avoid conflicts with habit modal overrides */
#todo-modal.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: transparent;
    border: none;
    border-radius: 0;
}
#todo-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(6px);
    z-index: 0;
}
#todo-modal .modal-panel-todo {
    position: relative;
    z-index: 1;
    background: var(--bg-1, #151828);
    border: 1px solid var(--border-hover, rgba(255,255,255,0.14));
    border-radius: 12px;
    padding: 22px 24px 20px;
    max-width: 640px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    color: var(--text-1, #e5e7eb);
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.18s ease-out;
}
#todo-modal .modal-title {
    margin: 0 0 14px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    color: var(--text-0, #f5f5f7);
    font-weight: 600;
    line-height: 1.35;
}
#todo-modal .todo-detail {
    padding: 0;
    border: none;
    animation: none;
}
#todo-modal .todo-detail-desc { color: var(--text-1, #e5e7eb); }
#todo-modal .todo-detail-row .label { color: var(--text-3, #71717a); }
#todo-modal .todo-detail-row { color: var(--text-1, #e5e7eb); }

/* Radio group — segmented control style */
.radio-group {
    display: inline-flex;
    gap: 3px;
    margin-top: 8px;
    padding: 3px;
    background: var(--bg-2, rgba(255,255,255,0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 420px;
}
.radio-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: calc(var(--radius-sm) - 3px);
    cursor: pointer;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    border: none;
    user-select: none;
}
.radio-row:hover { color: var(--text-0); background: rgba(255,255,255,0.04); }
.radio-row input[type=radio] { display: none; }
.radio-row:has(input[type=radio]:checked) {
    background: var(--accent-dim, rgba(124,92,255,0.15));
    color: var(--text-0);
    box-shadow: inset 0 0 0 1px var(--accent, #7c5cff);
}

/* Settings toggles — card style */
.settings-section .toggle-row {
    padding: 12px 14px;
    background: var(--bg-2, rgba(255,255,255,0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.settings-section .toggle-row:hover {
    border-color: var(--border-hover, rgba(255,255,255,0.14));
    background: rgba(255,255,255,0.04);
}
.settings-section .toggle-row span:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

/* Logout button — prominent danger hover */
#logout-btn.nav-item {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}
#logout-btn.nav-item:hover {
    color: var(--danger, #f87171);
    background: var(--danger-dim, rgba(248,113,113,0.08));
    border-radius: var(--radius-sm);
    border-top-color: transparent;
}
#logout-btn.nav-item:hover svg {
    color: var(--danger, #f87171);
    opacity: 1;
    transform: translateX(2px);
    transition: transform 0.15s ease, color 0.15s ease;
}
#logout-btn.nav-item:active { transform: scale(0.98); }

@media (max-width: 640px) {
    .todo-item-v2 { grid-template-columns: auto auto 1fr; }
    .todo-meta { grid-column: 1 / -1; justify-content: flex-start; padding-left: 22px; margin-top: 2px; }
    .todo-meta .todo-pri-label { display: none; }
}

/* ====== Transcribe Page ====== */
.tr-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .tr-grid { grid-template-columns: 1fr; } }

.tr-sidebar { display: flex; flex-direction: column; gap: 16px; }

.tr-panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.tr-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tr-panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-1); }
.tr-badge {
    display: inline-block; padding: 2px 8px; border-radius: 99px;
    background: var(--bg-3); color: var(--text-1); font-size: 11px; font-weight: 600;
}
.tr-hint { color: var(--text-2); font-size: 12px; margin: 4px 0; line-height: 1.5; }

.tr-speakers { display: flex; flex-direction: column; gap: 6px; }
.tr-speaker-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: var(--radius-sm);
    background: var(--bg-2); border: 1px solid var(--border);
    transition: var(--transition);
}
.tr-speaker-chip:hover { border-color: var(--sp-color); }
.tr-speaker-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sp-color); flex-shrink: 0; }
.tr-speaker-name { flex: 1; font-weight: 500; font-size: 13px; }
.tr-speaker-play, .tr-speaker-del {
    background: none; border: none; color: var(--text-2); cursor: pointer;
    padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.tr-speaker-play:hover { color: var(--accent); background: var(--bg-3); }
.tr-speaker-del:hover { color: var(--danger); background: var(--bg-3); }
.tr-speaker-del svg { width: 14px; height: 14px; }

.tr-history { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.tr-history-item {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 8px 10px; background: transparent; border: none; cursor: pointer;
    border-radius: var(--radius-sm); text-align: left; color: var(--text-0);
    transition: var(--transition);
}
.tr-history-item:hover { background: var(--bg-3); }
.tr-history-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tr-history-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

.tr-main { display: flex; flex-direction: column; gap: 20px; }

.tr-drop {
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius);
    padding: 40px 20px; text-align: center;
    background: var(--bg-1);
    cursor: pointer;
    transition: var(--transition);
}
.tr-drop:hover, .tr-drop.drag { border-color: var(--accent); background: var(--accent-dim); }
.tr-drop.busy { border-style: solid; cursor: default; }
.tr-drop svg { width: 40px; height: 40px; color: var(--text-2); margin-bottom: 12px; }
.tr-drop h2 { margin: 0 0 4px; font-size: 18px; }
.tr-drop p { color: var(--text-2); margin: 0 0 16px; font-size: 13px; }
.tr-drop-meta { display: flex; gap: 12px; justify-content: center; align-items: center; }
.tr-lang { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.tr-lang select {
    background: var(--bg-3); color: var(--text-0); border: 1px solid var(--border);
    padding: 4px 8px; border-radius: var(--radius-sm); font-size: 12px;
}

.tr-empty {
    background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; color: var(--text-2);
}

.tr-result {
    background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.tr-result-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    gap: 12px;
}
.tr-result-head h2 { margin: 0 0 4px; font-size: 18px; }
.tr-result-meta { color: var(--text-2); font-size: 12px; margin: 0; }
.tr-result-actions { display: flex; gap: 8px; flex-shrink: 0; }

.tr-tabs {
    display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tr-tab {
    background: none; border: none; color: var(--text-2);
    padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
    border-bottom: 2px solid transparent; white-space: nowrap;
    transition: var(--transition);
}
.tr-tab:hover { color: var(--text-0); }
.tr-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tr-tab.has-data { color: var(--text-0); }

.tr-tab-body { padding: 20px; }

.tr-segments { display: flex; flex-direction: column; gap: 14px; }
.tr-segment {
    padding: 10px 14px; background: var(--bg-2); border-radius: var(--radius-sm);
    border-left: 3px solid var(--bg-4);
}
.tr-seg-meta { display: flex; gap: 10px; align-items: center; font-size: 11px; margin-bottom: 4px; }
.tr-seg-speaker { font-weight: 600; font-size: 12px; }
.tr-seg-time { color: var(--text-3); font-family: var(--mono); }
.tr-seg-text { font-size: 14px; line-height: 1.6; }

.tr-plain { white-space: pre-wrap; font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--text-0); }

.tr-analysis-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tr-analysis-head h3 { margin: 0; }
.tr-analysis-body { line-height: 1.65; font-size: 14px; }
.tr-analysis-body h1, .tr-analysis-body h2, .tr-analysis-body h3 { margin-top: 16px; }
.tr-analysis-body ul, .tr-analysis-body ol { margin: 8px 0; padding-left: 24px; }
.tr-analysis-body li { margin: 4px 0; }
.tr-analysis-body code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.tr-analysis-empty { text-align: center; padding: 30px; color: var(--text-2); }
.tr-analysis-empty p { margin: 0 0 16px; }
.tr-analysis-loading { text-align: center; padding: 40px; }
.tr-analysis-loading p { color: var(--text-2); margin-top: 12px; }
.tr-error { color: var(--danger); background: var(--danger-dim); padding: 12px; border-radius: var(--radius-sm); }

/* Modal for speaker recorder */
.tr-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.tr-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.tr-modal-panel {
    position: relative; background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; width: 420px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.tr-modal-panel h3 { margin: 0 0 8px; }
.tr-input {
    width: 100%; background: var(--bg-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text-0);
    font-size: 14px; margin: 12px 0;
}
.tr-rec-controls { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.tr-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===== Claude Tab ===== */

.claude-container {
    display: flex; flex-direction: column;
    height: calc(100vh - var(--topbar-h));
    max-width: 100%; margin: -24px; padding: 0;
}

/* Claude Topbar */
.claude-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-1); flex-shrink: 0;
    flex-wrap: wrap;
}
.claude-tb-group { display: flex; align-items: center; gap: 8px; }
.claude-tb-right { margin-left: auto; }

.claude-select {
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 5px 8px;
    color: var(--text-1); font-size: 12px;
    max-width: 180px; cursor: pointer;
}
.claude-select:hover { border-color: var(--border-hover); }

.claude-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; background: var(--bg-3);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--transition);
    font-size: 11px;
}
.claude-badge:hover { border-color: var(--accent); background: var(--bg-4); }
.claude-badge-label { color: var(--text-3); font-weight: 500; }
.claude-badge-val { color: var(--text-0); font-weight: 600; }

.claude-usage {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; background: var(--bg-3);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 11px; color: var(--text-1);
    font-family: var(--mono);
    white-space: nowrap;
}
.claude-usage-sep { color: var(--text-3); }
.claude-usage-cell { display: inline-flex; gap: 4px; align-items: baseline; }
.claude-usage-label { color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.claude-usage-cell.is-warn { color: #e3b341; }
.claude-usage-cell.is-danger { color: #f85149; font-weight: 600; }
.claude-usage .usage-warn { color: #e3b341; }
.claude-usage .usage-crit { color: #f85149; font-weight: 600; }

.btn-icon-sm {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-3); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-1);
    transition: all var(--transition);
}
.btn-icon-sm:hover { background: var(--bg-4); color: var(--text-0); border-color: var(--border-hover); }
.btn-icon-sm svg { width: 14px; height: 14px; }

.claude-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 500;
    padding: 5px 10px; background: var(--bg-3);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}

.claude-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    transition: background var(--transition);
}

.status-disconnected .claude-status-dot { background: var(--text-3); }
.status-disconnected .claude-status-text { color: var(--text-3); }
.status-connecting .claude-status-dot { background: var(--warning); animation: pulse 1.5s infinite; }
.status-connecting .claude-status-text { color: var(--warning); }
.status-connected .claude-status-dot { background: var(--success); }
.status-connected .claude-status-text { color: var(--success); }

/* Messages area */
.claude-messages {
    flex: 1; overflow-y: auto;
    padding: 24px; display: flex; flex-direction: column; gap: 12px;
    scroll-behavior: smooth;
}

.claude-welcome {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; flex: 1;
    text-align: center; color: var(--text-2);
    gap: 12px; padding: 40px;
}

.claude-welcome-icon svg {
    width: 48px; height: 48px; color: var(--text-3);
    opacity: 0.5;
}

.claude-welcome-sub { font-size: 12px; color: var(--text-3); max-width: 400px; }

/* Message bubbles */
.claude-msg { max-width: 85%; animation: msgIn 0.2s ease; }

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.claude-msg-user {
    align-self: flex-end;
}

.claude-msg-user .claude-msg-content {
    background: var(--accent-dim); border: 1px solid rgba(129,140,248,0.15);
    border-radius: 16px 16px 4px 16px;
    padding: 10px 16px; color: var(--text-0);
    font-size: 14px; line-height: 1.6;
    white-space: pre-wrap;
}

.claude-msg-assistant {
    align-self: flex-start;
}

.claude-msg-assistant .claude-msg-content {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: 16px 16px 16px 4px;
    padding: 12px 16px; color: var(--text-0);
    font-size: 14px; line-height: 1.6;
}

.claude-msg-assistant .claude-msg-content p { margin: 0 0 8px; }
.claude-msg-assistant .claude-msg-content p:last-child { margin: 0; }
.claude-msg-assistant .claude-msg-content code {
    background: var(--bg-4); padding: 2px 6px;
    border-radius: 4px; font-family: var(--mono); font-size: 13px;
}
.claude-msg-assistant .claude-msg-content pre {
    background: var(--bg-0); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px;
    overflow-x: auto; margin: 8px 0;
}
.claude-msg-assistant .claude-msg-content pre code {
    background: none; padding: 0;
    font-size: 12px; line-height: 1.5;
}

/* Tool call cards */
.claude-tool {
    align-self: flex-start; max-width: 85%;
    animation: msgIn 0.2s ease;
}

.claude-tool details { border-radius: var(--radius-sm); overflow: hidden; }

.claude-tool-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer;
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px; color: var(--text-2);
    transition: background var(--transition);
    list-style: none;
}

.claude-tool-header::-webkit-details-marker { display: none; }
.claude-tool-header:hover { background: var(--bg-4); }

.claude-tool-icon svg { width: 14px; height: 14px; opacity: 0.6; }
.claude-tool-name { font-weight: 600; color: var(--text-1); }
.claude-tool-summary {
    color: var(--text-3); font-family: var(--mono); font-size: 11px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 400px;
}

.claude-tool-result .claude-tool-header {
    background: var(--success-dim); border-color: rgba(74,222,128,0.15);
}
.claude-tool-result .claude-tool-icon svg { color: var(--success); }

.claude-tool-body {
    background: var(--bg-0); border: 1px solid var(--border);
    border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 12px; margin: 0;
    font-size: 11px; line-height: 1.4;
    max-height: 300px; overflow: auto;
    color: var(--text-1);
}

.claude-tool-body code { font-family: var(--mono); }

/* Typing indicator */
.claude-typing {
    display: flex; gap: 4px; padding: 4px 0;
}

.claude-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-3);
    animation: typing 1.4s ease-in-out infinite;
}
.claude-typing span:nth-child(2) { animation-delay: 0.2s; }
.claude-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.claude-input-area {
    flex-shrink: 0; padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
}

.claude-input-wrap {
    display: flex; align-items: flex-end; gap: 8px;
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px 12px;
    transition: border-color var(--transition);
}

.claude-input-wrap:focus-within { border-color: var(--accent); }

.claude-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text-0); font-size: 14px; font-family: var(--font);
    resize: none; max-height: 200px; line-height: 1.5;
    padding: 4px 0;
}

.claude-input::placeholder { color: var(--text-3); }
.claude-input:disabled { opacity: 0.5; }

.claude-send-btn {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--accent); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}

.claude-send-btn svg { width: 16px; height: 16px; color: white; }
.claude-send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.claude-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Tabs */
.claude-tabs {
    display: flex; gap: 2px;
    padding: 0 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-1); flex-shrink: 0;
}
.claude-tab {
    background: none; border: none; cursor: pointer;
    padding: 10px 14px; color: var(--text-2);
    font-size: 12px; font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.claude-tab:hover { color: var(--text-0); }
.claude-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.claude-tab-count {
    font-size: 10px; background: var(--bg-3); color: var(--text-2);
    padding: 1px 6px; border-radius: 8px;
}
.claude-tab.active .claude-tab-count { background: var(--accent-dim); color: var(--accent); }

.claude-tab-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.claude-filter-bar {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 8px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-1); flex-shrink: 0;
}
.claude-filter-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 12px;
    background: var(--bg-2); color: var(--text-3);
    border: 1px solid var(--border);
    font-size: 11px; font-weight: 500; cursor: pointer;
    transition: all var(--transition);
}
.claude-filter-pill:hover { color: var(--text-0); border-color: var(--text-3); }
.claude-filter-pill.active {
    background: var(--accent-dim); color: var(--accent);
    border-color: var(--accent);
}
.claude-filter-pill svg { width: 12px; height: 12px; }
.claude-filter-hint {
    font-size: 11px; color: var(--text-3); margin-left: 8px;
}

.claude-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.claude-body.is-split { flex-direction: row; }
.claude-body.is-split .claude-tab-content { flex: 2; }

.claude-sidebar { display: none; }
.claude-body.is-split .claude-sidebar {
    display: flex; flex-direction: column; flex: 1;
    min-width: 200px; max-width: 320px;
    border-left: 1px solid var(--border);
    background: var(--bg-1);
    overflow: hidden;
}
.claude-sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 600;
}
.claude-sidebar-title { color: var(--text-0); }
.claude-sidebar-count {
    font-family: var(--mono); font-size: 11px; color: var(--text-3);
    padding: 1px 6px; background: var(--bg-3); border-radius: 8px;
}
.claude-sidebar-body {
    flex: 1; overflow-y: auto; padding: 8px;
    display: flex; flex-direction: column; gap: 4px;
}
.claude-sidebar-empty {
    padding: 20px 12px; color: var(--text-3); font-size: 12px; text-align: center;
}
.claude-sidebar-joshua { border-left-color: rgba(227, 179, 65, 0.4); }
.claude-sidebar-joshua .claude-sidebar-head { background: rgba(227, 179, 65, 0.08); }
.claude-sidebar-claude { border-left-color: rgba(88, 166, 255, 0.4); }
.claude-sidebar-claude .claude-sidebar-head { background: rgba(88, 166, 255, 0.08); }

.claude-task {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 6px 8px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 12px; color: var(--text-1);
    line-height: 1.4;
    transition: background var(--transition);
}
.claude-task:hover { background: var(--bg-3); }
.claude-task input[type="checkbox"] {
    margin: 2px 0 0 0; cursor: pointer; flex-shrink: 0;
    accent-color: var(--accent);
}
.claude-task-text { word-break: break-word; }
.claude-task.is-done .claude-task-text {
    text-decoration: line-through; color: var(--text-3);
}

.btn-icon-sm.is-active {
    background: var(--accent-dim); color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 900px) {
    .claude-body.is-split { flex-direction: column; }
    .claude-body.is-split .claude-sidebar {
        max-width: none; max-height: 180px; border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* Logs */
.claude-logs { overflow-y: auto; flex: 1; padding: 12px 20px; font-family: var(--mono); font-size: 11px; }
.claude-logs-empty { padding: 40px; color: var(--text-3); text-align: center; font-size: 13px; }
.claude-log-entry {
    display: grid; grid-template-columns: 80px 140px 1fr;
    gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border);
    color: var(--text-1);
}
.claude-log-time { color: var(--text-3); }
.claude-log-type { color: var(--accent); font-weight: 600; }
.claude-log-msg { color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Modal */
.claude-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.claude-modal.hidden { display: none; }
.claude-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.claude-modal-panel {
    position: relative; background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); width: 500px; max-width: 90vw; max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.claude-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.claude-modal-head h2 { font-size: 16px; margin: 0; }
.claude-modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.claude-modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid var(--border);
}
.claude-field { display: flex; flex-direction: column; gap: 6px; }
.claude-field label { font-size: 12px; font-weight: 600; color: var(--text-1); }
.claude-field input[type="text"], .claude-field input[type="password"], .claude-field select {
    background: var(--bg-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 10px;
    color: var(--text-0); font-size: 13px;
}
.claude-field small { font-size: 11px; color: var(--text-3); }
.claude-field code { font-family: var(--mono); background: var(--bg-4); padding: 1px 4px; border-radius: 3px; }
.claude-field-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Dropdown */
.claude-dropdown {
    position: fixed; z-index: 999;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    min-width: 200px;
}
.claude-dropdown.hidden { display: none; }
.claude-dropdown-item {
    padding: 8px 10px; cursor: pointer; border-radius: 4px;
    transition: background var(--transition);
}
.claude-dropdown-item:hover { background: var(--bg-3); }
.claude-dropdown-item.active { background: var(--accent-dim); }
.claude-dropdown-label { font-size: 12px; font-weight: 600; color: var(--text-0); }
.claude-dropdown-desc { font-size: 10px; color: var(--text-3); margin-top: 2px; }

.claude-input-hint {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text-3);
    padding: 6px 4px 0;
}

/* Buttons */
.btn { border: none; cursor: pointer; font-family: var(--font); transition: all var(--transition); }
.btn-sm { padding: 6px 14px; font-size: 12px; font-weight: 500; border-radius: var(--radius-sm); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg-3); color: var(--text-1); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-4); color: var(--text-0); }
.btn-ghost svg { width: 14px; height: 14px; }

/* ================================================================
   Applications / Sollicitaties tab
   ================================================================ */

.view-applications .app-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.app-stat {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
}
.app-stat-value { font-size: 22px; font-weight: 600; color: var(--text-0); line-height: 1.1; }
.app-stat-label { font-size: 11px; color: var(--text-2); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }

.app-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.app-filters input,
.app-filters select {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-0);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: var(--font);
}
.app-filters input { flex: 1; min-width: 200px; }
.app-filters select { min-width: 140px; }
.app-filters input:focus,
.app-filters select:focus {
    outline: none;
    border-color: var(--accent, #818cf8);
}

.app-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.app-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.app-row:hover {
    border-color: var(--border-hover);
    background: var(--bg-3);
    transform: translateY(-1px);
}
.app-row-main { flex: 1; min-width: 0; }
.app-row-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.app-company { font-weight: 600; color: var(--text-0); font-size: 14px; }
.app-role { color: var(--text-1); font-size: 13px; }
.app-row-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-2);
}
.app-row-meta svg { width: 12px; height: 12px; }
.app-tag {
    background: var(--bg-3);
    color: var(--text-1);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    border: 1px solid var(--border);
}

.app-row-side {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.app-fit-pill,
.app-status-pill {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid;
    white-space: nowrap;
}
.app-tier-pill {
    background: var(--bg-3);
    color: var(--text-2);
    padding: 3px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid var(--border);
}
.app-letter-indicator {
    color: var(--text-2);
    display: flex;
    align-items: center;
}
.app-letter-indicator svg { width: 14px; height: 14px; }

/* Application detail modal */
.app-modal-panel {
    max-width: 900px;
    max-height: 90vh;
    overflow: auto;
}
.app-detail { padding: 0; }
.app-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 4px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.app-detail-title { font-size: 22px; font-weight: 600; color: var(--text-0); margin: 0 0 4px; }
.app-detail-role { font-size: 14px; color: var(--text-1); margin-bottom: 10px; }
.app-detail-meta-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 10px;
}
.app-detail-link {
    font-size: 12px;
    color: var(--accent, #818cf8);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.app-detail-link:hover { text-decoration: underline; }
.app-detail-link svg { width: 12px; height: 12px; }
.app-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
.app-status-select {
    background: var(--bg-2);
    color: var(--text-0);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--font);
}

.app-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.app-detail-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}
.app-detail-section h3 {
    font-size: 11px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 8px;
    font-weight: 600;
}
.app-detail-section h3 svg { width: 12px; height: 12px; display: inline; vertical-align: -2px; }

.app-req-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-1);
    font-size: 12px;
    line-height: 1.6;
}
.app-req-list li { margin-bottom: 2px; }
.app-req-nice li { color: var(--text-2); }

.app-blockers {
    background: rgba(248,113,113,0.05);
    border-color: rgba(248,113,113,0.25);
}
.app-blockers h3 { color: var(--danger); }

.app-cover-letter {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
}
.app-letter-body {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-0);
}
.app-letter-body h1 { font-size: 16px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.app-letter-body h2 { font-size: 14px; margin: 16px 0 8px; }
.app-letter-body p { margin: 0 0 12px; color: var(--text-1); }
.app-letter-body strong { color: var(--text-0); font-weight: 600; }
.app-letter-body ul { padding-left: 22px; margin: 0 0 12px; color: var(--text-1); }
.app-empty { color: var(--text-3); font-size: 12px; font-style: italic; }

/* --- Voice (VoiceClaude) --- */
.voice-grid { display: flex; flex-direction: column; gap: 16px; height: calc(100vh - 120px); }
.voice-controls { background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.voice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.voice-mic-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px;
    cursor: pointer; user-select: none; color: var(--text-1); font-weight: 500;
}
.voice-mic-btn svg { width: 18px; height: 18px; }
.voice-mic-btn.on { background: #dc2626; border-color: #dc2626; color: #fff; animation: voice-pulse 2s infinite; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }

.voice-vu {
    position: relative; width: 140px; height: 10px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: 6px; overflow: hidden; flex-shrink: 0;
}
.voice-vu-bar {
    position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
    background: linear-gradient(90deg, #22c55e 0%, #22c55e 60%, #eab308 75%, #dc2626 100%);
    background-size: 140px 100%;
    transition: width 60ms linear;
}
.voice-vu-peak {
    position: absolute; top: -2px; bottom: -2px; left: 0%;
    width: 2px; background: var(--text-0); opacity: 0.85;
    transition: left 120ms ease-out;
    pointer-events: none;
}

.voice-bridge-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px;
    background: var(--bg-2); border: 1px solid var(--border);
    color: var(--text-1); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
    font-family: var(--mono, inherit);
}
.voice-bridge-btn:hover { background: var(--bg-3); border-color: var(--accent); }
.voice-bridge-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-3); transition: background 0.2s;
}
.voice-bridge-btn.connected { color: #22c55e; border-color: rgba(34,197,94,0.4); }
.voice-bridge-btn.connected .voice-bridge-dot { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.voice-bridge-btn.connecting { color: #eab308; border-color: rgba(234,179,8,0.4); }
.voice-bridge-btn.connecting .voice-bridge-dot { background: #eab308; animation: voice-bridge-pulse 1s infinite; }
.voice-bridge-btn.disconnected { color: var(--text-2); }
@keyframes voice-bridge-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.voice-settings-btn {
    margin-left: auto;
    background: transparent; border: 1px solid var(--border);
    color: var(--text-2); border-radius: 8px;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
}
.voice-settings-btn:hover { color: var(--text-0); border-color: var(--accent); background: var(--bg-3); }

.voice-modal {
    background: var(--bg-1); color: var(--text-0);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 0; max-width: 520px; width: 90vw;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.voice-modal::backdrop { background: rgba(0,0,0,0.6); }
.voice-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.voice-modal-head h3 { margin: 0; font-size: 15px; }
.voice-modal-close {
    background: none; border: none; color: var(--text-2);
    font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.voice-modal-close:hover { color: var(--text-0); }
.voice-modal-body { padding: 16px 18px; max-height: 65vh; overflow-y: auto; }
.voice-modal-body h4 {
    margin: 0 0 12px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-2);
}
.voice-modal-body h4:not(:first-child) { margin-top: 22px; }
.voice-field { margin-bottom: 14px; }
.voice-field label {
    display: block; font-size: 12px; color: var(--text-1);
    margin-bottom: 5px; font-weight: 500;
}
.voice-field input[type="text"], .voice-field input[type="password"] {
    width: 100%; box-sizing: border-box;
    background: var(--bg-2); border: 1px solid var(--border);
    color: var(--text-0); padding: 7px 10px; border-radius: 6px;
    font-family: var(--mono, monospace); font-size: 12px;
}
.voice-field input[type="text"]:focus, .voice-field input[type="password"]:focus {
    outline: none; border-color: var(--accent);
}
.voice-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.voice-field small {
    display: block; font-size: 11px; color: var(--text-3); margin-top: 4px;
}
.voice-field small code {
    background: var(--bg-3); padding: 1px 5px; border-radius: 3px;
    font-size: 10px;
}
.voice-engine-toggle {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
    padding: 10px 12px;
}
.voice-engine-toggle label {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 12px; color: var(--text-1); margin-bottom: 0;
}
.voice-engine-toggle label small {
    display: inline; color: var(--text-3); font-size: 11px; margin-left: 4px;
}

.voice-modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 18px; border-top: 1px solid var(--border);
}

.voice-lang-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.voice-lang-toggle button {
    padding: 6px 14px; background: var(--bg-2); border: none; color: var(--text-2);
    cursor: pointer; font-weight: 500; font-size: 12px;
}
.voice-lang-toggle button.active { background: var(--accent, #7c5cff); color: #fff; }

.voice-temp { padding: 6px 10px; border-radius: 6px; font-size: 12px; font-family: var(--mono, monospace); background: var(--bg-2); }
.voice-temp.ok { color: #22c55e; }
.voice-temp.warn { color: #f59e0b; background: rgba(245,158,11,0.1); }
.voice-temp.shutoff { color: #dc2626; background: rgba(220,38,38,0.15); font-weight: 700; }

.voice-speech { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-3); transition: 0.2s; }
.voice-speech.on { background: #22c55e; box-shadow: 0 0 8px #22c55e; }

.voice-stt-status, .voice-bridge-status {
    padding: 4px 10px; border-radius: 6px; font-size: 11px;
    background: var(--bg-2); color: var(--text-3); font-family: var(--mono, monospace);
}
.voice-stt-status.on, .voice-bridge-status.connected { background: rgba(34,197,94,0.15); color: #22c55e; }
.voice-bridge-status.connecting { background: rgba(245,158,11,0.15); color: #f59e0b; }
.voice-auto-send { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.voice-log-panel, .voice-staging-panel {
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
    display: flex; flex-direction: column; overflow: hidden;
}
.voice-log-panel { flex: 1; min-height: 0; }
.voice-panel-head {
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; justify-content: space-between; align-items: baseline;
}
.voice-staging-hint { font-size: 10px; font-weight: 400; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.voice-log { flex: 1; overflow-y: auto; padding: 8px 14px; font-family: var(--mono, monospace); font-size: 13px; }
.voice-empty { color: var(--text-3); font-style: italic; padding: 16px; text-align: center; }

.voice-log-line { display: grid; grid-template-columns: 70px 30px 1fr 60px; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.voice-log-time { color: var(--text-3); font-size: 11px; }
.voice-log-lang { color: var(--accent, #7c5cff); font-size: 10px; font-weight: 700; }
.voice-log-text { color: var(--text-1); word-break: break-word; }
.voice-log-lat { color: var(--text-3); font-size: 11px; text-align: right; }

.voice-staging { width: 100%; min-height: 120px; max-height: 200px; background: var(--bg-2); color: var(--text-0); border: none; padding: 12px 14px; font-family: inherit; font-size: 14px; resize: vertical; outline: none; }
.voice-staging-actions { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

.voice-alert::backdrop { background: rgba(0,0,0,0.5); }
.voice-alert { background: var(--bg-1); color: var(--text-0); border: 1px solid var(--border); border-radius: 10px; padding: 20px; max-width: 400px; }
.voice-alert h3 { margin: 0 0 8px; }
.voice-alert p { margin: 0 0 16px; color: var(--text-2); }

/* --- Knowledge Graph view --- */
.view-graph .graph-scope { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.graph-select {
    background: var(--bg-2); color: var(--text-0); border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 10px; font-size: 13px; cursor: pointer;
    font-family: inherit; min-width: 140px;
}
.graph-select:hover { border-color: var(--border-hover); }
.graph-select:focus { outline: none; border-color: var(--accent); }
.graph-search {
    background: var(--bg-2); color: var(--text-0); border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 12px; font-size: 13px; width: 200px;
    font-family: inherit;
}
.graph-search:focus { outline: none; border-color: var(--accent); background: var(--bg-3); }

.graph-layout {
    display: grid; grid-template-columns: 1fr 320px; gap: 16px;
    height: calc(100vh - 220px); min-height: 520px;
}
.graph-canvas {
    position: relative; background: radial-gradient(circle at 30% 20%, #0f0f18 0%, #07070a 100%);
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.graph-status {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: var(--text-2); font-size: 14px; text-align: center; padding: 16px; max-width: 80%;
}
.graph-status code {
    background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent);
}

.graph-panel {
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; overflow-y: auto;
}
.graph-panel-empty { color: var(--text-2); font-size: 13px; }
.graph-panel-empty .hint { color: var(--text-3); margin-top: 8px; font-size: 12px; }

.graph-node-detail h3 {
    font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
    word-break: break-word; color: var(--text-0);
}
.graph-node-detail h4 {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-2); margin: 14px 0 6px;
}
.nd-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.nd-chip {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2); flex-shrink: 0;
}
.nd-meta {
    display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-1);
    background: var(--bg-2); padding: 10px; border-radius: 8px; border: 1px solid var(--border);
}
.nd-meta div { display: flex; gap: 6px; align-items: baseline; }
.nd-meta span { color: var(--text-3); min-width: 60px; }
.nd-meta code {
    font-size: 11px; color: var(--accent); word-break: break-all;
    background: var(--bg-3); padding: 1px 5px; border-radius: 3px;
}
.nd-edges {
    list-style: none; font-size: 12px; color: var(--text-1);
    max-height: 240px; overflow-y: auto;
}
.nd-edges li {
    padding: 5px 8px; border-radius: 6px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.nd-edges li:last-child { border-bottom: none; }
.nd-rel {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em;
    background: var(--bg-3); padding: 1px 6px; border-radius: 3px; color: var(--text-1);
}
.nd-conf { font-size: 9px; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.nd-extracted { background: var(--success-dim); color: var(--success); }
.nd-inferred { background: var(--accent-dim); color: var(--accent); }
.nd-ambiguous { background: var(--warning-dim); color: var(--warning); }

.graph-legend {
    display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
    margin-top: 12px; padding: 10px 14px;
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
    font-size: 12px; color: var(--text-1);
}
.legend-label { color: var(--text-2); font-weight: 600; margin-right: 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend-count { color: var(--text-3); font-size: 11px; }

@media (max-width: 900px) {
    .graph-layout { grid-template-columns: 1fr; height: auto; }
    .graph-canvas { height: 60vh; }
    .graph-panel { max-height: 40vh; }
}

/* --- Devices page --- */
.device-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-2, rgba(255,255,255,0.02));
}
.device-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.device-meta strong { color: var(--text-1, #e8e8ee); font-size: 0.95rem; }
.device-meta small { color: var(--text-3, #8b8b96); font-size: 0.78rem; }
.device-item .btn-danger {
    border-color: var(--danger, #f7768e);
    color: var(--danger, #f7768e);
    background: transparent;
}
.device-item .btn-danger:hover {
    background: rgba(247, 118, 142, 0.1);
}
.install-token {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   Preview page — embedded site + topbar + site chat FAB
   ============================================================ */

#app.preview-mode #content {
    padding: 0;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

#app.preview-mode #topbar.hidden { display: none; }

.preview-shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #0a0a0c;
    color: var(--text-1);
    overflow: hidden;
}

/* --- Topbar (smal, ~44px) --- */
.preview-topbar {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    z-index: 10;
}
.preview-tb-left, .preview-tb-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.preview-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-1);
}
.preview-logo {
    width: 16px;
    height: 16px;
    color: var(--accent);
}
.preview-brand-text { font-weight: 600; letter-spacing: 0.3px; }
.preview-brand-sep { color: var(--text-3); }
.preview-project-name { color: var(--text-2); font-weight: 500; }
.preview-mode-tag {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-3);
    color: var(--text-3);
    border: 1px solid var(--border);
}

.preview-btn {
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.preview-btn:hover {
    background: var(--bg-3);
    color: var(--text-1);
    border-color: var(--border);
}
.preview-btn svg { width: 16px; height: 16px; }

.preview-viewport-group {
    display: inline-flex;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.preview-vp-btn {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.15s;
}
.preview-vp-btn:hover { color: var(--text-2); }
.preview-vp-btn.active {
    background: var(--bg-1);
    color: var(--accent);
}
.preview-vp-btn svg { width: 14px; height: 14px; }

.preview-deploy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-3);
}
.preview-deploy-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}
.preview-deploy-dot[data-status="fresh"] { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.preview-deploy-dot[data-status="recent"] { background: #f59e0b; }
.preview-deploy-dot[data-status="old"] { background: #6b7280; }

/* --- Iframe wrapper --- */
.preview-frame-wrap {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #050507;
    overflow: hidden;
    transition: padding-bottom 0.25s ease;
}
.preview-frame-wrap[data-viewport="tablet"],
.preview-frame-wrap[data-viewport="mobile"] {
    padding: 16px;
    align-items: flex-start;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 8px, transparent 8px 16px),
        #050507;
}
.preview-frame-inner {
    flex: 1;
    height: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    transition: max-width 0.25s ease;
}
.preview-frame-wrap[data-viewport="tablet"] .preview-frame-inner,
.preview-frame-wrap[data-viewport="mobile"] .preview-frame-inner {
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    max-height: 100%;
}
.preview-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    display: block;
}

/* Iframe-blocked fallback */
.preview-frame-error {
    position: absolute;
    inset: 0;
    margin: auto;
    width: max-content;
    max-width: 90%;
    height: max-content;
    padding: 24px 28px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-1);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.preview-frame-error.hidden { display: none; }
.preview-frame-error pre {
    background: var(--bg-1);
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
}

.preview-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    text-align: center;
}
.preview-error h2 { color: var(--text-1); }
.preview-error p { color: var(--text-2); max-width: 480px; }

/* --- Chat-mode adjustments to preview-shell --- */
.preview-shell[data-chat-mode="small"] .preview-frame-wrap {
    padding-bottom: 200px;
}

/* ============================================================
   Site Chat — FAB + panel (3 states: hidden/small/full)
   ============================================================ */

.site-chat-root { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.site-chat-root > * { pointer-events: auto; }

/* FAB */
.site-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-2);
    border: 2px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 4px rgba(78,159,229,0.15);
    transition: all 0.2s;
    z-index: 1001;
}
.site-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 0 6px rgba(78,159,229,0.25);
}
.site-chat-fab svg { width: 24px; height: 24px; }

/* Panel — small state (anchored to bottom, ~200px) */
.site-chat-panel {
    position: fixed;
    background: var(--bg-2);
    border: 1px solid var(--border);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    transition: all 0.25s ease;
}
.site-chat-panel[data-mode="small"] {
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
}
.site-chat-panel[data-mode="full"] {
    top: 44px;
    bottom: 0;
    left: 0;
    right: 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.site-chat-head {
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--bg-3);
    border-bottom: 1px solid var(--border);
}
.site-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-2);
}
.site-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}
.site-chat-status-dot[data-status="connected"] { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.site-chat-status-dot[data-status="connecting"] { background: #f59e0b; animation: site-chat-pulse 1.2s infinite; }
.site-chat-status-dot[data-status="disconnected"] { background: var(--text-3); }
@keyframes site-chat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.site-chat-controls {
    display: flex;
    gap: 4px;
}
.site-chat-ctrl {
    width: 26px; height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--text-2);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}
.site-chat-ctrl:hover { background: var(--bg-1); color: var(--text-1); }
.site-chat-ctrl svg { width: 14px; height: 14px; }

.site-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
}
.site-chat-empty {
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
    padding: 20px;
}
.site-chat-empty code {
    background: var(--bg-1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.site-chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.45;
    word-wrap: break-word;
}
.site-chat-msg-user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
}
.site-chat-msg-assistant {
    align-self: flex-start;
    background: var(--bg-3);
    color: var(--text-1);
}
.site-chat-msg-content { font-size: 13px; }
.site-chat-msg-content p { margin: 0 0 6px; }
.site-chat-msg-content p:last-child { margin: 0; }
.site-chat-msg-content code {
    background: rgba(0,0,0,0.3);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.site-chat-msg-content pre {
    background: rgba(0,0,0,0.4);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    margin: 4px 0;
}
.site-chat-msg-partial { opacity: 0.85; }

.site-chat-tool {
    align-self: flex-start;
    font-size: 11px;
    color: var(--text-3);
    padding: 2px 8px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.site-chat-tool-name { color: var(--text-2); font-weight: 600; }
.site-chat-tool-summary { font-family: ui-monospace, monospace; }
.site-chat-tool-err { border-color: var(--danger); color: var(--danger); }

.site-chat-input-wrap {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}
.site-chat-input {
    flex: 1;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-1);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 36px;
    max-height: 160px;
    outline: none;
    transition: border-color 0.15s;
}
.site-chat-input:focus { border-color: var(--accent); }
.site-chat-send {
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}
.site-chat-send:hover { opacity: 0.9; }
.site-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.site-chat-send svg { width: 14px; height: 14px; }

/* --- Mobile responsive --- */
@media (max-width: 768px) {
    .preview-mode-tag,
    .preview-viewport-group,
    .preview-deploy { display: none; }
    .preview-brand-sep { display: none; }
    .preview-project-name { font-size: 13px; }

    .preview-shell[data-chat-mode="small"] .preview-frame-wrap {
        padding-bottom: 180px;
    }
    .site-chat-panel[data-mode="small"] {
        height: 180px;
    }
    .site-chat-fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}
