/* ════════════════════════════════════════════════════════════
   OptimalCoder — Design System
   Dark theme inspired by VS Code / Cursor
   ════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Tokens) ── */
:root {
    /* Background layers — Antigravity deep blacks */
    --bg-base: #09090b;
    --bg-surface: #111113;
    --bg-elevated: #18181b;
    --bg-hover: #1f1f23;
    --bg-active: #27272a;
    --bg-input: #09090b;

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --text-link: #60a5fa;

    /* Accent — Gemini blue */
    --accent: #4285f4;
    --accent-hover: #5b9bf5;
    --accent-glow: rgba(66, 133, 244, 0.25);
    --accent-subtle: rgba(66, 133, 244, 0.12);

    /* Borders — very subtle */
    --border: #27272a;
    --border-focus: #4285f4;
    --border-muted: #1c1c1f;

    /* Semantic */
    --success: #4ade80;
    --warning: #facc15;
    --error: #f87171;
    --info: #60a5fa;

    /* Layout */
    --toolbar-h: 44px;
    --statusbar-h: 26px;
    --sidebar-w: 260px;
    --chat-w: 360px;
    --tab-h: 38px;

    /* Fonts */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

    /* Transitions */
    --transition: 150ms ease;
    --transition-slow: 300ms ease;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════
   Login Screen
   ════════════════════════════════════════ */
.login-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(88, 166, 255, 0.06) 0%, transparent 50%);
}

.login-card {
    width: 380px;
    padding: 48px 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    text-align: center;
    animation: fadeInUp 0.4s ease;
}

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

.login-logo {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

.btn-login {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--accent-hover), #7c3aed);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }

.login-error {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    color: var(--error);
    font-size: 13px;
}

/* ════════════════════════════════════════
   IDE Layout
   ════════════════════════════════════════ */
.ide {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Toolbar ── */
.toolbar {
    height: var(--toolbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    user-select: none;
    flex-shrink: 0;
}

.toolbar__left, .toolbar__right, .toolbar__center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar__left { flex: 1; }
.toolbar__center { flex: 0; }
.toolbar__right { flex: 1; justify-content: flex-end; }

.toolbar__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.toolbar__btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar__btn--danger:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--error);
}

.toolbar__logo {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.toolbar__workspace {
    padding: 4px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 12px;
    cursor: pointer;
    outline: none;
    min-width: 180px;
}

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

.workspace-menu {
    position: relative;
    display: inline-flex;
}

.workspace-menu__popup {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.workspace-menu__item {
    background: transparent;
    border: 0;
    color: var(--text-primary);
    text-align: left;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-ui);
}

.workspace-menu__item:hover {
    background: var(--bg-hover);
}

.workspace-menu__item--danger {
    color: var(--error);
}

.workspace-menu__item--danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

.workspace-menu__item:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.workspace-menu__item:disabled:hover {
    background: transparent;
}

.workspace-menu__sep {
    height: 1px;
    background: var(--border);
    margin: 4px 2px;
}

.workspace-picker {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.workspace-picker__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    text-align: left;
    font-family: var(--font-ui);
    font-size: 12px;
}

.workspace-picker__item:hover,
.workspace-picker__item--selected {
    border-color: var(--accent, var(--border-focus));
    background: var(--bg-elevated);
}

.workspace-picker__name {
    font-weight: 600;
}

.workspace-picker__meta {
    color: var(--text-secondary);
    font-size: 11px;
}

.workspace-picker__empty {
    padding: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.toolbar__status {
    font-size: 12px;
    color: var(--text-secondary);
}

.toolbar__user {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
}

/* ── Main Area ── */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-width: 180px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    transition: width 0s;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar__header {
    height: var(--tab-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}

.sidebar__tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.sidebar__empty {
    padding: 20px 16px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
}

/* File tree items */
.tree-item {
    display: flex;
    align-items: center;
    padding: 3px 8px 3px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 4px;
    margin: 0 4px;
    transition: background var(--transition);
}

.tree-item:hover { background: var(--bg-hover); }
.tree-item.active { background: var(--accent-subtle); color: var(--accent-hover); }
.tree-item--muted { color: var(--text-muted); cursor: default; }
.tree-item--muted:hover { background: transparent; }

.tree-item__icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    font-size: 14px;
    margin-right: 4px;
}

.tree-item__chevron {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.tree-item__chevron.expanded { transform: rotate(90deg); }

.tree-item__name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-children {
    overflow: hidden;
}

.tree-children.collapsed { display: none; }

/* Flash animation when a tree node is created or changed from the filesystem. */
@keyframes tree-flash {
    0%   { background: var(--accent-subtle, rgba(66, 133, 244, 0.35)); }
    100% { background: transparent; }
}
.tree-item--flash {
    animation: tree-flash 1.5s ease-out;
}
.tree-item--flash.active {
    animation: none;
}

/* ── Resize Handles ── */
.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background var(--transition);
    flex-shrink: 0;
    z-index: 10;
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--accent);
}

/* ── Editor Area ── */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
}

/* Tabs */
.tabs {
    height: var(--tab-h);
    display: flex;
    align-items: stretch;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    scrollbar-width: none; /* Firefox */
}
.tabs::-webkit-scrollbar { display: none; } /* Chrome */
.tabs:empty { display: none; }

.tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    min-width: 0;
    max-width: 180px;
    flex-shrink: 0;
    position: relative;
    user-select: none;
}

.tab:hover { color: var(--text-primary); background: var(--bg-hover); }

.tab.active {
    color: var(--text-primary);
    background: var(--bg-base);
    border-bottom: 2px solid var(--accent);
}

/* Saved flash animation */
.tab.saved {
    animation: tabSavedFlash 0.8s ease;
}

@keyframes tabSavedFlash {
    0% { background: rgba(74, 222, 128, 0.2); }
    100% { background: transparent; }
}

.tab__icon {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.tab__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 2px;
}

.tab:hover .tab__close { opacity: 1; }
.tab__close:hover { background: var(--bg-active); color: var(--text-primary); }

.tab__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    flex-shrink: 0;
    display: none;
}

.tab.modified .tab__dot { display: block; }
.tab.modified .tab__close { display: none; }
.tab.modified:hover .tab__dot { display: none; }
.tab.modified:hover .tab__close { display: flex; opacity: 1; }

/* Editor container */
.editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Welcome */
.welcome {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    user-select: none;
}

.welcome__icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

.welcome h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.welcome p {
    font-size: 14px;
    margin-bottom: 32px;
}

.welcome__shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    margin-right: 6px;
}

/* ── Chat Panel ── */
.chat-panel {
    width: var(--chat-w);
    min-width: 250px;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-panel.collapsed {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
    border-left: none;
}

.chat__header {
    height: var(--tab-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}

.chat__clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition);
}

.chat__clear:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Live TODO plan widget (driven by todo_write tool) ── */
.chat__todos {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
    font-size: 12px;
}

.chat__todos-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}

.chat__todos-header:hover { background: var(--bg-hover); }

.chat__todos-icon { font-size: 13px; }

.chat__todos-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.chat__todos-counter {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 11px;
}

.chat__todos-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.chat__todos--collapsed .chat__todos-chevron { transform: rotate(-90deg); }
.chat__todos--collapsed .chat__todos-list { display: none; }

.chat__todos-list {
    list-style: none;
    margin: 0;
    padding: 0 12px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat__todos-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
    line-height: 1.4;
    color: var(--text-secondary);
}

.chat__todos-marker {
    flex-shrink: 0;
    width: 14px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.chat__todos-item--in_progress {
    color: var(--text-primary);
    font-weight: 600;
}
.chat__todos-item--in_progress .chat__todos-marker {
    color: var(--accent);
    animation: todoPulse 1.2s ease-in-out infinite;
}

.chat__todos-item--completed { color: var(--text-muted); }
.chat__todos-item--completed .chat__todos-text {
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}
.chat__todos-item--completed .chat__todos-marker { color: var(--success, #22c55e); }

@keyframes todoPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat__msg {
    max-width: 100%;
    animation: msgFadeIn 0.2s ease;
}

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

.chat__msg-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat__msg--user .chat__msg-content {
    background: var(--accent-subtle);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px 12px 4px 12px;
    color: var(--text-primary);
}

.chat__msg--assistant .chat__msg-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-muted);
    border-radius: 12px 12px 12px 4px;
}

.chat__msg-content code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 1px 4px;
    background: var(--bg-base);
    border-radius: 3px;
}

.chat__msg-content pre {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 10px;
    background: var(--bg-base);
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-muted);
}

.chat__input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-muted);
    flex-shrink: 0;
}

.chat__input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    resize: none;
    outline: none;
    transition: border-color var(--transition);
    max-height: 120px;
}

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

.chat__input::placeholder { color: var(--text-muted); }

.chat__send {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-end;
    transition: all var(--transition);
}

.chat__send:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
}

.chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat__attach {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-end;
    font-size: 16px;
    transition: all var(--transition);
}

.chat__attach:hover { background: var(--bg-input); }

.chat__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 0 12px;
}

.chat__attachment {
    position: relative;
    width: 64px;
    height: 64px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-input);
}

.chat__attachment img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat__attachment-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat__attachment-remove:hover { background: rgba(220, 50, 50, 0.95); }

/* ────────── Agent pending-request modal ────────── */
.agent-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-modal[hidden] { display: none; }

.agent-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.66);
    backdrop-filter: blur(2px);
}

.agent-modal__panel {
    position: relative;
    width: min(540px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: var(--bg-surface, #18181b);
    color: var(--text-primary, #fafafa);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: agentModalIn 140ms ease-out;
}

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

.agent-modal__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border, #2a2a2e);
}

.agent-modal__title {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.agent-modal__risk {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.agent-modal__risk--low    { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.agent-modal__risk--medium { background: rgba(250, 204, 21, 0.18); color: #facc15; }
.agent-modal__risk--high   { background: rgba(248, 113, 113, 0.18); color: #f87171; }

.agent-modal__body {
    padding: 16px 18px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
}

.agent-modal__question {
    margin-bottom: 12px;
    color: var(--text-secondary, #c5c5cc);
}

.agent-modal__args {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 12px;
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 12px 0;
}

.agent-modal__options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.agent-modal__option {
    padding: 6px 12px;
    background: var(--bg-elevated, #232328);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 6px;
    color: var(--text-primary, #fafafa);
    font-size: 12px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.agent-modal__option:hover {
    background: var(--bg-hover, #2a2a30);
    border-color: var(--accent, #4285f4);
}

.agent-modal__input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-base, #09090b);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 8px;
    color: var(--text-primary, #fafafa);
    font-family: var(--font-ui, sans-serif);
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: border-color 120ms ease;
}
.agent-modal__input:focus { border-color: var(--accent, #4285f4); }

.agent-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border, #2a2a2e);
    background: rgba(0,0,0,0.18);
}

.agent-modal__btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

.agent-modal__btn--primary {
    background: var(--accent, #4285f4);
    color: #fff;
}
.agent-modal__btn--primary:hover { background: var(--accent-hover, #5b9bf5); }

.agent-modal__btn--ghost {
    background: transparent;
    color: var(--text-secondary, #c5c5cc);
    border-color: var(--border, #2a2a2e);
}
.agent-modal__btn--ghost:hover { background: var(--bg-hover, #2a2a30); color: var(--text-primary, #fafafa); }

/* Chat thinking indicator */
.chat__thinking {
    display: flex;
    gap: 4px;
    padding: 8px 14px;
}

.chat__thinking span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat__thinking span:nth-child(1) { animation-delay: -0.32s; }
.chat__thinking span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Inline "agent is thinking" placeholder shown between events */
.chat__msg--thinking .chat__msg-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
}
.chat__msg--thinking .chat__thinking { padding: 0; }
.chat__thinking-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

/* Agent status pill in chat header */
.chat__agent-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.2px;
    color: var(--text-muted);
}
.chat__agent-status[hidden] { display: none; }

.chat__agent-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: agentStatusPulse 1.2s infinite ease-in-out;
}

.chat__agent-status--disconnected {
    border-color: var(--error);
    color: var(--error);
}
.chat__agent-status--disconnected .chat__agent-status-dot {
    background: var(--error);
    animation: none;
}

@keyframes agentStatusPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.85); }
    50%      { opacity: 1;   transform: scale(1.1);  }
}

/* ── Status Bar ── */
.statusbar {
    height: var(--statusbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    user-select: none;
}

.statusbar__left, .statusbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.statusbar__sep { opacity: 0.4; }

/* ── Utility ── */
[hidden] { display: none !important; }

/* ═══════════════════════════════════════
   Activity Bar (VSCode-style thin sidebar)
   ═══════════════════════════════════════ */
.activity-bar {
    width: 48px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 0;
    background: var(--bg-base);
    border-right: 1px solid var(--border);
    user-select: none;
}

.activity-bar__btn {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
}

.activity-bar__btn:hover { color: var(--text-primary); }

.activity-bar__btn.active { color: var(--text-primary); }

.activity-bar__btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.activity-bar__btn svg { display: block; }

.sidebar__panel {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════
   Search Panel
   ═══════════════════════════════════════ */
.search-form {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 12px;
    outline: none;
    transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--accent); }
.search-input--small { font-size: 11px; padding: 5px 8px; }

.search-btn {
    padding: 6px 12px;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: white;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.search-btn:hover { background: var(--accent-hover); }

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.search-empty {
    padding: 20px 16px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
    text-align: center;
}

.search-count {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-muted);
}

.search-file__name {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-file__count {
    font-size: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}

.search-match {
    display: flex;
    gap: 8px;
    padding: 3px 12px 3px 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition);
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.search-match:hover { background: var(--bg-hover); }

.search-match__line {
    flex-shrink: 0;
    width: 32px;
    text-align: right;
    color: var(--text-muted);
    font-size: 11px;
}

.search-match__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-match mark {
    background: rgba(66, 133, 244, 0.3);
    color: var(--text-primary);
    border-radius: 2px;
    padding: 0 1px;
}

/* ═══════════════════════════════════════
   Chat Session Tabs
   ═══════════════════════════════════════ */
.chat__sessions {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
    overflow-x: auto;
    background: var(--bg-elevated);
}

.chat__sessions::-webkit-scrollbar { height: 0; }

.chat__session-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    height: 32px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}

.chat__session-tab:hover { color: var(--text-secondary); background: var(--bg-hover); }

.chat__session-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    background: var(--bg-surface);
}

.chat__session-tab .close-btn {
    display: none;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 14px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
}

.chat__session-tab:hover .close-btn { display: inline-block; }
.chat__session-tab .close-btn:hover { background: var(--bg-active); color: var(--text-primary); }

.chat__new-session {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 2px 4px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition);
}

.chat__new-session:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* ═══════════════════════════════════════
   Chat Code Blocks + Apply Edits
   ═══════════════════════════════════════ */
.chat__code-block {
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0d0d0f;
}

.chat__code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 4px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.chat__code-lang {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.chat__code-actions {
    display: flex;
    gap: 4px;
}

.chat__code-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition);
}

.chat__code-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--text-muted);
}

.chat__code-btn--copy:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.chat__code-btn--insert:hover {
    color: #facc15;
    border-color: #facc15;
}

.chat__code-btn--replace:hover {
    color: var(--success);
    border-color: var(--success);
}

.chat__code-btn--replace {
    background: rgba(74, 222, 128, 0.08);
}

.chat__code-btn--success {
    border-color: var(--success) !important;
    color: var(--success) !important;
    background: rgba(74, 222, 128, 0.15) !important;
}

.chat__code-pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.chat__code-pre code {
    white-space: pre;
}

.chat__inline-code {
    background: var(--bg-elevated);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: #60a5fa;
    border: 1px solid var(--border);
}

.chat__msg-content ul {
    padding-left: 16px;
    margin: 4px 0;
}

.chat__msg-content li {
    margin: 2px 0;
}

.chat__msg-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Streaming pulse */
.chat__msg-streaming::after {
    content: '▊';
    animation: blink 0.8s infinite;
    color: var(--accent);
    margin-left: 2px;
}

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

/* Toast notification */
.chat__toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   MCP Tool Call Cards
   ══════════════════════════════════════════════════════════ */

.tc__card {
    margin: 6px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    overflow: hidden;
    max-height: 600px;
    transition:
        border-color 0.3s ease,
        opacity 0.18s ease,
        max-height 0.18s ease,
        margin 0.18s ease,
        border-width 0.18s ease;
}

.tc__card--dismissed {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    border-width: 0;
    pointer-events: none;
}

.tc__card--running { border-left: 3px solid var(--accent); }
.tc__card--success { border-left: 3px solid var(--success); }
.tc__card--error   { border-left: 3px solid var(--error); }

.tc__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.tc__header:hover { background: var(--bg-hover); }

.tc__status {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tc__icon {
    font-size: 14px;
    display: none;
}
.tc__card--success .tc__icon,
.tc__card--error .tc__icon { display: inline; }
.tc__card--success .tc__icon::after { content: '✅'; }
.tc__card--error .tc__icon::after { content: '❌'; }
.tc__card--success .tc__icon,
.tc__card--error .tc__icon { font-size: 0; }

.tc__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: tcSpin 0.8s linear infinite;
}
.tc__card--success .tc__spinner,
.tc__card--error .tc__spinner { display: none; }

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

.tc__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tc__name {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc__label {
    font-size: 11px;
    color: var(--text-muted);
}
.tc__card--success .tc__label { color: var(--success); }
.tc__card--error .tc__label { color: var(--error); }

.tc__chevron {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.tc__card--expanded .tc__chevron { transform: rotate(90deg); }

.tc__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    border-top: 0 solid transparent;
}
.tc__card--expanded .tc__body {
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

.tc__section {
    padding: 8px 12px;
}

.tc__section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.tc__args {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tc__arg-key {
    color: var(--accent);
}
.tc__arg-val {
    color: var(--text-secondary);
}

.tc__result-section {
    border-top: 1px solid var(--border);
    padding: 8px 12px;
}

.tc__result-pre {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-base);
    border-radius: 4px;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   Diff Viewer Modal
   ══════════════════════════════════════════════════════════ */

.diff-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.diff-overlay--visible { opacity: 1; }

.diff-modal {
    width: 92vw;
    height: 85vh;
    max-width: 1600px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.diff-overlay--visible .diff-modal { transform: scale(1); }

.diff-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.diff-modal__title {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.diff-modal__actions {
    display: flex;
    gap: 8px;
}

.diff-modal__btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.diff-modal__btn--cancel {
    background: transparent;
    color: var(--text-secondary);
}
.diff-modal__btn--cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.diff-modal__btn--accept {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.diff-modal__btn--accept:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

.diff-modal__editor {
    flex: 1;
    min-height: 0;
}

.diff-modal__footer {
    display: flex;
    justify-content: space-between;
    padding: 6px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.diff-modal__info {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ════════════════════════════════════════
   Terminal Panel
   ════════════════════════════════════════ */
.terminal-panel {
    border-top: 1px solid var(--border);
    z-index: 10;
}
.terminal-header {
    background: var(--bg-surface);
    height: 24px;
    user-select: none;
}
.terminal-header button:hover {
    color: var(--text-primary);
}
.xterm .xterm-viewport {
    background-color: var(--bg-dark) !important;
}

/* ════════════════════════════════════════
   Git Panel (Source Control, VSCode-like)
   ════════════════════════════════════════ */
#panel-git {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#panel-git[hidden] { display: none; }

.scm-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 4px 12px;
    height: 30px;
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}
.scm-actions__title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}
.scm-actions__buttons {
    display: flex;
    align-items: center;
    gap: 2px;
}
.scm-icon-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.scm-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.scm-icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
    background: transparent;
}
.scm-icon-btn svg { display: block; }

.scm-commit {
    padding: 8px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.scm-commit__input {
    width: 100%;
    min-height: 26px;
    max-height: 200px;
    padding: 6px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.35;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition);
}
.scm-commit__input:focus { border-color: var(--accent); }
.scm-commit__btn {
    width: 100%;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}
.scm-commit__btn:hover { background: var(--accent-hover); }
.scm-commit__btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.scm-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0 8px;
}
.scm-list__empty,
.scm-list__error {
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.scm-list__error { color: var(--error); }
.scm-list__no-repo {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.scm-list__no-repo-msg {
    color: var(--text-muted);
    font-size: 12px;
}

.scm-section {
    display: flex;
    flex-direction: column;
}
.scm-section__header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.scm-section__header:hover { color: var(--text-primary); }
.scm-section__chevron {
    width: 12px;
    font-size: 10px;
    transition: transform var(--transition);
}
.scm-section.collapsed .scm-section__chevron { transform: rotate(-90deg); }
.scm-section.collapsed .scm-section__items { display: none; }
.scm-section__title { flex: 1; }
.scm-section__badge {
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-active);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.scm-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px 2px 26px;
    height: 22px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    position: relative;
}
.scm-file:hover { background: var(--bg-hover); }
.scm-file__icon {
    width: 14px;
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    opacity: 0.85;
}
.scm-file__name {
    flex-shrink: 0;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scm-file__path {
    flex: 1;
    min-width: 0;
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scm-file__actions {
    display: none;
    align-items: center;
    gap: 1px;
    margin-left: auto;
}
.scm-file:hover .scm-file__actions { display: inline-flex; }
.scm-file:hover .scm-file__status { display: none; }
.scm-file__action-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
}
.scm-file__action-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}
.scm-file__status {
    flex-shrink: 0;
    min-width: 14px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
    color: var(--text-secondary);
}
.scm-file__status.added,
.scm-file__status.untracked { color: var(--success); }
.scm-file__status.modified { color: var(--warning); }
.scm-file__status.deleted { color: var(--error); }
.scm-file__status.renamed { color: var(--text-link); }
.scm-file__status.conflict { color: var(--error); }

.scm-file.deleted .scm-file__name { text-decoration: line-through; opacity: 0.8; }

/* ── Syncer: Server Folders ─────────────────────────── */
.sync-folders {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}
.sync-folders__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}
.sync-folders__title { font-weight: 600; }
.sync-folders__actions { display: flex; gap: 4px; }
.sync-folders__btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 24px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}
.sync-folders__btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sync-folders__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sync-folders__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}
.sync-folders__empty {
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 6px;
    text-align: center;
    font-style: italic;
}
.sync-folder {
    background: var(--bg-secondary, rgba(255,255,255,0.02));
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sync-folder__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.sync-folder__name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.sync-folder__status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: none;
    white-space: nowrap;
    font-weight: 500;
}
.sync-folder__status--synced { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.sync-folder__status--syncing {
    background: rgba(59, 130, 246, 0.18);
    color: #3b82f6;
    animation: sync-pulse 1.6s ease-in-out infinite;
}
.sync-folder__status--outofsync { background: rgba(234, 179, 8, 0.18); color: #eab308; }
.sync-folder__status--notattached { background: rgba(148, 163, 184, 0.18); color: var(--text-muted); }
@keyframes sync-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
.sync-folder__meta {
    font-size: 10px;
    color: var(--text-muted);
}
.sync-folder__path {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}
.sync-folder__actions-row {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.sync-folder__action {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
}
.sync-folder__action:hover { background: var(--bg-hover); color: var(--text-primary); }
.sync-folder__action--attach { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.sync-folder__action--attach:hover { background: #2563eb; }
.sync-folder__action--detach:hover { color: var(--error, #f43f5e); border-color: var(--error, #f43f5e); }
.sync-folder__action:disabled { opacity: 0.5; cursor: not-allowed; }

/* ════════════════════════════════════════
   UI Dialogs (alert / confirm / prompt)
   ════════════════════════════════════════ */
.ui-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-dialog__overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.66);
    backdrop-filter: blur(2px);
    animation: uiDialogFade 140ms ease-out;
}

.ui-dialog__panel {
    position: relative;
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: uiDialogIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes uiDialogFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes uiDialogIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.ui-dialog__header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-muted);
}

.ui-dialog__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.1px;
}

.ui-dialog__body {
    padding: 18px 20px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.55;
}

.ui-dialog__message {
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.ui-dialog__message--success { color: var(--success); }
.ui-dialog__message--warning { color: var(--warning); }
.ui-dialog__message--error   { color: var(--error); }

.ui-dialog__input {
    width: 100%;
    margin-top: 14px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ui-dialog__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.ui-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-muted);
    background: rgba(0, 0, 0, 0.15);
}

.ui-dialog__btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.ui-dialog__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.ui-dialog__btn--primary {
    background: var(--accent);
    color: #fff;
}
.ui-dialog__btn--primary:hover { background: var(--accent-hover); }

.ui-dialog__btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.ui-dialog__btn--ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ui-dialog__btn--danger {
    background: var(--error);
    color: #fff;
}
.ui-dialog__btn--danger:hover { background: #ef4444; }
