/* ============================================
   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: 1rem;
    line-height: 1.72;
    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.9375rem;
}

.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;
}

.nesty-top-action-btn {
    display: none;
}

/* 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%;
}

body.chat-shell-open {
    overflow: hidden;
}

body.nesty-page {
    background:
        radial-gradient(circle at top left, rgb(var(--c-accent) / 0.14), transparent 30%),
        radial-gradient(circle at top right, rgb(var(--c-secondary) / 0.12), transparent 22%),
        linear-gradient(180deg, rgb(var(--c-bg)) 0%, rgb(var(--c-surface2) / 0.55) 100%);
}

.nesty-shell {
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
}

.nesty-shell::before,
.nesty-shell::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    filter: blur(64px);
    opacity: 0.3;
    pointer-events: none;
}

.nesty-shell::before {
    width: 16rem;
    height: 16rem;
    background: rgb(var(--c-accent) / 0.2);
    top: -4rem;
    left: -3rem;
}

.nesty-shell::after {
    width: 12rem;
    height: 12rem;
    background: rgb(var(--c-secondary) / 0.16);
    top: 8rem;
    right: -3rem;
}

body.nesty-page .chat-fullpage {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    height: 100dvh;
    max-width: 76rem;
    margin: 0 auto;
    padding-top: env(safe-area-inset-top);
    background: transparent;
}

body.nesty-page .chat-messages-area {
    max-width: 54rem;
    padding: 0.35rem 1rem 6rem;
}

.nesty-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.7rem 1rem 0.55rem;
    background: linear-gradient(180deg, rgb(var(--c-bg) / 0.96) 0%, rgb(var(--c-bg) / 0.84) 70%, transparent 100%);
    backdrop-filter: blur(16px);
    overflow: visible;
}

.nesty-topbar-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.nesty-title-wrap {
    flex: 1;
    min-width: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
}

.nesty-title-menu {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.45rem;
    border-radius: 9999px;
    background: transparent;
    border: 1px solid transparent;
}

.nesty-title-menu:hover {
    background: rgb(var(--c-surface) / 0.66);
    border-color: rgb(var(--c-border) / 0.55);
}

.nesty-title-menu.is-open {
    background: rgb(var(--c-surface) / 0.82);
    border-color: rgb(var(--c-accent) / 0.28);
}

.nesty-title-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.nesty-title-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    max-width: min(100%, 30rem);
    min-width: 0;
    color: rgb(var(--c-text-dim) / 0.88);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
}

.nesty-title-status,
.nesty-title-project {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nesty-title-status {
    color: rgb(var(--c-text) / 0.92);
}

.nesty-title-project {
    color: rgb(var(--c-text-dim) / 0.9);
}

.nesty-title-divider {
    width: 0.24rem;
    height: 0.24rem;
    border-radius: 9999px;
    background: rgb(var(--c-accent) / 0.45);
    flex-shrink: 0;
}

.nesty-brand {
    font-size: 1.34rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: rgb(var(--c-text));
}

.nesty-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.34rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid rgb(var(--c-border) / 0.58);
    background: rgb(var(--c-surface) / 0.9);
}

.nesty-model-chip-label {
    font-size: 0.76rem;
    line-height: 1;
    color: rgb(var(--c-text-dim));
}

.nesty-title-caret {
    font-size: 0.95rem;
    color: rgb(var(--c-text-dim) / 0.72);
}

.nesty-quick-backdrop {
    position: fixed;
    inset: 0;
    z-index: 78;
    background: rgb(var(--c-bg) / 0.44);
    backdrop-filter: blur(8px);
}

.nesty-quick-backdrop.hidden,
.nesty-quick-backdrop[hidden] {
    display: none !important;
}

.nesty-quick-panel {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 4.6rem);
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100% - 2rem), 54rem);
    padding: 0.85rem;
    border-radius: 1.4rem;
    border: 1px solid rgb(var(--c-border) / 0.6);
    background: linear-gradient(180deg, rgb(var(--c-surface) / 0.96) 0%, rgb(var(--c-surface2) / 0.92) 100%);
    box-shadow: 0 18px 42px rgb(var(--c-shadow) / 0.12);
    z-index: 79;
    max-height: min(75vh, 42rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nesty-quick-panel.hidden,
.nesty-quick-panel[hidden] {
    display: none !important;
}

body.chat-quick-open {
    overflow: hidden;
}

.nesty-title {
    font-size: 1.22rem;
    font-weight: 700;
    color: rgb(var(--c-text));
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.nesty-controls-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0;
}

.nesty-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nesty-quick-context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.nesty-select-label,
.nesty-panel-label,
.nesty-panel-eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(var(--c-text-dim) / 0.65);
    font-family: 'DM Mono', monospace;
}

.nesty-panel-note {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(var(--c-text-dim) / 0.52);
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
}

.nesty-context-note {
    margin-top: 0.1rem;
    font-size: 0.66rem;
    line-height: 1.5;
    color: rgb(var(--c-text-dim) / 0.78);
    font-family: 'DM Mono', monospace;
}

.nesty-select {
    width: 100%;
    min-height: 3.25rem;
    background-color: rgb(var(--c-surface));
    box-shadow: 0 10px 30px rgb(var(--c-shadow) / 0.08);
}

.nesty-select-group-model-only .nesty-select-label {
    display: none;
}

.nesty-route-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.65rem;
}

.nesty-route-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
    min-height: 4rem;
    padding: 0.8rem 0.95rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.58);
    background: rgb(var(--c-bg) / 0.34);
    color: rgb(var(--c-text));
    text-align: left;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nesty-route-btn:hover {
    border-color: rgb(var(--c-accent) / 0.34);
    transform: translateY(-1px);
}

.nesty-route-btn.is-active {
    border-color: rgb(var(--c-accent) / 0.42);
    background: linear-gradient(180deg, rgb(var(--c-accent) / 0.16) 0%, rgb(var(--c-bg) / 0.32) 100%);
    box-shadow: 0 14px 28px rgb(var(--c-shadow) / 0.12);
}

.nesty-route-btn-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nesty-route-btn-meta {
    font-size: 0.72rem;
    color: rgb(var(--c-text-dim) / 0.82);
}

.nesty-inline-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

.nesty-session-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border-radius: 9999px;
    color: rgb(var(--c-text-dim) / 0.75);
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-border) / 0.6);
}

.nesty-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.65);
    background: rgb(var(--c-surface));
    color: rgb(var(--c-text-dim));
    box-shadow: 0 10px 30px rgb(var(--c-shadow) / 0.08);
}

.nesty-icon-btn:hover {
    color: rgb(var(--c-accent));
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-surface2));
}

.nesty-hub-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-border) / 0.65);
    color: rgb(var(--c-text));
    font-size: 0.78rem;
    font-family: 'DM Mono', monospace;
    box-shadow: 0 10px 30px rgb(var(--c-shadow) / 0.08);
}

.nesty-hub-btn-label {
    display: inline-flex;
    align-items: center;
}

.nesty-hub-btn:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    color: rgb(var(--c-accent));
}

@media (max-width: 767px) {
    body.nesty-page .chat-fullpage {
        max-width: 100%;
    }

    body.nesty-page .chat-messages-area {
        padding: 0.15rem 1rem 7.6rem;
    }

    .nesty-shell::before,
    .nesty-shell::after {
        opacity: 0.12;
    }

    .nesty-topbar {
        padding: 0.45rem 0.9rem 0.3rem;
    }

    .nesty-topbar-main {
        gap: 0.35rem;
    }

    .nesty-title-menu {
        padding: 0.15rem 0.35rem;
    }

    .nesty-title-meta {
        max-width: min(100%, 12.5rem);
        gap: 0.35rem;
    }

    .nesty-title {
        font-size: 1.05rem;
    }

    .nesty-brand {
        font-size: 1.18rem;
    }

    .nesty-model-chip {
        padding: 0.28rem 0.55rem;
    }

    .nesty-model-chip-label {
        font-size: 0.72rem;
    }

    .nesty-top-action-btn {
        display: inline-flex;
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 9999px;
    }

    .nesty-hub-btn {
        display: inline-flex;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        border-radius: 9999px;
    }

    .nesty-hub-btn-label {
        display: none;
    }

    .nesty-quick-panel {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: calc(env(safe-area-inset-top) + 4.15rem);
        bottom: calc(env(safe-area-inset-bottom) + 0.55rem);
        width: auto;
        padding: 0.7rem;
        border-radius: 1.35rem;
        transform: none;
        margin-top: 0;
        z-index: 79;
        max-height: none;
        padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 22px 54px rgb(var(--c-shadow) / 0.2);
    }

    .nesty-select-group-model-only {
        gap: 0.35rem;
    }

    .nesty-select-group-model-only .nesty-select {
        min-height: 2.95rem;
        font-size: 1rem;
        border-radius: 1rem;
    }

    .nesty-welcome {
        padding: 1.25rem 0 4.8rem;
    }

    .nesty-welcome-card {
        padding: 0.3rem 0.2rem 0;
    }

    .nesty-welcome-mark {
        width: auto;
        height: auto;
        margin-bottom: 0.55rem;
        background: transparent;
    }

    .nesty-welcome-title {
        max-width: 18rem;
        font-size: clamp(2rem, 8vw, 2.7rem);
    }

    .nesty-welcome-copy {
        display: block;
        max-width: 18rem;
        font-size: 1rem;
    }

    .nesty-welcome-pills {
        display: none;
    }

    .nesty-composer-wrap {
        padding: 0.35rem 0.9rem calc(0.75rem + env(safe-area-inset-bottom));
    }

    .nesty-chat-form {
        gap: 0.35rem;
        padding: 0.58rem 0.7rem;
        border-radius: 1.85rem;
    }

    .nesty-chat-form .nesty-icon-btn {
        width: 2.4rem;
        height: 2.4rem;
        border: none;
        background: transparent;
        box-shadow: none;
        border-radius: 9999px;
    }

    .nesty-chat-form .nesty-icon-btn:hover {
        background: transparent;
        border-color: transparent;
        color: rgb(var(--c-text));
    }

    .nesty-input {
        min-height: 3.25rem;
        font-size: 1.125rem;
        padding: 0.82rem 0.1rem;
    }

    .nesty-send-btn {
        background: rgb(var(--c-text));
        color: rgb(var(--c-bg));
        box-shadow: none;
    }

    .chat-bubble {
        max-width: 100%;
        padding: 0;
    }

    .chat-bubble-user {
        max-width: min(88%, 24rem);
        padding: 0.82rem 0.98rem;
        background: rgb(var(--c-surface));
        border: 1px solid rgb(var(--c-border) / 0.45);
        border-radius: 1.4rem 1.4rem 0.45rem 1.4rem;
        font-size: 1rem;
    }

    .chat-bubble-assistant {
        max-width: 100%;
        padding: 0.15rem 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .nesty-composer-note {
        display: none;
    }
}

.nesty-welcome {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0 4.25rem;
}

.nesty-welcome-card {
    width: min(100%, 40rem);
    padding: 0.75rem 1rem 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nesty-welcome-mark {
    width: 3.4rem;
    height: 3.4rem;
    margin: 0 auto 1rem;
    border-radius: 9999px;
    background: rgb(var(--c-accent) / 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nesty-welcome-kicker {
    display: inline-flex;
    align-items: center;
    color: rgb(var(--c-text-dim) / 0.62);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.68rem;
    margin-bottom: 0.75rem;
}

.nesty-welcome-title {
    max-width: 30rem;
    font-size: clamp(2rem, 6vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.nesty-welcome-copy {
    max-width: 30rem;
    margin: 0.9rem auto 0;
    line-height: 1.65;
    font-size: 0.95rem;
}

.nesty-welcome-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.35rem;
}

.nesty-prompt-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.72rem 0.95rem;
    border-radius: 9999px;
    border: 1px solid rgb(var(--c-border) / 0.7);
    background: rgb(var(--c-surface) / 0.55);
    color: rgb(var(--c-text-dim));
    font-size: 0.78rem;
    font-family: 'DM Mono', monospace;
}

.nesty-prompt-pill:hover {
    color: rgb(var(--c-text));
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.06);
}

.nesty-composer-wrap {
    position: sticky;
    bottom: 0;
    z-index: 15;
    padding: 0.4rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0%, rgb(var(--c-bg) / 0.75) 18%, rgb(var(--c-bg) / 0.96) 48%, rgb(var(--c-bg)) 100%);
    backdrop-filter: blur(18px);
}

.nesty-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.62rem;
    border-radius: 1.9rem;
    border: 1px solid rgb(var(--c-border) / 0.7);
    background: rgb(var(--c-surface));
    box-shadow: 0 18px 46px rgb(var(--c-shadow) / 0.14);
}

.nesty-input {
    min-height: 3.2rem;
    max-height: 10rem;
    padding: 0.85rem 0.25rem;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    line-height: 1.45;
    resize: none;
    overflow-y: auto;
    font-size: 1rem;
}

.nesty-input:focus {
    outline: none;
    box-shadow: none;
}

.nesty-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: rgb(var(--c-accent));
    color: white;
    border: none;
    box-shadow: 0 14px 30px rgb(var(--c-accent) / 0.28);
    flex-shrink: 0;
}

.nesty-send-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.nesty-composer-note {
    max-width: 36rem;
    margin: 0.45rem auto 0;
    text-align: center;
    line-height: 1.45;
    opacity: 0.82;
}

.nesty-shell-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgb(var(--c-bg) / 0.55);
    backdrop-filter: blur(6px);
}

.nesty-shell-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 70;
    width: min(22rem, 88vw);
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, rgb(var(--c-surface)) 0%, rgb(var(--c-surface2)) 100%);
    border-right: 1px solid rgb(var(--c-border) / 0.55);
    box-shadow: 0 24px 70px rgb(var(--c-shadow) / 0.28);
    overflow: hidden;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
}

.nesty-shell-panel.open {
    transform: translateX(0);
}

.nesty-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.nesty-panel-primary,
.nesty-panel-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.65);
    background: rgb(var(--c-bg) / 0.3);
    color: rgb(var(--c-text));
    font-family: 'DM Mono', monospace;
    text-align: left;
}

.nesty-panel-primary {
    background: rgb(var(--c-accent) / 0.12);
    border-color: rgb(var(--c-accent) / 0.25);
    color: rgb(var(--c-accent));
}

.nesty-panel-link.is-disabled {
    opacity: 0.55;
    cursor: default;
}

.nesty-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.nesty-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nesty-panel-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 3rem;
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.6);
    background: rgb(var(--c-bg) / 0.28);
}

.nesty-panel-search {
    flex: 1;
    border: none;
    background: transparent;
    color: rgb(var(--c-text));
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    outline: none;
}

.nesty-panel-search::placeholder {
    color: rgb(var(--c-text-dim) / 0.6);
}

.nesty-conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.conv-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: stretch;
}

.conv-item,
.conv-item-empty {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.55);
    background: rgb(var(--c-bg) / 0.22);
    text-align: left;
}

.conv-item {
    transition: all 0.15s ease;
}

.conv-item-trigger {
    display: block;
}

.conv-item:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.05);
}

.conv-item.active,
.conv-item-row.active .conv-item {
    border-color: rgb(var(--c-accent) / 0.4);
    background: linear-gradient(180deg, rgb(var(--c-accent) / 0.16) 0%, rgb(var(--c-accent) / 0.08) 100%);
}

.conv-item-draft {
    border-style: dashed;
}

.conv-item-title {
    color: rgb(var(--c-text));
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.conv-item-meta,
.conv-item-empty {
    color: rgb(var(--c-text-dim));
    font-family: 'DM Mono', monospace;
    font-size: 0.84rem;
}

.conv-item-meta {
    margin-top: 0.25rem;
}

.conv-item-preview {
    margin-top: 0.35rem;
    color: rgb(var(--c-text-dim) / 0.85);
    font-family: 'DM Mono', monospace;
    font-size: 0.96rem;
    line-height: 1.4;
}

.conv-item-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.conv-item-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    min-width: 2.5rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(var(--c-border) / 0.55);
    background: rgb(var(--c-bg) / 0.18);
    color: rgb(var(--c-text-dim));
    transition: all 0.15s ease;
}

.conv-item-action:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    color: rgb(var(--c-text));
    background: rgb(var(--c-accent) / 0.06);
}

.conv-item-action.danger:hover {
    border-color: rgb(var(--c-error) / 0.35);
    color: rgb(var(--c-error));
    background: rgb(var(--c-error) / 0.08);
}

.conv-item-empty {
    text-align: center;
    padding: 1rem;
}

.nesty-project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.nesty-project-pill,
.nesty-placeholder-item {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.9rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(var(--c-border) / 0.58);
    background: rgb(var(--c-bg) / 0.24);
    color: rgb(var(--c-text-dim));
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    text-align: left;
}

.nesty-project-pill:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.05);
    color: rgb(var(--c-text));
}

.nesty-placeholder-item:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.05);
    color: rgb(var(--c-text));
}

.nesty-placeholder-item.is-active {
    border-color: rgb(var(--c-accent) / 0.45);
    background: rgb(var(--c-accent) / 0.12);
    color: rgb(var(--c-text));
    box-shadow: inset 0 0 0 1px rgb(var(--c-accent) / 0.18);
}

.nesty-placeholder-item.is-active .nesty-item-meta {
    color: rgb(var(--c-accent) / 0.92);
}

.nesty-project-pill.active {
    border-color: rgb(var(--c-accent) / 0.42);
    background: rgb(var(--c-accent) / 0.14);
    color: rgb(var(--c-accent));
}

.nesty-item-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
    min-width: 0;
    flex: 1;
}

.nesty-item-meta {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(var(--c-text-dim) / 0.62);
}

.nesty-item-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.55rem;
    padding: 0 0.45rem;
    border-radius: 9999px;
    background: rgb(var(--c-accent) / 0.14);
    color: rgb(var(--c-accent));
    font-size: 0.66rem;
    font-family: 'DM Mono', monospace;
}

.nesty-project-pill.is-disabled,
.nesty-placeholder-item.is-disabled {
    opacity: 0.5;
    cursor: default;
}

.nesty-placeholder-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.nesty-placeholder-list-tall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nesty-panel-profile {
    margin-top: 0.9rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.55);
    background: rgb(var(--c-bg) / 0.28);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nesty-panel-profile-kicker {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(var(--c-text-dim) / 0.6);
}

.nesty-panel-head .nesty-panel-note,
.nesty-panel-section .nesty-panel-note {
    flex-shrink: 0;
}

.nesty-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.nesty-panel-grid span {
    padding: 0.75rem 0.8rem;
    border-radius: 0.9rem;
    background: rgb(var(--c-bg) / 0.28);
    border: 1px solid rgb(var(--c-border) / 0.5);
    color: rgb(var(--c-text-dim));
    font-size: 0.78rem;
    font-family: 'DM Mono', monospace;
}

.nesty-panel-foot {
    margin-top: auto;
    line-height: 1.6;
}

.nesty-library-status {
    min-height: 1.1rem;
    color: rgb(var(--c-text-dim));
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nesty-library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nesty-library-filter {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.45rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgb(var(--c-border) / 0.5);
    background: rgb(var(--c-bg) / 0.18);
    color: rgb(var(--c-text-dim));
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: all 0.15s ease;
}

.nesty-library-filter:hover,
.nesty-library-filter.is-active {
    border-color: rgb(var(--c-accent) / 0.45);
    background: rgb(var(--c-accent) / 0.09);
    color: rgb(var(--c-text));
}

.nesty-library-results {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nesty-library-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.nesty-library-group-title {
    color: rgb(var(--c-text-dim) / 0.9);
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.nesty-library-preview,
.nesty-approvals-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.55);
    background: linear-gradient(180deg, rgb(var(--c-bg) / 0.34) 0%, rgb(var(--c-bg) / 0.18) 100%);
}

.nesty-library-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.nesty-library-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nesty-library-preview-meta span {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border-radius: 9999px;
    background: rgb(var(--c-bg) / 0.32);
    border: 1px solid rgb(var(--c-border) / 0.45);
    color: rgb(var(--c-text-dim));
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
}

.nesty-library-preview-body {
    border-radius: 0.95rem;
    border: 1px solid rgb(var(--c-border) / 0.45);
    background: rgb(var(--c-bg) / 0.26);
    overflow: hidden;
}

.nesty-library-preview-text {
    margin: 0;
    padding: 0.85rem 0.9rem;
    color: rgb(var(--c-text));
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 16rem;
    overflow: auto;
}

.nesty-library-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.nesty-library-preview-btn,
.nesty-approval-card {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.6rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(var(--c-border) / 0.55);
    background: rgb(var(--c-bg) / 0.22);
    color: rgb(var(--c-text));
    text-decoration: none;
    transition: all 0.15s ease;
}

.nesty-library-preview-btn:hover,
.nesty-approval-card:hover {
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.06);
}

.nesty-library-preview-btn.is-danger {
    border-color: rgb(var(--c-danger) / 0.35);
    color: rgb(var(--c-danger));
}

.nesty-library-preview-btn.is-danger:hover {
    border-color: rgb(var(--c-danger) / 0.5);
    background: rgb(var(--c-danger) / 0.08);
}

.nesty-approval-card.is-warning {
    border-color: rgb(var(--c-warning) / 0.35);
    background: rgb(var(--c-warning) / 0.08);
}

.nesty-approval-card.is-warning .material-symbols-outlined,
.nesty-approval-card.is-warning .nesty-item-meta {
    color: rgb(var(--c-warning));
}

@media (min-width: 768px) {
    .nesty-topbar {
        padding: 1.2rem 1.25rem 0.9rem;
    }

    .nesty-controls-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
        align-items: end;
    }

    .nesty-inline-actions {
        justify-content: flex-end;
    }

    body.nesty-page .chat-messages-area {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .nesty-welcome-card {
        padding: 2.25rem;
    }

    .nesty-shell-panel {
        width: min(24rem, 72vw);
    }
}

@media (min-width: 1280px) {
    body.nesty-shell-docked {
        overflow: hidden;
    }

    body.nesty-shell-docked .nesty-shell {
        overflow: visible;
    }

    body.nesty-shell-docked .chat-fullpage {
        max-width: 98rem;
        padding-left: 22.75rem;
    }

    body.nesty-shell-docked .chat-messages-area {
        max-width: 58rem;
        padding-left: 0.75rem;
        padding-right: 1.4rem;
    }

    body.nesty-shell-docked .nesty-shell-backdrop {
        display: none !important;
    }

    body.nesty-shell-docked .nesty-shell-panel,
    body.nesty-shell-docked .nesty-shell-panel.open {
        transform: none;
    }

    body.nesty-shell-docked .nesty-shell-panel {
        left: max(1rem, calc(50vw - 49rem));
        width: 20.75rem;
        padding-top: calc(1.1rem + env(safe-area-inset-top));
        box-shadow: 0 28px 80px rgb(var(--c-shadow) / 0.22);
    }

    body.nesty-shell-docked #chat-shell-close {
        display: none;
    }
}

/* ── Chat Attachments ───────────────────── */
.chat-attachment-list {
    display: grid;
    gap: 0.75rem;
}

.chat-attachment-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-border) / 0.5);
    background:
        linear-gradient(135deg, rgb(var(--c-accent) / 0.12), transparent 55%),
        rgb(var(--c-surface));
    box-shadow: 0 18px 32px rgb(var(--c-shadow) / 0.08);
}

.chat-attachment-thumb {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(var(--c-bg));
    border: 1px solid rgb(var(--c-accent) / 0.28);
    color: rgb(var(--c-accent));
    overflow: hidden;
    flex-shrink: 0;
}

.chat-attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-attachment-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-attachment-meta strong,
.chat-attachment-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-meta strong {
    font: 600 0.92rem/1.2 "DM Mono", monospace;
    color: rgb(var(--c-text));
}

.chat-attachment-meta span {
    font: 400 0.72rem/1.3 "DM Mono", monospace;
    color: rgb(var(--c-text-dim));
}

.chat-attachment-remove {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--c-error) / 0.25);
    background: rgb(var(--c-error) / 0.12);
    color: rgb(var(--c-error));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
}

.chat-attachment-remove:hover {
    transform: scale(1.06);
    background: rgb(var(--c-error) / 0.2);
}

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

.chat-bubble-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.chat-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgb(var(--c-bg) / 0.35);
    border: 1px solid rgb(var(--c-border) / 0.45);
    color: inherit;
    font: 500 0.7rem/1.1 "DM Mono", monospace;
}

.chat-attachment-pill .material-symbols-outlined {
    font-size: 1rem;
}

.chat-attachment-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-pill em {
    font-style: normal;
    opacity: 0.64;
}

/* ── 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);
}

.chat-grounding {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgb(var(--c-border) / 0.35);
}

.chat-grounding-label {
    font-size: 0.64rem;
    font-family: 'DM Mono', monospace;
    color: rgb(var(--c-text-dim) / 0.72);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-grounding-hint {
    margin-top: 0.28rem;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgb(var(--c-text-dim) / 0.78);
}

.chat-grounding-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.45rem;
}

.chat-grounding-source {
    width: 100%;
    display: grid;
    gap: 0.2rem;
    text-align: left;
    padding: 0.7rem 0.8rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(var(--c-border) / 0.45);
    background: rgb(var(--c-bg) / 0.18);
    color: rgb(var(--c-text));
    transition: all 0.15s ease;
}

.chat-grounding-source:hover {
    border-color: rgb(var(--c-accent) / 0.42);
    background: rgb(var(--c-accent) / 0.08);
}

.chat-grounding-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.64rem;
    font-family: 'DM Mono', monospace;
    color: rgb(var(--c-text-dim) / 0.76);
}

.chat-grounding-title {
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.35;
}

.chat-grounding-excerpt {
    font-size: 0.74rem;
    line-height: 1.45;
    color: rgb(var(--c-text-dim) / 0.82);
}

/* ── 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;
}

