/* ============================================
   Life OS — CSS · Light/Dark Theme
   Clean, minimal · Indigo accent
   ============================================ */

/* ── Theme Variables (RGB triplets for Tailwind alpha) ── */
:root {
    --c-bg: 248 250 252;
    --c-surface: 255 255 255;
    --c-surface2: 241 245 249;
    --c-text: 15 23 42;
    --c-text-dim: 100 116 139;
    --c-accent: 99 102 241;
    --c-secondary: 20 184 166;
    --c-warning: 245 158 11;
    --c-error: 239 68 68;
    --c-border: 226 232 240;
    --c-success: 16 185 129;
    --c-code-bg: 241 245 249;
    --c-shadow: 0 0 0;
    --c-input-bg: 255 255 255;
}

html.dark {
    --c-bg: 15 23 42;
    --c-surface: 30 41 59;
    --c-surface2: 51 65 85;
    --c-text: 248 250 252;
    --c-text-dim: 148 163 184;
    --c-accent: 129 140 248;
    --c-secondary: 45 212 191;
    --c-warning: 251 191 36;
    --c-error: 248 113 113;
    --c-border: 51 65 85;
    --c-success: 52 211 153;
    --c-code-bg: 15 23 42;
    --c-shadow: 0 0 0;
    --c-input-bg: 30 41 59;
}

/* ── Material Symbols ────────────────────── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* ── Animations ──────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-fade-in { animation: fadeIn 0.2s ease-out; }

/* ── Navigation ──────────────────────────── */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--c-text-dim));
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-link:hover {
    color: rgb(var(--c-text));
    background: rgb(var(--c-accent) / 0.06);
}

.nav-link.active {
    color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.1);
    font-weight: 600;
}

.nav-icon { font-size: 1.125rem; }

/* ── Cards ───────────────────────────────── */
.los-card {
    position: relative;
    display: block;
    background: rgb(var(--c-surface));
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid rgb(var(--c-border) / 0.5);
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.los-card:hover {
    transform: translateY(-2px);
    border-color: rgb(var(--c-accent) / 0.3);
    box-shadow: 0 8px 24px -8px rgb(var(--c-shadow) / 0.08);
}

.los-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    background: rgb(var(--c-accent) / 0.1);
}

.los-card-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}

/* ── Tabs ────────────────────────────────── */
.los-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgb(var(--c-surface));
    padding: 0.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--c-border) / 0.5);
}

.los-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Syne', sans-serif;
    color: rgb(var(--c-text-dim));
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.los-tab:hover {
    color: rgb(var(--c-text));
    background: rgb(var(--c-accent) / 0.05);
}

.los-tab.active {
    color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.1);
}

.los-tab-panel { display: none; animation: fadeIn 0.2s ease-out; }
.los-tab-panel.active { display: block; }

/* ── Task Cards ──────────────────────────── */
.los-task-card {
    position: relative;
    background: rgb(var(--c-surface));
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--c-border) / 0.5);
    transition: all 0.15s ease;
    overflow: hidden;
}

.los-task-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: transparent;
}

.los-task-card[data-category="code_ai"]::before {
    background: rgb(var(--c-accent) / 0.55);
}

.los-task-card[data-category="real_world"]::before {
    background: rgb(var(--c-text-dim) / 0.35);
}

.los-task-card:hover {
    border-color: rgb(var(--c-border));
}

.los-task-card.done { opacity: 0.5; }
.los-task-card.done:hover { opacity: 0.7; }

.task-row { user-select: none; }
.task-row:hover { background: rgb(var(--c-accent) / 0.03); }

/* Priority dots */
.prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio-dot.prio-critical { background: rgb(var(--c-error)); }
.prio-dot.prio-high { background: #f97316; }
.prio-dot.prio-medium { background: rgb(var(--c-warning)); }
.prio-dot.prio-low { background: rgb(var(--c-text-dim) / 0.4); }

/* Priority badges */
.los-badge-prio {
    display: inline-flex;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-family: 'DM Mono', monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.los-badge-prio-critical { background: rgb(var(--c-error) / 0.1); color: rgb(var(--c-error)); }
.los-badge-prio-high { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.los-badge-prio-medium { background: rgb(var(--c-warning) / 0.1); color: rgb(var(--c-warning)); }
.los-badge-prio-low { background: rgb(var(--c-text-dim) / 0.1); color: rgb(var(--c-text-dim)); }

.task-detail { animation: slideDown 0.2s ease-out; }
.task-chevron { transition: transform 0.2s ease; }
.los-task-card.expanded .task-chevron { transform: rotate(180deg); }

.task-exec-result { animation: slideDown 0.25s ease-out; }

/* Priority filter buttons */
.prio-filter {
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
}
.prio-filter:hover { background: rgb(var(--c-accent) / 0.05); }
.prio-filter.active {
    background: rgb(var(--c-accent) / 0.1);
    border-color: rgb(var(--c-accent) / 0.3);
    color: rgb(var(--c-accent));
}

.task-category-filter,
.perso-category-filter {
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
}

.task-category-filter:hover,
.perso-category-filter:hover {
    background: rgb(var(--c-accent) / 0.04);
}

.task-category-filter.active[data-filter="all"],
.perso-category-filter.active[data-filter="all"] {
    background: rgb(var(--c-accent) / 0.1);
    border-color: rgb(var(--c-accent) / 0.3);
    color: rgb(var(--c-accent));
}

.task-category-filter.active[data-filter="code_ai"],
.perso-category-filter.active[data-filter="code_ai"] {
    background: rgb(var(--c-accent) / 0.1);
    border-color: rgb(var(--c-accent) / 0.3);
    color: rgb(var(--c-accent));
}

.task-category-filter.active[data-filter="real_world"],
.perso-category-filter.active[data-filter="real_world"] {
    background: rgb(var(--c-surface2) / 0.8);
    border-color: rgb(var(--c-border));
    color: rgb(var(--c-text));
}

.task-category-chip {
    border-color: rgb(var(--c-border) / 0.6);
    background: rgb(var(--c-surface2) / 0.45);
}

.los-task-card[data-category="code_ai"] .task-category-chip,
.perso-task-row[data-category="code_ai"] .task-category-chip {
    border-color: rgb(var(--c-accent) / 0.16);
    background: rgb(var(--c-accent) / 0.05);
    color: rgb(var(--c-accent));
}

.los-task-card[data-category="real_world"] .task-category-chip,
.perso-task-row[data-category="real_world"] .task-category-chip {
    border-color: rgb(var(--c-border) / 0.75);
    background: transparent;
    color: rgb(var(--c-text-dim));
}

.task-execute.loading { pointer-events: none; opacity: 0.6; }
.task-execute.loading .material-symbols-outlined { animation: spin 1s linear infinite; }

/* ── Status Badges ───────────────────────── */
.los-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    text-transform: uppercase;
}

.los-badge-pending { background: rgb(var(--c-accent) / 0.1); color: rgb(var(--c-accent)); }
.los-badge-in_progress { background: rgb(var(--c-secondary) / 0.1); color: rgb(var(--c-secondary)); }
.los-badge-done { background: rgb(var(--c-success) / 0.1); color: rgb(var(--c-success)); }
.los-badge-cancelled { background: rgb(var(--c-text-dim) / 0.1); color: rgb(var(--c-text-dim)); }

/* ── Toggle ──────────────────────────────── */
.task-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease;
}
.task-toggle:hover { transform: scale(1.1); }
.task-toggle:active { transform: scale(0.95); }

/* ── Chat Bubbles ────────────────────────── */
.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-bubble-user {
    background: rgb(var(--c-accent) / 0.1);
    color: rgb(var(--c-text));
    border-bottom-right-radius: 0.25rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.8125rem;
}

.chat-bubble-assistant {
    background: rgb(var(--c-surface));
    color: rgb(var(--c-text));
    border: 1px solid rgb(var(--c-border) / 0.5);
    border-bottom-left-radius: 0.25rem;
}

.chat-bubble-error {
    background: rgb(var(--c-error) / 0.1);
    color: rgb(var(--c-error));
    border: 1px solid rgb(var(--c-error) / 0.2);
    border-bottom-left-radius: 0.25rem;
    font-size: 0.8125rem;
}

/* Chat code blocks */
.chat-code {
    background: rgb(var(--c-code-bg));
    border: 1px solid rgb(var(--c-border) / 0.5);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgb(var(--c-secondary));
}

.chat-inline-code {
    background: rgb(var(--c-secondary) / 0.1);
    color: rgb(var(--c-secondary));
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.8em;
}

/* Chat model selector */
.chat-model-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.5rem;
}

/* ── Confirmation Box (Exécuter / Modifier) ── */
.chat-confirmation {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(var(--c-border) / 0.3);
}

.chat-confirm-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.chat-confirm-buttons {
    display: flex;
    gap: 0.5rem;
}

.chat-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Syne', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.chat-confirm-btn.execute {
    background: rgb(var(--c-accent));
    color: white;
}
.chat-confirm-btn.execute:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.chat-confirm-btn.modify {
    background: rgb(var(--c-surface));
    color: rgb(var(--c-text-dim));
    border: 1px solid rgb(var(--c-border));
}
.chat-confirm-btn.modify:hover {
    color: rgb(var(--c-text));
    border-color: rgb(var(--c-text-dim));
}

/* ── Action Blocks (SQL, GitHub, Deploy) ── */
.action-block {
    background: rgb(var(--c-code-bg));
    border: 1px solid rgb(var(--c-border) / 0.5);
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    overflow: hidden;
}

.action-block-header {
    background: rgb(var(--c-accent) / 0.1);
    padding: 0.375rem 0.75rem;
    font-size: 0.7rem;
    font-family: 'DM Mono', monospace;
    font-weight: 600;
    color: rgb(var(--c-accent));
    border-bottom: 1px solid rgb(var(--c-border) / 0.3);
}

.action-block-code {
    padding: 0.75rem;
    margin: 0;
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    line-height: 1.5;
    color: rgb(var(--c-text));
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Execution Results Panel ── */
.exec-results-panel {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(var(--c-success) / 0.3);
}

.exec-result-line {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    line-height: 1.5;
    color: rgb(var(--c-text-dim));
    border-radius: 0.25rem;
}

.exec-result-line + .exec-result-line {
    margin-top: 0.25rem;
}

/* ── Mobile input zoom fix (iOS zooms on focus when font < 16px) ── */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ── Typing indicator ────────────────────── */
.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

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

/* ── Toast ───────────────────────────────── */
.los-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgb(var(--c-surface));
    color: rgb(var(--c-text));
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-family: 'DM Mono', monospace;
    border: 1px solid rgb(var(--c-border));
    box-shadow: 0 8px 32px rgb(var(--c-shadow) / 0.12);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.2s ease-out;
    transition: opacity 0.3s ease;
}

.los-toast.success { border-left: 3px solid rgb(var(--c-success)); }
.los-toast.error { border-left: 3px solid rgb(var(--c-error)); }

/* ── Global action feedback ─────────────── */
.los-action-feedback {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 130;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    font-weight: 600;
    border: 1px solid rgb(var(--c-border));
    background: rgb(var(--c-surface));
    color: rgb(var(--c-text));
    box-shadow: 0 8px 24px rgb(var(--c-shadow) / 0.16);
    transition: all 0.2s ease;
}

.los-action-feedback.hidden {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.los-action-feedback.is-pending {
    border-color: rgb(var(--c-accent) / 0.35);
    color: rgb(var(--c-accent));
}

.los-action-feedback.is-pending .feedback-icon {
    animation: spin 1s linear infinite;
}

.los-action-feedback.is-success {
    border-color: rgb(var(--c-success) / 0.35);
    color: rgb(var(--c-success));
}

.los-action-feedback.is-error {
    border-color: rgb(var(--c-error) / 0.35);
    color: rgb(var(--c-error));
}

/* ── Execution badges ────────────────────── */
.exec-summary {
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-border) / 0.5);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.exec-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
}

.exec-badge.committed {
    background: rgb(var(--c-secondary) / 0.15);
    color: rgb(var(--c-secondary));
    border: 1px solid rgb(var(--c-secondary) / 0.3);
}

.exec-badge.deployed {
    background: rgb(var(--c-accent) / 0.15);
    color: rgb(var(--c-accent));
    border: 1px solid rgb(var(--c-accent) / 0.3);
}

.exec-badge.manual {
    background: rgb(var(--c-warning) / 0.15);
    color: rgb(var(--c-warning));
    border: 1px solid rgb(var(--c-warning) / 0.3);
}

/* ── Chat Page Layout ────────────────────── */
.chat-fullpage {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
    overflow: hidden;
    position: relative;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    max-width: 56rem;
    margin: 0 auto;
    width: 100%;
}

/* ── Chat Image Upload ───────────────────── */
.chat-image-preview-inner {
    position: relative;
    display: inline-block;
}

.chat-image-preview-inner img {
    max-height: 120px;
    max-width: 200px;
    border-radius: 0.5rem;
    border: 2px solid rgb(var(--c-accent) / 0.3);
    object-fit: cover;
}

.chat-image-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgb(var(--c-error));
    color: white;
    border: 2px solid rgb(var(--c-bg));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.chat-image-remove:hover {
    transform: scale(1.15);
    background: rgb(var(--c-error));
}

#chat-upload-btn.has-image {
    border-color: rgb(var(--c-accent) / 0.5);
    color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.08);
}

/* ── Chat Drag Overlay ───────────────────── */
.chat-drag-overlay {
    position: absolute;
    inset: 0;
    background: rgb(var(--c-bg) / 0.85);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px dashed rgb(var(--c-accent) / 0.5);
    border-radius: 1rem;
    margin: 0.5rem;
    pointer-events: none;
}

.chat-drag-overlay.hidden {
    display: none;
}

.chat-drag-content {
    text-align: center;
}

/* ── Chat Bubble Image ───────────────────── */
.chat-bubble-image {
    margin-bottom: 0.5rem;
}

.chat-bubble-image img {
    max-width: 280px;
    max-height: 200px;
    border-radius: 0.5rem;
    object-fit: contain;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.chat-bubble-image img:hover {
    opacity: 0.85;
}

/* ── Voice Recording Button ──────────────── */
@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgb(var(--c-error) / 0.4); }
    70% { box-shadow: 0 0 0 10px rgb(var(--c-error) / 0); }
    100% { box-shadow: 0 0 0 0 rgb(var(--c-error) / 0); }
}

.chat-voice-btn.recording {
    background: rgb(var(--c-error) / 0.15);
    border-color: rgb(var(--c-error) / 0.5);
    color: rgb(var(--c-error));
    animation: voicePulse 1.5s ease-in-out infinite;
}

.chat-voice-btn.recording .material-symbols-outlined {
    color: rgb(var(--c-error));
}

.chat-voice-btn:not(.recording):hover {
    color: rgb(var(--c-accent));
    border-color: rgb(var(--c-accent) / 0.4);
    background: rgb(var(--c-accent) / 0.05);
}

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgb(var(--c-text-dim) / 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--c-text-dim) / 0.3);
}

/* ── Selection ───────────────────────────── */
::selection {
    background: rgb(var(--c-accent) / 0.25);
    color: rgb(var(--c-text));
}

/* ── Focus ───────────────────────────────── */
*:focus-visible {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Global ──────────────────────────────── */
a, button { transition: all 0.15s ease; }

/* ── Execution Recap Panel ───────────────── */
/* ── Execution Panel — Mobile-first ──────── */
.exec-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-accent) / 0.2);
    border-radius: 1rem;
    overflow: hidden;
    margin: 0.75rem 0 0.5rem 0;
}

.exec-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgb(var(--c-border) / 0.3);
    background: rgb(var(--c-accent) / 0.04);
}

/* Loading state */
.exec-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-text-dim));
    font-family: 'Syne', sans-serif;
}
.typing-dots {
    display: flex;
    gap: 3px;
}
.typing-dots span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgb(var(--c-accent));
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* Reasoning steps */
.exec-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
}
.exec-step {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgb(var(--c-text));
    opacity: 0;
    animation: step-appear 0.3s ease forwards;
}
@keyframes step-appear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.exec-step-num {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgb(var(--c-accent) / 0.12);
    color: rgb(var(--c-accent));
    font-size: 0.6875rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    margin-top: 1px;
}
.exec-step-text {
    flex: 1;
}

/* Changes list */
.exec-changes-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--c-text-dim));
    border-top: 1px solid rgb(var(--c-border) / 0.2);
    font-family: 'Syne', sans-serif;
}
.exec-changes-header .material-symbols-outlined {
    font-size: 1rem;
    color: rgb(var(--c-secondary));
}
.exec-changes-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.exec-change-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.5rem 1.25rem;
    font-size: 0.75rem;
}
.exec-change-icon {
    font-size: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}
.exec-change-item.create .exec-change-icon { color: #4CAF50; }
.exec-change-item.modify .exec-change-icon { color: rgb(var(--c-accent)); }
.exec-change-item.delete .exec-change-icon { color: #F44336; }
.exec-change-path {
    font-family: 'DM Mono', monospace;
    font-size: 0.6875rem;
    color: rgb(var(--c-secondary));
    word-break: break-all;
}
.exec-change-desc {
    color: rgb(var(--c-text-dim));
    line-height: 1.4;
    margin-top: 2px;
}

/* Security warnings */
.exec-warning {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #F44336;
    background: rgba(244, 67, 54, 0.06);
    border-top: 1px solid rgba(244, 67, 54, 0.1);
}
.exec-warning .material-symbols-outlined {
    font-size: 1rem;
    color: #F44336;
}

/* Commit message */
.exec-commit {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    font-family: 'DM Mono', monospace;
    color: rgb(var(--c-text-dim));
    border-top: 1px solid rgb(var(--c-border) / 0.2);
}
.exec-commit .material-symbols-outlined {
    font-size: 0.875rem;
    color: rgb(var(--c-text-dim) / 0.5);
}

/* Meta line */
.exec-meta {
    padding: 0.375rem 1rem;
    font-size: 0.625rem;
    font-family: 'DM Mono', monospace;
    color: rgb(var(--c-text-dim) / 0.4);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* TDD badge */
.exec-tdd-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.5625rem;
    font-weight: 600;
}
.exec-tdd-badge.validated {
    background: rgb(var(--c-secondary) / 0.15);
    color: rgb(var(--c-secondary));
}
.exec-tdd-badge.warning {
    background: rgb(var(--c-amber) / 0.15);
    color: rgb(var(--c-amber));
}

/* Error */
.exec-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    font-size: 0.8125rem;
    color: #F44336;
}
.exec-error .material-symbols-outlined {
    color: #F44336;
}

/* No github */
.exec-no-github {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: #FFB300;
    background: rgba(255, 179, 0, 0.06);
}

/* ── Big action buttons (mobile-first) ──── */
.exec-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgb(var(--c-border) / 0.2);
}
.exec-btn-go {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: 'Syne', sans-serif;
    cursor: pointer;
    border: none;
    background: rgb(var(--c-accent));
    color: #fff;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.exec-btn-go:hover { opacity: 0.9; }
.exec-btn-go:active { transform: scale(0.98); }
.exec-btn-go .material-symbols-outlined { font-size: 1.125rem; }

.exec-btn-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Syne', sans-serif;
    cursor: pointer;
    background: transparent;
    color: rgb(var(--c-text-dim));
    border: 1px solid rgb(var(--c-border) / 0.5);
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.exec-btn-cancel:hover {
    color: #F44336;
    border-color: rgba(244, 67, 54, 0.4);
}

.exec-btn-rollback {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    cursor: pointer;
    background: rgba(255, 179, 0, 0.1);
    color: #FFB300;
    border: 1px solid rgba(255, 179, 0, 0.3);
    transition: all 0.15s ease;
    margin-left: 0.5rem;
}
.exec-btn-rollback:hover {
    background: rgba(255, 179, 0, 0.2);
}

/* Spin animation for loading icon */
.spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Diff Viewer ─────────────────────────── */
.exec-diffs-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--c-text-dim));
    border-top: 1px solid rgb(var(--c-border) / 0.2);
    font-family: 'Syne', sans-serif;
}
.exec-diffs-header .material-symbols-outlined {
    font-size: 1rem;
    color: rgb(var(--c-accent));
}
.exec-diff-file {
    border-top: 1px solid rgb(var(--c-border) / 0.15);
}
.exec-diff-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: rgb(var(--c-text));
    text-align: left;
    transition: background 0.15s ease;
}
.exec-diff-toggle:hover {
    background: rgb(var(--c-accent) / 0.04);
}
.exec-diff-chevron {
    transition: transform 0.2s ease;
    color: rgb(var(--c-text-dim) / 0.5);
    flex-shrink: 0;
}
.exec-diff-file.open .exec-diff-chevron {
    transform: rotate(90deg);
}
.exec-diff-path {
    font-family: 'DM Mono', monospace;
    font-size: 0.6875rem;
    color: rgb(var(--c-secondary));
    flex: 1;
    word-break: break-all;
}
.exec-diff-badge {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'DM Mono', monospace;
    flex-shrink: 0;
}
.exec-diff-badge.new {
    background: rgba(76, 175, 80, 0.12);
    color: #4CAF50;
}
.exec-diff-badge.modified {
    background: rgb(var(--c-accent) / 0.12);
    color: rgb(var(--c-accent));
}
.exec-diff-content {
    display: none;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid rgb(var(--c-border) / 0.1);
}
.exec-diff-file.open .exec-diff-content {
    display: block;
}
.diff-view {
    font-family: 'DM Mono', monospace;
    font-size: 0.6875rem;
    line-height: 1.6;
}
.diff-line {
    display: flex;
    padding: 0 0.75rem;
    min-height: 1.4em;
    white-space: pre;
}
.diff-sign {
    width: 1rem;
    flex-shrink: 0;
    text-align: center;
    user-select: none;
    font-weight: 600;
}
.diff-num {
    width: 2.5rem;
    flex-shrink: 0;
    text-align: right;
    padding-right: 0.5rem;
    color: rgb(var(--c-text-dim) / 0.35);
    user-select: none;
}
.diff-code {
    flex: 1;
    min-width: 0;
}
.diff-added {
    background: rgba(76, 175, 80, 0.08);
    color: #66BB6A;
}
.diff-added .diff-sign { color: #4CAF50; }
.diff-removed {
    background: rgba(244, 67, 54, 0.08);
    color: #EF5350;
}
.diff-removed .diff-sign { color: #F44336; }
.diff-context {
    color: rgb(var(--c-text-dim) / 0.6);
}
.diff-sep {
    color: rgb(var(--c-text-dim) / 0.25);
    padding: 0.125rem 0.75rem;
    font-style: italic;
}
.diff-info {
    padding: 0.75rem 1rem;
    color: rgb(var(--c-text-dim) / 0.5);
    font-style: italic;
}

/* Light theme diff adjustments */
:root .diff-added { background: rgba(76, 175, 80, 0.06); color: #2E7D32; }
:root .diff-removed { background: rgba(244, 67, 54, 0.06); color: #C62828; }
html.dark .diff-added { background: rgba(76, 175, 80, 0.08); color: #66BB6A; }
html.dark .diff-removed { background: rgba(244, 67, 54, 0.08); color: #EF5350; }

/* ── Login page ──────────────────────────── */
.login-page {
    background: rgb(var(--c-bg));
}

/* ── Theme transition ────────────────────── */
html.transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ============================================
   NEW FEATURES — v13
   ============================================ */

/* ── Chat Mode Buttons ───────────────────── */
.chat-mode-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--c-border) / 0.5);
    color: rgb(var(--c-text-dim));
    transition: all 0.15s ease;
    cursor: pointer;
    background: transparent;
}
.chat-mode-btn:hover {
    border-color: rgb(var(--c-accent) / 0.4);
    background: rgb(var(--c-accent) / 0.05);
    color: rgb(var(--c-accent));
}
.chat-mode-btn.active {
    border-color: rgb(var(--c-accent) / 0.5);
    background: rgb(var(--c-accent) / 0.12);
    color: rgb(var(--c-accent));
}

/* ── Streaming cursor ────────────────────── */
.streaming-cursor::after {
    content: '▊';
    color: rgb(var(--c-accent));
    animation: blink 0.7s infinite;
    font-weight: 100;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Token/Cost display ──────────────────── */
.msg-meta {
    font-size: 0.6rem;
    font-family: 'DM Mono', monospace;
    color: rgb(var(--c-text-dim) / 0.4);
    margin-top: 0.25rem;
}
.msg-meta .cost {
    color: rgb(var(--c-warning) / 0.6);
}

/* ── Document Vault ──────────────────────── */
.doc-dropzone {
    transition: all 0.2s ease;
}
.doc-dropzone.drag-over {
    border-color: rgb(var(--c-accent)) !important;
    background: rgb(var(--c-accent) / 0.08) !important;
    transform: scale(1.01);
}

/* ── Creative Cards ──────────────────────── */
.creative-card {
    transition: all 0.2s ease;
}
.creative-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgb(var(--c-shadow) / 0.1);
}
.line-clamp-2 {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Knowledge Cards ─────────────────────── */
.knowledge-card {
    transition: all 0.2s ease;
}
.knowledge-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgb(var(--c-shadow) / 0.08);
}

/* ── Slash command menu ──────────────────── */
#chat-slash-menu .slash-cmd:hover {
    background: rgb(var(--c-accent) / 0.1);
    color: rgb(var(--c-accent));
}

/* ── Artifacts panel ─────────────────────── */
.artifacts-panel {
    position: fixed;
    right: 0;
    top: 4rem;
    bottom: 0;
    width: 50%;
    max-width: 600px;
    background: rgb(var(--c-surface));
    border-left: 1px solid rgb(var(--c-border) / 0.5);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 40;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.artifacts-panel.open {
    transform: translateX(0);
}
.artifacts-panel .artifact-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgb(var(--c-border) / 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.artifacts-panel .artifact-content {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}
.artifacts-panel .artifact-content pre {
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Action Timeline ─────────────────────── */
.action-log-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgb(var(--c-border) / 0.2);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.action-log-item:last-child {
    border-bottom: none;
}
.action-log-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Modal backdrop ──────────────────────── */
.fixed.inset-0 {
    animation: fadeIn 0.15s ease;
}

