/* ============ ARAN UI — Luxury Premium Interface ============ */
/* Design System v3 — Inspired by Apple, Hermès, Linear, Claude.ai */
@import url('tokens.css');

/* ============ RESET & BASE ============ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    height: 100vh;
    display: flex;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: var(--font-md);
    line-height: var(--line-height-normal);
    letter-spacing: var(--letter-spacing-normal);
    overscroll-behavior: none;
    font-feature-settings: 'cv01', 'cv02', 'cv03', 'cv04', 'tnum', 'kern', 'ss01';
    font-variation-settings: 'opsz' 14;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(190, 55, 52, 0.30); color: var(--text); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: var(--letter-spacing-tight); font-weight: var(--weight-semibold); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Scrollbars — premium thin (Apple-style) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fill); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fill-secondary); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--fill, rgba(255,255,255,0.14)) transparent; }

/* ============ APP LAYOUT ============ */
/* Desktop: sidebar + main. Mobile: full-width + bottom-nav + drawer sidebar */

.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ============ ICON RAIL (Premium nav-rail) ============ */
.app-rail {
    width: var(--rail-w);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: var(--z-sidebar);
    padding: 14px 0;
    align-items: center;
    border-right: 1px solid var(--border-subtle);
}

.rail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-3);
    margin-top: var(--space-2);
}

.rail-logo {
    width: 42px; height: 42px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-bottom: var(--space-md);
    overflow: hidden;
    box-shadow: var(--shadow-glow-gold);
    border: 1.5px solid rgba(190, 55, 52, 0.25);
    background: var(--surface);
}
.rail-avatar-img {
    width: 100%; height: 100%; object-fit: cover;
}

.rail-btn {
    width: 42px; height: 42px;
    background: none; border: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: color var(--transition-icon), background var(--transition-normal), transform var(--transition-fast);
    position: relative;
}
.rail-btn svg { width: 20px; height: 20px; transition: transform var(--transition-normal); }
.rail-btn:hover { background: var(--fill-tertiary); color: var(--text-secondary); }
.rail-btn:hover svg { transform: scale(1.08); }
.rail-btn.active { color: var(--accent); background: var(--accent-surface); box-shadow: 0 0 12px var(--accent-glow); }
.rail-btn:active { transform: scale(0.92); }

/* Studio link styled as rail button */
a.rail-btn { text-decoration: none; flex-direction: column; gap: 2px; }
.rail-studio-btn { color: var(--accent) !important; }
.rail-studio-btn:hover { background: var(--accent-surface); }
.rail-studio-label {
    font-size: 8px; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase; line-height: 1; opacity: 0.8;
}

.rail-badge {
    position: absolute; top: 4px; right: 4px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface);
    display: none;
}
.rail-badge.visible { display: block; }

.rail-avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--font-2xs); font-weight: var(--weight-bold);
    cursor: pointer;
    transition: transform var(--transition-fast);
    margin-top: 2px;
}
.rail-avatar:active { transform: scale(0.93); }

/* ============ CONTEXT PANEL (Premium sidebar) ============ */
.context-panel {
    width: 0;
    overflow: hidden;
    background: var(--surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-luxury);
    z-index: var(--z-sidebar);
    will-change: width;
}
.context-panel.open {
    width: var(--context-w);
}

.ctx-section {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-width: var(--context-w);
}
.ctx-section.active {
    display: flex;
}

.ctx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    flex-shrink: 0;
}
.ctx-header h3 {
    font-size: var(--font-md);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.ctx-search {
    padding: 0 var(--space-sm) var(--space-sm);
    flex-shrink: 0;
}
.ctx-search input {
    width: 100%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-full);
    background: var(--fill-tertiary); border: none;
    color: var(--text); font-size: var(--font-sm); font-family: inherit;
    outline: none; transition: background var(--transition-normal);
}
.ctx-search input:focus { background: var(--fill-secondary); }
.ctx-search input::placeholder { color: var(--text-muted); }

.ctx-sessions {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--space-sm);
    overscroll-behavior: contain;
}
.ctx-sessions h3 {
    font-size: var(--font-2xs); text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.5px;
    margin: var(--space-sm) 0 var(--space-xs); font-weight: var(--weight-semibold);
}

.ctx-group-label {
    font-size: var(--font-2xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: var(--weight-semibold);
    padding: var(--space-md) var(--space-sm) var(--space-xs);
}

.ctx-nav-list {
    padding: 0 var(--space-sm);
    flex: 1;
    overflow-y: auto;
}

.ctx-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    min-height: 36px;
    border-radius: var(--radius-apple-btn);
    border-left: 3px solid transparent;
    font-size: var(--font-base);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-bottom: 1px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.ctx-nav-item:hover { background: var(--fill-tertiary); color: var(--text); }
.ctx-nav-item.active { background: var(--fill-secondary); color: var(--accent-light); font-weight: var(--weight-semibold); border-left-color: var(--accent); }
.ctx-nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

/* ============ CONTEXT PANEL BACKDROP (mobile) ============ */
.context-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    transition: opacity var(--transition-slow);
    cursor: pointer;
}
.context-backdrop.visible { display: block; opacity: 1; }

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ============ TOP BAR (Premium glass) ============ */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 var(--space-lg);
    padding-top: var(--safe-top);
    height: calc(var(--topbar-h) + var(--safe-top));
    background: var(--glass-bg-thick);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: var(--z-sticky);
}
.hamburger {
    display: none;
    background: none; border: none;
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
    font-size: 20px;
    cursor: pointer;

}
.hamburger:hover { background: var(--fill-tertiary); color: var(--text); }

.breadcrumb {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: var(--space-1);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    overflow: hidden;
}
.breadcrumb-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-item.current { color: var(--text); font-weight: var(--weight-semibold); }
.breadcrumb-sep { color: var(--text-muted); font-size: var(--font-2xs); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}
.topbar-btn {
    background: none; border: none;
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
    position: relative;

}
.topbar-btn:hover { background: var(--fill-tertiary); color: var(--text); }
.topbar-btn.active { background: var(--accent-surface); color: var(--accent); }

.notif-badge {
    position: absolute; top: var(--space-1); right: var(--space-1);
    background: var(--danger); color: white;
    font-size: var(--font-2xs); font-weight: var(--weight-bold);
    min-width: 16px; height: 16px;
    border-radius: var(--radius-full);
    display: none; align-items: center; justify-content: center;
    padding: 0 var(--space-1);
}
.notif-badge.visible { display: flex; }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--patrimoine), var(--patrimoine-light));
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--font-sm); font-weight: var(--weight-bold);
    cursor: pointer;
}
.status-indicator { display: flex; align-items: center; gap: 6px; cursor: default; }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success); transition: background 0.3s ease;
    flex-shrink: 0;
}
.status-dot.connected { background: var(--success); animation: pulse 2s infinite; }
.status-dot.reconnecting { background: var(--warning, #f59e0b); animation: pulse 0.8s infinite; }
.status-dot.disconnected { background: var(--danger); animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.status-label { font-size: var(--font-2xs); color: var(--text-muted); white-space: nowrap; transition: color 0.3s ease; }
.status-label.reconnecting { color: var(--warning, #f59e0b); }
.status-label.disconnected { color: var(--danger); }
.status-text { font-size: var(--font-xs); color: var(--text-muted); white-space: nowrap; }

/* ============ BOTTOM NAV (Mobile — premium glass) ============ */
.bottom-nav {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottomnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--glass-bg-thick);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-subtle);
    z-index: var(--z-bottomnav);
    align-items: stretch;
    justify-content: space-around;
}
.bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: var(--space-1);
    background: none; border: none;
    color: var(--text-muted);
    font-size: var(--font-2xs); font-weight: var(--weight-medium);
    padding: var(--space-1) 0;
    transition: color var(--transition-fast);
    min-height: 48px;
}
.bottom-nav-item:hover { color: var(--text-secondary); }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-icon { font-size: 20px; line-height: 1; }

/* ============ CONTENT AREAS ============ */
.content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Chat container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.chat-container.hidden { display: none; }

/* Module container */
.module-container {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: var(--bg);
}
.module-container.active { display: block; }

/* ============ MODULE PAGE SHARED ============ */
.module-page {
    max-width: var(--max-content-w);
    margin: 0 auto;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Page Header (Untitled UI section header) */
.cmp-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-6); flex-wrap: wrap; gap: var(--space-4);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}
.page-header-left { display: flex; align-items: center; gap: var(--space-3); }
.page-header-icon { font-size: 24px; display: flex; align-items: center; color: var(--text-muted); }
.cmp-page-header h2 { font-size: var(--font-3xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; }
.page-header-sub { font-size: var(--font-sm); color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ============================================================
   BUTTONS — Shadcn/DaisyUI hybrid, Open Props vars
   ============================================================
   Naming : Shadcn (default/primary/secondary/ghost/danger/link)
   Sizing : DaisyUI (sm / md-default / lg)
   Tokens : Open Props style (CSS custom properties)
   ============================================================ */

/* ---- Button tokens (scoped) — LobeChat control-height ---- */
.btn {
    /* Geometry — overridden by size modifiers */
    --_btn-h: 36px;
    --_btn-px: 16px;
    --_btn-py: 0;
    --_btn-gap: 8px;
    --_btn-fs: 14px;
    --_btn-lh: 20px;
    --_btn-r: var(--radius-md, 8px);

    /* Colors — overridden by variant modifiers */
    --_btn-bg: var(--surface2);
    --_btn-fg: var(--text);
    --_btn-border: var(--border);
    --_btn-ring: var(--accent-glow);

    /* Derived hover/active — variants override these */
    --_btn-bg-hover: var(--surface3);
    --_btn-fg-hover: var(--text);
    --_btn-border-hover: var(--border-hover);
    --_btn-bg-active: var(--surface4);
}

/* ---- Base ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--_btn-gap);
    height: var(--_btn-h);
    padding: var(--_btn-py) var(--_btn-px);
    border-radius: var(--_btn-r);
    font-size: var(--_btn-fs);
    line-height: var(--_btn-lh);
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    text-decoration: none;

    /* Apply token colors */
    background: var(--_btn-bg);
    color: var(--_btn-fg);
    border: 1px solid var(--_btn-border);

    /* Smooth transition */
    transition-property: background, color, border-color, box-shadow, opacity, transform;
    transition-duration: 200ms;
    transition-timing-function: ease;
    box-shadow: none;
}

/* SVG icons auto-size */
.btn svg {
    flex-shrink: 0;
    width: 16px; height: 16px;
}

/* ---- States ---- */
.btn:hover {
    background: var(--_btn-bg-hover);
    color: var(--_btn-fg-hover);
    border-color: var(--_btn-border-hover);
}
.btn:active {
    background: var(--_btn-bg-active);
    transform: scale(0.95);
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg, #0C111D), 0 0 0 4px var(--_btn-ring);
}
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============ SIZE MODIFIERS ============ */
.btn-sm {
    --_btn-h: 32px;
    --_btn-px: 8px;
    --_btn-gap: 6px;
    --_btn-fs: 12px;
    --_btn-lh: 18px;
    --_btn-r: var(--radius-sm, 6px);
}
.btn-sm svg { width: 14px; height: 14px; }

.btn-lg {
    --_btn-h: 40px;
    --_btn-px: 20px;
    --_btn-gap: 8px;
    --_btn-fs: 15px;
    --_btn-lh: 22px;
    --_btn-r: var(--radius-md, 8px);
}
.btn-lg svg { width: 18px; height: 18px; }

/* Full width */
.btn-full { width: 100%; }

/* ============ VARIANT: PRIMARY ============ */
/* Solid brand button — main CTA */
.btn-primary {
    --_btn-bg: var(--accent);
    --_btn-fg: var(--text-on-accent);
    --_btn-border: var(--accent);
    --_btn-bg-hover: var(--accent-hover);
    --_btn-fg-hover: var(--text-on-accent);
    --_btn-border-hover: var(--accent-hover);
    --_btn-bg-active: var(--accent-muted);
    --_btn-ring: var(--accent-glow);
    font-weight: 600;
    box-shadow: 0 1px 3px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 4px 12px var(--accent-glow); transform: translateY(-1px); }

/* ============ VARIANT: SECONDARY ============ */
/* Outlined button — default, neutral actions */
.btn-secondary {
    --_btn-bg: var(--surface);
    --_btn-fg: var(--text);
    --_btn-border: var(--border);
    --_btn-bg-hover: var(--surface2);
    --_btn-fg-hover: var(--text);
    --_btn-border-hover: var(--border-hover);
    --_btn-bg-active: var(--surface3);
}

/* ============ VARIANT: GHOST ============ */
/* Transparent — toolbar actions, subtle buttons (LobeChat 400ms) */
.btn-ghost {
    --_btn-bg: transparent;
    --_btn-fg: var(--text-muted);
    --_btn-border: transparent;
    --_btn-bg-hover: var(--fill-tertiary);
    --_btn-fg-hover: var(--text-secondary);
    --_btn-border-hover: transparent;
    --_btn-bg-active: var(--fill-secondary);
    box-shadow: none;
    transition: color var(--transition-icon), background var(--transition-fast), transform 200ms ease;
}

/* ============ VARIANT: DANGER / DESTRUCTIVE ============ */
/* Solid red — delete, remove, destructive actions */
.btn-danger {
    --_btn-bg: var(--danger);
    --_btn-fg: #fff;
    --_btn-border: var(--danger);
    --_btn-bg-hover: var(--danger-hover);
    --_btn-fg-hover: #fff;
    --_btn-border-hover: var(--danger-hover);
    --_btn-bg-active: #B42318;
    --_btn-ring: rgba(240, 68, 56, 0.24);
    font-weight: 600;
}

/* ============ VARIANT: SUCCESS ============ */
/* Solid green — confirm, approve actions */
.btn-success {
    --_btn-bg: var(--success);
    --_btn-fg: #fff;
    --_btn-border: var(--success);
    --_btn-bg-hover: #079455;
    --_btn-fg-hover: #fff;
    --_btn-border-hover: #079455;
    --_btn-bg-active: #067647;
    --_btn-ring: var(--success-border);
    font-weight: 600;
}

/* ============ VARIANT: OUTLINE ============ */
/* Like secondary but more prominent border */
.btn-outline {
    --_btn-bg: transparent;
    --_btn-fg: var(--accent);
    --_btn-border: var(--accent);
    --_btn-bg-hover: var(--accent-surface);
    --_btn-fg-hover: var(--accent-hover);
    --_btn-border-hover: var(--accent-hover);
    --_btn-bg-active: var(--accent-bg);
}

/* ============ VARIANT: LINK ============ */
/* Looks like a link — no bg, no border, no padding */
.btn-link {
    --_btn-bg: transparent;
    --_btn-fg: var(--accent);
    --_btn-border: transparent;
    --_btn-bg-hover: transparent;
    --_btn-fg-hover: var(--accent-hover);
    --_btn-border-hover: transparent;
    --_btn-bg-active: transparent;
    --_btn-h: auto;
    --_btn-px: 0;
    box-shadow: none;
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* ============ VARIANT: PATRIMOINE (brand) ============ */
.btn-patrimoine {
    --_btn-bg: var(--patrimoine);
    --_btn-fg: #fff;
    --_btn-border: var(--patrimoine);
    --_btn-bg-hover: var(--patrimoine-hover);
    --_btn-fg-hover: #fff;
    --_btn-border-hover: var(--patrimoine-hover);
    --_btn-bg-active: #5c141f;
    --_btn-ring: var(--patrimoine-glow);
    font-weight: 600;
}

/* ============ ICON BUTTON (LobeChat ActionIcon) ============ */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    overflow: hidden;
    transition: color var(--transition-icon), background var(--transition-fast);
}
.btn-icon svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-icon:hover { background: var(--fill-tertiary); color: var(--text-secondary); }
.btn-icon:active { color: var(--text); transform: scale(0.95); }
.btn-icon:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-glow);
}
.btn-icon:disabled { opacity: 0.4; pointer-events: none; }
.btn-icon.active { background: var(--accent-surface); color: var(--accent); }

/* Icon button sizes */
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-sm svg { width: 14px; height: 14px; }
.btn-icon.btn-lg { width: 40px; height: 40px; }
.btn-icon.btn-lg svg { width: 20px; height: 20px; }

/* ============ BUTTON GROUP ============ */
.btn-group {
    display: inline-flex;
}
.btn-group .btn {
    border-radius: 0;
    margin-left: -1px;
    position: relative;
}
.btn-group .btn:first-child { border-radius: var(--radius-md, 8px) 0 0 var(--radius-md, 8px); margin-left: 0; }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0; }
.btn-group .btn:hover { z-index: 1; }
.btn-group .btn:focus-visible { z-index: 2; }

/* ============ DATA TABLE (Untitled UI style) ============ */
.cmp-datatable {}
.datatable-scroll { overflow-x: auto; }
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-apple-card); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table thead th {
    padding: var(--space-3) var(--space-4); text-align: left;
    font-size: var(--font-xs); font-weight: var(--weight-medium);
    color: var(--text-muted); background: var(--surface2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap; user-select: none;
}
.dt-sortable { cursor: pointer; user-select: none; white-space: nowrap; transition: color .15s; }
.dt-sortable:hover { color: var(--text); background: var(--fill-quaternary); }
.dt-sortable::after { content: '⇅'; font-size: 10px; margin-left: 4px; opacity: 0.3; }
.dt-sortable[aria-sort="ascending"]::after { content: '↑'; opacity: 1; color: var(--accent); }
.dt-sortable[aria-sort="descending"]::after { content: '↓'; opacity: 1; color: var(--accent); }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--fill-tertiary); }
.dt-clickable { cursor: pointer; }
.data-table tbody td {
    padding: var(--space-3) var(--space-4); font-size: var(--font-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.dt-empty { text-align: center; color: var(--text-muted); padding: var(--space-10) !important; font-size: var(--font-sm); }
.dt-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-sm) var(--space-md); font-size: var(--font-sm);
    color: var(--text-muted);
}
.dt-page-btns { display: flex; gap: var(--space-xs); }
.dt-page-btn {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text-secondary); padding: 4px 10px;
    border-radius: var(--radius-sm); font-size: var(--font-sm);
    transition: all var(--transition-fast);
}
.dt-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.dt-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dt-page-info { font-size: var(--font-sm); color: var(--text-muted); }
.dt-prev, .dt-next { cursor: pointer; }
.dt-check, .dt-check-all {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

/* ============ DETAIL PANEL ROWS ============ */
.detail-rows { display: flex; flex-direction: column; gap: 0; }

/* ============ SKIP LINK ============ */
.skip-link {
    position: absolute; top: -100px; left: 0; z-index: 9999;
    background: var(--accent); color: white; padding: 8px 16px;
    border-radius: 0 0 8px 0; text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ============ STAT CARDS (Untitled UI metric cards) ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4); margin-bottom: var(--space-6);
}
.cmp-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-apple-card);
    padding: var(--space-5) var(--space-6);
    display: flex; align-items: flex-start; gap: var(--space-4);
    transition: var(--transition-hover-lift);
    box-shadow: var(--shadow-sm);
}
.cmp-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.cmp-stat-card[style*="cursor"] { cursor: pointer; }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-accent .stat-icon { background: var(--accent-surface); color: var(--accent); }
.stat-success .stat-icon { background: var(--success-surface); color: var(--success); }
.stat-warning .stat-icon { background: var(--warning-surface); color: var(--warning); }
.stat-danger .stat-icon { background: var(--danger-surface); color: var(--danger); }
.stat-info .stat-icon { background: var(--info-surface); color: var(--info); }
.stat-label { font-size: var(--font-sm); color: var(--text-muted); margin-bottom: 4px; font-weight: var(--weight-medium); }
.stat-value { font-size: var(--font-3xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; line-height: 1.2; }
.stat-detail { font-size: var(--font-sm); color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: var(--font-sm); font-weight: var(--weight-medium); display: inline-flex; align-items: center; gap: 2px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ============ FILTER BAR (Untitled UI) ============ */
.cmp-filter-bar {
    display: flex; align-items: center; gap: var(--space-3);
    margin-bottom: var(--space-5); flex-wrap: wrap;
}
.filter-pills { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.filter-pill {
    padding: 6px 14px; border-radius: var(--radius-md);
    font-size: var(--font-sm); font-weight: var(--weight-medium);
    background: var(--surface); color: var(--text-secondary);
    border: 1px solid var(--border); cursor: pointer;
    transition: all var(--transition-fast); white-space: nowrap;
}
.filter-pill:hover { background: var(--fill-tertiary); border-color: var(--border-hover); color: var(--text); }
.filter-pill.active { background: var(--accent-surface); color: var(--accent); border-color: var(--accent); }
.pill-count { font-size: var(--font-2xs); opacity: 0.7; margin-left: 2px; }
.filter-search { flex: 1; min-width: 200px; }
.filter-search-input {
    width: 100%; padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    font-size: var(--font-sm); font-family: inherit;
    outline: none; transition: border-color var(--transition-normal);
}
.filter-search-input:focus { border-color: var(--accent); }
.filter-search-input::placeholder { color: var(--text-disabled); }

/* ============ BADGES (Untitled UI pill badges) ============ */
.cmp-badge {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: var(--radius-full);
    font-size: var(--font-xs); font-weight: var(--weight-medium);
    white-space: nowrap; line-height: 1.5;
    border: 1px solid transparent;
}
.badge-neutral { background: var(--surface3); color: var(--text-secondary); border-color: var(--border); }
.badge-info { background: var(--info-surface); color: var(--info); border-color: var(--info-border); }
.badge-success { background: var(--success-surface); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-surface); color: var(--warning); border-color: var(--warning-border); }
.badge-danger { background: var(--danger-surface); color: var(--danger); border-color: var(--danger-border); }
.badge-accent { background: var(--accent-surface); color: var(--accent); border-color: var(--accent-glow); }

/* ============ DETAIL PANEL (slide-in) ============ */
.cmp-detail-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 0;
    animation: slideIn 0.2s ease; overflow: hidden;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.detail-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
}
.detail-panel-header h3 { font-size: var(--font-lg); font-weight: var(--weight-semibold); }
.detail-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 20px; width: 32px; height: 32px;
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { background: var(--fill-tertiary); color: var(--text); }
.detail-panel-body { padding: var(--space-md) var(--space-lg); }
.detail-section { margin-bottom: var(--space-md); }
.detail-section h4 { font-size: var(--font-base); font-weight: var(--weight-semibold); color: var(--text-muted); margin-bottom: var(--space-sm); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-row { display: flex; gap: var(--space-sm); padding: 6px 0; font-size: var(--font-base); border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); min-width: 130px; flex-shrink: 0; font-weight: var(--weight-medium); }
.detail-row .val { color: var(--text); flex: 1; }
.detail-panel-footer {
    display: flex; gap: var(--space-sm); padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
}

/* ============ MODAL ============ */
.cmp-modal-backdrop {
    position: fixed; inset: 0; z-index: var(--z-modal);
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity var(--transition-normal);
}
.cmp-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.cmp-modal-backdrop.closing { opacity: 0; }
.cmp-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    width: 90%; transform: scale(0.95); opacity: 0;
    transition: transform var(--transition-luxury), opacity var(--transition-slow);
    max-height: 85vh; display: flex; flex-direction: column;
}
.cmp-modal-backdrop.open .cmp-modal { transform: scale(1); opacity: 1; }
.modal-sm { max-width: 380px; }
.modal-md { max-width: 520px; }
.modal-lg { max-width: 720px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-lg); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h3 { font-size: var(--font-lg); font-weight: var(--weight-semibold); }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 20px; width: 32px; height: 32px;
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--fill-tertiary); color: var(--text); }
.modal-body { padding: var(--space-lg); overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: var(--space-sm); justify-content: flex-end; padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border); flex-shrink: 0; }

/* ============ BOTTOM SHEET (mobile) ============ */
.cmp-bottomsheet-backdrop {
    position: fixed; inset: 0; z-index: var(--z-modal);
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
    transition: opacity var(--transition-slow);
}
.cmp-bottomsheet-backdrop.open { opacity: 1; pointer-events: auto; }
.cmp-bottomsheet-backdrop.closing { opacity: 0; }
.cmp-bottomsheet {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 85vh; display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--transition-spring);
    padding-bottom: var(--safe-bottom);
}
.cmp-bottomsheet-backdrop.open .cmp-bottomsheet { transform: translateY(0); }
.cmp-bottomsheet-backdrop.closing .cmp-bottomsheet { transform: translateY(100%); }
.bottomsheet-handle { width: 32px; height: 4px; background: var(--border); border-radius: 2px; margin: var(--space-sm) auto; }
.bottomsheet-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); }
.bottomsheet-header h3 { font-size: var(--font-lg); font-weight: var(--weight-semibold); }
.bottomsheet-close { background: none; border: none; color: var(--text-muted); font-size: 20px; width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.bottomsheet-close:hover { background: var(--fill-tertiary); }
.bottomsheet-body { padding: var(--space-md); overflow-y: auto; flex: 1; }

/* ============ TOAST ============ */
#aran-toast-container {
    position: fixed; top: var(--space-md); right: var(--space-md); z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: var(--space-sm);
    pointer-events: none; max-width: 400px;
}
.cmp-toast {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 12px 18px; border-radius: var(--radius-lg);
    font-size: var(--font-base); color: white;
    box-shadow: var(--shadow-xl); pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.cmp-toast.closing { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }
.toast-info { background: var(--info); }
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); }
.toast-error { background: var(--danger); }
.toast-msg { flex: 1; }
.toast-undo { background: rgba(255,255,255,0.2); border: none; color: white; padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--font-sm); cursor: pointer; }
.toast-undo:hover { background: rgba(255,255,255,0.3); }
.toast-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 16px; cursor: pointer; padding: 0 4px; }
.toast-close:hover { color: white; }

/* ============ COMMAND PALETTE ============ */
.cmp-command-backdrop {
    position: fixed; inset: 0; z-index: var(--z-command);
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 15vh;
    opacity: 0; pointer-events: none; transition: opacity var(--transition-normal);
}
.cmp-command-backdrop.open { opacity: 1; pointer-events: auto; }
.cmp-command-backdrop.closing { opacity: 0; }
.cmp-command-palette {
    width: 90%; max-width: 580px;
    background: var(--glass-bg-thick); border: 1px solid var(--border);
    border-radius: var(--radius-2xl); box-shadow: var(--shadow-2xl);
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transform: scale(0.95) translateY(-10px); opacity: 0;
    transition: transform var(--transition-luxury), opacity var(--transition-slow);
}
.cmp-command-backdrop.open .cmp-command-palette { transform: scale(1) translateY(0); opacity: 1; }
.command-input-wrap {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
}
.command-icon { font-size: 16px; color: var(--text-muted); }
.command-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-size: var(--font-lg); font-family: inherit;
}
.command-input::placeholder { color: var(--text-muted); }
.command-results { max-height: 360px; overflow-y: auto; padding: var(--space-xs); }
.command-item {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 10px 14px; border-radius: var(--radius-md);
    cursor: pointer; transition: background var(--transition-fast);
}
.command-item:hover, .command-item.active { background: var(--fill-tertiary); }
.command-item-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.command-item-info { flex: 1; min-width: 0; }
.command-item-label { font-size: var(--font-md); font-weight: var(--weight-medium); }
.command-item-hint { font-size: var(--font-sm); color: var(--text-muted); margin-left: var(--space-sm); }
.command-shortcut { font-size: var(--font-2xs); padding: 2px 6px; border-radius: 4px; background: var(--surface3); color: var(--text-muted); border: 1px solid var(--border); font-family: var(--font-mono); }
.command-cat { padding: 6px 14px 4px; font-size: var(--font-2xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.command-tag { font-size: var(--font-2xs); padding: 2px 8px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 500; margin-left: auto; flex-shrink: 0; }
.command-empty { text-align: center; padding: var(--space-lg); color: var(--text-muted); font-size: var(--font-base); }
.command-footer { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--border); font-size: var(--font-xs); color: var(--text-muted); }
.command-footer kbd { padding: 1px 5px; border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); font-family: var(--font-mono); font-size: var(--font-2xs); }

/* ============ EMPTY STATE ============ */
.cmp-empty-state {
    text-align: center; padding: var(--space-3xl) var(--space-lg);
}
.empty-icon { font-size: 48px; margin-bottom: var(--space-md); opacity: 0.5; }
.cmp-empty-state h3 { font-size: var(--font-lg); font-weight: var(--weight-semibold); margin-bottom: var(--space-xs); }
.cmp-empty-state p { color: var(--text-muted); font-size: var(--font-md); margin-bottom: var(--space-lg); }

/* ============ SKELETON LOADING ============ */
.cmp-skeleton { padding: var(--space-md); }
.skel-row { display: flex; gap: var(--space-md); margin-bottom: var(--space-sm); }
.skel-cell, .skel-line, .skel-card {
    height: 16px; border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.w20 { width: 20%; } .w30 { width: 30%; } .w40 { width: 40%; }
.w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); }
.skel-card { height: 100px; border-radius: var(--radius-lg); }
.skel-detail { display: flex; gap: var(--space-md); margin-bottom: var(--space-sm); }

/* ============ LOADING & ERROR ============ */
.module-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 80px 20px;
    color: var(--text-muted); gap: var(--space-md);
}
.module-error { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.module-error h2 { color: var(--danger); margin-bottom: var(--space-sm); }
.module-spinner {
    display: flex; align-items: center; justify-content: center;
    padding: 40px; color: var(--text-muted);
}
.module-spinner::after {
    content: ''; width: 24px; height: 24px;
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ ALERT BANNER ============ */
.alert-banner {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-md); border-radius: var(--radius-md);
    margin-bottom: var(--space-md); font-size: var(--font-base);
}
.alert-banner.danger { background: var(--danger-surface); border: 1px solid var(--danger-border); color: var(--danger-light); }
.alert-banner.warning { background: var(--warning-surface); border: 1px solid var(--warning-border); color: var(--warning-light); }
.alert-banner.info { background: var(--info-surface); border: 1px solid var(--info-border); color: var(--info-light); }
.alert-banner.success { background: var(--success-surface); border: 1px solid var(--success-border); color: var(--success-light); }

/* ============ CHART CONTAINER ============ */
.chart-container {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-md); margin-bottom: var(--space-lg);
}
.chart-container h3 { font-size: var(--font-md); font-weight: var(--weight-semibold); margin-bottom: var(--space-md); }

/* ============ KANBAN ============ */
.kanban-board {
    display: flex; gap: var(--space-md);
    overflow-x: auto; padding-bottom: var(--space-md);
    min-height: 400px;
}
.kanban-column {
    min-width: 280px; max-width: 320px; flex-shrink: 0;
    background: var(--surface2);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
}
.kanban-column-header {
    padding: var(--space-md);
    font-size: var(--font-base); font-weight: var(--weight-semibold);
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.kanban-count {
    background: var(--surface3); color: var(--text-muted);
    font-size: var(--font-xs); padding: 2px 8px;
    border-radius: var(--radius-full);
}
.kanban-cards { padding: var(--space-sm); flex: 1; overflow-y: auto; }
.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: var(--transition-hover-lift);
    box-shadow: var(--shadow-xs);
}
.kanban-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kanban-card-title { font-size: var(--font-base); font-weight: var(--weight-medium); margin-bottom: var(--space-xs); }
.kanban-card-meta { font-size: var(--font-xs); color: var(--text-muted); display: flex; gap: var(--space-sm); }

/* ============ TABS ============ */
.tab-bar {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg); overflow-x: auto;
}
.tab-btn {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-base); font-weight: var(--weight-medium);
    color: var(--text-muted); background: none; border: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast); white-space: nowrap;
}
.tab-btn:hover { color: var(--text); background: var(--fill-tertiary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============ FORM ELEMENTS (Untitled UI inputs) ============ */
.form-group { margin-bottom: var(--space-5); }
.form-label {
    display: block; font-size: var(--font-sm); font-weight: var(--weight-medium);
    color: var(--text-secondary); margin-bottom: var(--space-1);
}
.form-hint { font-size: var(--font-xs); color: var(--text-muted); margin-top: var(--space-1); }
.form-error { font-size: var(--font-xs); color: var(--danger); margin-top: var(--space-1); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 6px 14px;
    height: var(--control-h);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-apple-input); color: var(--text);
    font-size: var(--font-md); font-family: inherit;
    outline: none; transition: all var(--transition-normal);
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-hover); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--danger); }
.form-input.error:focus, .form-select.error:focus { box-shadow: var(--shadow-focus-danger); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-disabled); }
.form-input:disabled, .form-select:disabled, .form-textarea:disabled { background: var(--surface2); color: var(--text-disabled); cursor: not-allowed; }
.form-textarea { resize: vertical; min-height: 80px; height: auto; padding: 8px 12px; }
.form-select { cursor: pointer; }

/* ============ TASK CARDS ============ */
.task-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: var(--space-md);
    margin-bottom: var(--space-sm); cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.task-card:hover { border-color: var(--accent); }
.task-card.task-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.task-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); gap: var(--space-sm); }
.task-card-title { font-size: var(--font-md); font-weight: var(--weight-semibold); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card-meta { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--font-xs); color: var(--text-muted); margin-top: 6px; }
.task-progress-bar { width: 100%; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin: var(--space-sm) 0 var(--space-xs); }
.task-progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }

/* ============ TASK INDICATOR (chat) ============ */
.task-indicator {
    position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: var(--surface); border: 1px solid var(--accent);
    border-radius: var(--radius-lg); padding: var(--space-sm) var(--space-md);
    display: flex; align-items: center; gap: var(--space-sm);
    box-shadow: var(--shadow-lg); z-index: var(--z-overlay);
    animation: fadeIn 0.2s ease; max-width: 90%;
}
.task-ind-icon { font-size: 16px; flex-shrink: 0; }
.task-ind-info { flex: 1; min-width: 0; }
.task-ind-step { font-size: var(--font-sm); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-ind-bar { width: 100%; height: 4px; background: var(--surface2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.task-ind-progress { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.task-ind-link { font-size: var(--font-xs); color: var(--accent); white-space: nowrap; text-decoration: none; flex-shrink: 0; }
.task-ind-link:hover { text-decoration: underline; }

/* task-step & task-subtask */
.task-step { font-size: var(--font-sm); color: var(--text-secondary); margin-top: var(--space-xs); }
.task-progress-fill.animated { animation: progressPulse 2s ease infinite; }
@keyframes progressPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* ============ PLANNING CALENDAR ============ */
.plan-week-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 1px; background: var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.plan-day-col {
    background: var(--surface); padding: var(--space-sm); min-height: 200px;
}
.plan-day-label {
    font-size: var(--font-xs); font-weight: var(--weight-semibold);
    color: var(--text-muted); text-transform: uppercase; margin-bottom: var(--space-xs);
}
.plan-day-num {
    font-size: var(--font-xl); font-weight: var(--weight-bold); color: var(--text);
}
.plan-event-chip {
    margin-top: 6px; padding: 6px 8px; background: var(--surface2);
    border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
    cursor: pointer; transition: background var(--transition-fast);
}
.plan-event-chip:hover { background: var(--fill-secondary); }
.plan-event-title {
    font-weight: var(--weight-semibold); color: var(--text); font-size: var(--font-sm);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-event-time { color: var(--text-muted); font-size: var(--font-xs); }

.plan-month-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 1px; background: var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.plan-month-header {
    background: var(--surface); padding: var(--space-sm); text-align: center;
    font-size: var(--font-xs); font-weight: var(--weight-semibold);
    color: var(--text-muted); text-transform: uppercase;
}
.plan-month-cell {
    background: var(--surface); padding: var(--space-sm); min-height: 80px; cursor: pointer;
    transition: background var(--transition-fast);
}
.plan-month-cell:hover { background: var(--fill-tertiary); }
.plan-month-cell.empty { opacity: 0.3; cursor: default; }
.plan-month-num {
    font-size: var(--font-base); font-weight: var(--weight-semibold); color: var(--text);
}
.plan-day-today {
    background: var(--accent); color: white !important; border-radius: var(--radius-full);
    width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
}
.plan-dots { display: flex; gap: 3px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.plan-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ============ NOTIFICATIONS ============ */
.notif-date-group { margin-bottom: var(--space-md); }
.notif-date-label {
    font-size: var(--font-sm); font-weight: var(--weight-semibold);
    color: var(--text-muted); margin-bottom: var(--space-sm);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.notif-item {
    display: flex; gap: var(--space-md); align-items: flex-start;
    padding: var(--space-md); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-apple-card);
    margin-bottom: var(--space-sm); cursor: pointer;
    transition: var(--transition-hover-lift);
    box-shadow: var(--shadow-xs);
}
.notif-item:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.notif-item.notif-read { opacity: 0.6; }
.notif-item.notif-unread { border-left: 3px solid var(--accent); }
.notif-icon { font-size: 24px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: var(--font-md); font-weight: var(--weight-semibold); color: var(--text); }
.notif-text { font-size: var(--font-base); color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: var(--font-xs); color: var(--text-muted); margin-top: 4px; }
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0; margin-top: 6px;
}
.notif-delete {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
    opacity: 0; transition: opacity var(--transition-fast), color var(--transition-fast);
}
.notif-item:hover .notif-delete { opacity: 1; }
.notif-delete:hover { color: var(--danger); }

/* ============ APPS ============ */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}
.app-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-apple-card); padding: var(--space-md);
    cursor: pointer; position: relative;
    transition: var(--transition-hover-lift);
    box-shadow: var(--shadow-sm);
}
.app-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.app-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-sm); }
.app-card-icon { font-size: 28px; line-height: 1; }
.app-card-name { font-size: var(--font-md); font-weight: var(--weight-semibold); margin-bottom: 4px; }
.app-card-desc { font-size: var(--font-sm); color: var(--text-muted); line-height: 1.4; margin-bottom: var(--space-sm); }

/* App Viewer */
.appviewer { display: flex; flex-direction: column; height: calc(100vh - 96px); background: var(--bg); }
.appviewer-tabs { display: flex; align-items: center; gap: 2px; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.appviewer-tab { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: var(--radius-md); font-size: var(--font-sm); color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: all var(--transition-fast); flex-shrink: 0; max-width: 160px; }
.appviewer-tab:hover { background: var(--fill-tertiary); color: var(--text); }
.appviewer-tab.active { background: var(--accent); color: white; }
.appviewer-toolbar { display: flex; align-items: center; gap: var(--space-sm); padding: 6px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.appviewer-tool-name { font-size: var(--font-base); font-weight: var(--weight-semibold); white-space: nowrap; }
.appviewer-tool-url { flex: 1; font-size: var(--font-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appviewer-content { flex: 1; position: relative; overflow: hidden; }
.appviewer-iframe { width: 100%; height: 100%; border: none; background: white; }
.appviewer-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding: 40px; }
.appviewer-fallback h3 { font-size: 20px; font-weight: var(--weight-semibold); margin-bottom: var(--space-sm); }

/* ============ TEAM CHAT ============ */
.team-layout { display: flex; height: calc(100vh - 110px); overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.team-sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.team-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.team-messages { flex: 1; overflow-y: auto; padding: var(--space-md); display: flex; flex-direction: column; gap: 2px; }
.team-msg { display: flex; gap: var(--space-sm); padding: 6px 8px; border-radius: var(--radius-sm); transition: background var(--transition-fast); }
.team-msg:hover { background: var(--fill-tertiary); }
.team-msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: var(--font-base); font-weight: var(--weight-bold); margin-top: 2px; }
.team-msg-body { flex: 1; min-width: 0; }
.team-msg-name { font-size: var(--font-base); font-weight: var(--weight-semibold); }
.team-msg-time { font-size: var(--font-2xs); color: var(--text-muted); }
.team-msg-content { font-size: var(--font-md); line-height: 1.5; word-break: break-word; }
.team-mention { color: var(--accent); font-weight: var(--weight-medium); }
.team-input-area { padding: var(--space-md); border-top: 1px solid var(--border); flex-shrink: 0; }
.team-input-wrap { display: flex; align-items: flex-end; gap: var(--space-sm); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px 4px 4px 12px; }
.team-input-wrap:focus-within { border-color: var(--accent); }
.team-input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: var(--font-md); font-family: inherit; resize: none; padding: 6px 0; min-height: 24px; max-height: 120px; line-height: 1.5; }
.team-input::placeholder { color: var(--text-muted); }
.team-send-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); border: none; color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background var(--transition-fast); }
.team-send-btn:hover { background: var(--accent-hover); }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.presence-dot.online { background: var(--success); }
.presence-dot.offline { background: var(--text-muted); opacity: 0.4; }

/* Team sidebar sections */
.team-sidebar-section { padding: var(--space-sm) 0; }
.team-sidebar-section + .team-sidebar-section { border-top: 1px solid var(--border); }
.team-sidebar-title { display: flex; align-items: center; gap: 6px; padding: var(--space-xs) var(--space-md); font-size: var(--font-xs); font-weight: var(--weight-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.team-channel-item { display: flex; align-items: center; gap: 6px; padding: 6px var(--space-md); font-size: var(--font-sm); color: var(--text-secondary); cursor: pointer; border-radius: var(--radius-sm); margin: 0 var(--space-xs); transition: all var(--transition-fast); }
.team-channel-item:hover { background: var(--fill-tertiary); color: var(--text); }
.team-channel-item.active { background: var(--accent-bg); color: var(--accent); font-weight: var(--weight-semibold); }
.team-ch-hash { color: var(--text-muted); font-size: var(--font-xs); }
.team-user-item { display: flex; align-items: center; gap: 8px; padding: 5px var(--space-md); cursor: pointer; border-radius: var(--radius-sm); margin: 0 var(--space-xs); transition: background var(--transition-fast); }
.team-user-item:hover { background: var(--fill-tertiary); }

/* Team header */
.team-main-header { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); flex-shrink: 0; min-height: 44px; }
.team-channel-badge { color: var(--text-muted); display: flex; }
.team-channel-desc { font-size: var(--font-xs); color: var(--text-muted); margin-left: var(--space-sm); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-header-presence { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.team-mobile-toggle { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }

/* Team date separator */
.team-date-sep { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-sm) 0; margin: var(--space-xs) 0; }
.team-date-sep::before, .team-date-sep::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.team-date-sep span { font-size: var(--font-2xs); color: var(--text-muted); font-weight: var(--weight-medium); white-space: nowrap; }

/* Team message header with badge */
.team-msg-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.team-msg-aran .team-msg-avatar { background: var(--accent) !important; }

/* Team reactions */
.team-msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.team-reaction { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 10px; font-size: 12px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition-fast); }
.team-reaction:hover { border-color: var(--accent); }
.team-reaction.mine { background: var(--accent-bg); border-color: var(--accent); }

/* Team user picker */
.team-user-pick-btn {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); cursor: pointer;
    color: var(--text); font-size: var(--font-sm); font-weight: var(--weight-medium);
    transition: all var(--transition-fast); font-family: inherit;
}
.team-user-pick-btn:hover { border-color: var(--accent); background: var(--fill-tertiary); }

/* Team hover actions */
.team-msg-hover-actions { display: none; position: absolute; right: 4px; top: -12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 2px; box-shadow: var(--shadow-md); z-index: 5; }
.team-msg { position: relative; }
.team-msg:hover .team-msg-hover-actions { display: flex; gap: 2px; }
.team-react-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 3px 5px; border-radius: var(--radius-sm); transition: background var(--transition-fast); }
.team-react-btn:hover { background: var(--fill-tertiary); }

/* Team typing indicator */
.team-typing { padding: 0 var(--space-md); height: 20px; font-size: var(--font-xs); color: var(--text-muted); font-style: italic; opacity: 0; transition: opacity var(--transition-fast); }

/* ============ AUTODEV MODULE ============ */
.autodev-card {
    padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); margin-bottom: var(--space-sm);
    display: flex; align-items: flex-start; gap: 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.autodev-card:hover { border-color: var(--border-hover); background: var(--fill-tertiary); }
.autodev-card-body { flex: 1; min-width: 0; }
.autodev-card-title { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: 4px; flex-wrap: wrap; }
.autodev-card-title span:first-child { font-weight: var(--weight-semibold); color: var(--text); font-size: var(--font-md); }
.autodev-card-desc { font-size: var(--font-sm); color: var(--text-secondary); margin-bottom: 4px; line-height: 1.4; }
.autodev-card-meta { font-size: var(--font-2xs); color: var(--text-muted); }
.autodev-card-actions { display: flex; gap: 6px; flex-shrink: 0; align-self: center; }
.autodev-history-item {
    display: flex; align-items: center; gap: 12px; padding: 8px 12px;
    margin-bottom: 6px; background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: background var(--transition-fast);
}
.autodev-history-item:hover { background: var(--fill-tertiary); }
.autodev-history-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.autodev-history-title { flex: 1; font-size: var(--font-sm); color: var(--text); }
.autodev-history-time { font-size: var(--font-2xs); color: var(--text-muted); }
.inline-badge {
    font-size: var(--font-2xs); padding: 2px 8px; border-radius: var(--radius-full);
    font-weight: var(--weight-medium); white-space: nowrap;
}

/* ============ VEILLE MODULE ============ */
.veille-tabs {
    display: flex; gap: 0; margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}
.veille-tab {
    padding: 10px 20px; background: none; border: none;
    border-bottom: 2px solid transparent; color: var(--text-secondary);
    font-size: var(--font-md); font-weight: var(--weight-medium);
    cursor: pointer; font-family: inherit; transition: all var(--transition-fast);
}
.veille-tab:hover { color: var(--text); background: var(--fill-tertiary); }
.veille-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.veille-search-bar {
    display: flex; gap: 12px; margin-bottom: var(--space-md); flex-wrap: wrap;
}
.veille-input {
    padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: var(--font-sm);
    font-family: inherit; outline: none; transition: border-color var(--transition-fast);
}
.veille-input:focus { border-color: var(--accent); }
.tender-card {
    padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--space-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.tender-card:hover { border-color: var(--border-hover); background: var(--fill-tertiary); }
.tender-card-inner { display: flex; align-items: flex-start; gap: 12px; }
.tender-grade-badge {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-weight: var(--weight-bold); font-size: var(--font-lg);
}
.tender-card-body { flex: 1; min-width: 0; }
.tender-card-title { font-weight: var(--weight-semibold); color: var(--text); font-size: var(--font-md); margin-bottom: 4px; line-height: 1.3; }
.tender-card-info { font-size: var(--font-xs); color: var(--text-secondary); margin-bottom: 4px; }
.tender-card-deadline { font-size: var(--font-2xs); color: var(--text-muted); }
.seo-card {
    padding: var(--space-md); background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: var(--space-md);
}
.seo-card h3 { color: var(--text); margin: 0 0 12px; font-size: var(--font-lg); }
.seo-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); font-size: var(--font-sm); }
.seo-info-label { color: var(--text-muted); }
.seo-info-value { color: var(--text); }
.seo-cities { display: flex; flex-wrap: wrap; gap: 6px; }
.seo-city-tag {
    padding: 4px 10px; background: var(--accent-surface); color: var(--accent);
    border-radius: var(--radius-full); font-size: var(--font-xs);
}
.seo-form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.seo-form-group { flex: 1; min-width: 150px; }
.seo-form-label { font-size: var(--font-xs); color: var(--text-muted); display: block; margin-bottom: 4px; }
.seo-form-input {
    width: 100%; padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: var(--font-sm);
    font-family: inherit; box-sizing: border-box;
}
.seo-form-input:focus { border-color: var(--accent); outline: none; }
.faq-result-item {
    padding: 10px 14px; background: var(--surface2); border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.faq-result-item .faq-q { font-weight: var(--weight-semibold); color: var(--text); font-size: var(--font-sm); margin-bottom: 4px; }
.faq-result-item .faq-a { font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.4; }

/* ============ MODULE FORM SHARED ============ */
.module-form-input {
    width: 100%; padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: var(--font-md);
    font-family: inherit; outline: none; box-sizing: border-box;
    transition: border-color var(--transition-fast);
}
.module-form-input:focus { border-color: var(--accent); }
.module-form-label {
    font-size: var(--font-xs); color: var(--text-muted); display: block; margin-bottom: 4px;
}
.module-section-title {
    color: var(--text); margin: var(--space-lg) 0 var(--space-sm); font-size: var(--font-lg);
    font-weight: var(--weight-semibold);
}

/* ============ DASHBOARD (Untitled UI style) ============ */
.dash-quick-actions {
    display: flex; gap: var(--space-3); margin-bottom: var(--space-5);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
}
.dash-quick-actions::-webkit-scrollbar { display: none; }
.dash-quick-btn {
    display: flex; align-items: center; gap: var(--space-2); white-space: nowrap;
    padding: 8px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-secondary);
    font-size: var(--font-sm); font-weight: var(--weight-medium);
    font-family: inherit; cursor: pointer;
    transition: all var(--transition-fast); flex-shrink: 0;
}
.dash-quick-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-surface); }
.dash-quick-btn:active { transform: scale(0.97); }
.dash-quick-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-quick-btn svg { flex-shrink: 0; }

.dash-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5);
}
.dash-col { display: flex; flex-direction: column; gap: var(--space-5); }
.dash-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-apple-card); overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}
.dash-section:hover { box-shadow: var(--shadow-md); }
.dash-section-muted { opacity: 0.7; }
.dash-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
}
.dash-section-header h3 {
    margin: 0; font-size: var(--font-sm); font-weight: var(--weight-semibold);
    color: var(--text); display: flex; align-items: center; gap: var(--space-2);
}
.dash-section-header h3 svg { flex-shrink: 0; color: var(--text-muted); }
.dash-section-empty {
    padding: var(--space-8) var(--space-5); text-align: center;
    font-size: var(--font-sm); color: var(--text-muted);
}

/* Dashboard Alerts (Untitled UI banner) */
.dash-alert {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}
.dash-alert svg { flex-shrink: 0; }
.dash-alert-body { flex: 1; font-size: var(--font-sm); line-height: 1.5; }
.dash-alert-body strong { display: block; margin-bottom: 2px; font-weight: var(--weight-semibold); }
.dash-alert-body span { color: var(--text-secondary); }
.dash-alert-warning { background: var(--warning-surface); color: var(--warning); border: 1px solid var(--warning-border); }
.dash-alert-danger { background: var(--danger-surface); color: var(--danger); border: 1px solid var(--danger-border); }

/* Pipeline (Untitled UI progress bars) */
.dash-pipeline { padding: var(--space-4) var(--space-5); }
.dash-pipeline-row {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) 0; transition: background var(--transition-fast);
    border-radius: var(--radius-sm); cursor: pointer;
}
.dash-pipeline-row:hover { background: var(--fill-tertiary); margin: 0 calc(-1 * var(--space-2)); padding-left: var(--space-2); padding-right: var(--space-2); }
.dash-pipeline-label { width: 72px; font-size: var(--font-sm); color: var(--text-secondary); flex-shrink: 0; font-weight: var(--weight-medium); }
.dash-pipeline-track {
    flex: 1; height: 8px; background: var(--surface3); border-radius: var(--radius-full); overflow: hidden;
}
.dash-pipeline-fill {
    height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease;
}
.dash-pipeline-fill.warning { background: var(--warning); }
.dash-pipeline-fill.success { background: var(--success); }
.dash-pipeline-fill.danger { background: var(--danger); }
.dash-pipeline-val { width: 36px; text-align: right; font-weight: var(--weight-semibold); font-size: var(--font-sm); color: var(--text); }
.dash-pipeline-summary {
    display: flex; justify-content: space-between; padding-top: var(--space-3);
    margin-top: var(--space-2); border-top: 1px solid var(--border);
    font-size: var(--font-sm); color: var(--text-muted);
}
.dash-conv-good { color: var(--success); font-weight: var(--weight-semibold); }
.dash-conv-low { color: var(--warning); font-weight: var(--weight-semibold); }

/* Today Events (Untitled UI list rows) */
.dash-today-list { padding: var(--space-2) 0; }
.dash-today-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-5); transition: background var(--transition-fast);
    cursor: pointer;
}
.dash-today-item:hover { background: var(--fill-tertiary); }
.dash-today-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-today-time { width: 48px; font-size: var(--font-xs); color: var(--text-muted); font-weight: var(--weight-medium); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.dash-today-body { flex: 1; min-width: 0; }
.dash-today-title { font-size: var(--font-sm); color: var(--text); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-today-loc { font-size: var(--font-xs); color: var(--text-muted); margin-top: 1px; }

/* Devis List (Untitled UI table rows) */
.dash-devis-list { padding: var(--space-1) 0; }
.dash-devis-item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-5); transition: background var(--transition-fast);
    cursor: pointer;
}
.dash-devis-item:hover { background: var(--fill-tertiary); }
.dash-devis-info { flex: 1; min-width: 0; }
.dash-devis-code { font-size: var(--font-sm); font-weight: var(--weight-medium); color: var(--text); }
.dash-devis-client { font-size: var(--font-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.dash-devis-right { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.dash-devis-montant { font-size: var(--font-sm); font-weight: var(--weight-semibold); color: var(--text); font-variant-numeric: tabular-nums; }

/* Transactions List */
.dash-trans-list { padding: var(--space-1) 0; }
.dash-trans-item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-5); transition: background var(--transition-fast);
    cursor: pointer;
}
.dash-trans-item:hover { background: var(--fill-tertiary); }
.dash-trans-info { flex: 1; min-width: 0; }
.dash-trans-ref { font-size: var(--font-sm); color: var(--text); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-trans-date { font-size: var(--font-xs); color: var(--text-muted); margin-top: 1px; }
.dash-trans-montant { font-size: var(--font-sm); font-weight: var(--weight-semibold); color: var(--success); font-variant-numeric: tabular-nums; }

/* Offres Grid (Untitled UI metric chips) */
.dash-offres-grid { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5); flex-wrap: wrap; }
.dash-offre-chip {
    display: flex; flex-direction: column; align-items: center;
    padding: var(--space-3) var(--space-5); background: var(--surface2);
    border-radius: var(--radius-lg); border: 1px solid var(--border);
    min-width: 80px; transition: all var(--transition-fast); cursor: pointer;
}
.dash-offre-chip:hover { background: var(--fill-secondary); border-color: var(--border-hover); }
.dash-offre-val { font-size: var(--font-2xl); font-weight: var(--weight-semibold); line-height: 1.2; }
.dash-offre-label { font-size: var(--font-xs); color: var(--text-muted); margin-top: var(--space-1); font-weight: var(--weight-medium); }

/* IA Stats (Untitled UI key-value rows) */
.dash-ia-stats { padding: var(--space-2) 0; }
.dash-ia-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-3) var(--space-5); font-size: var(--font-sm);
}
.dash-ia-row:not(:last-child) { border-bottom: 1px solid var(--border-subtle); }
.dash-ia-row span { color: var(--text-muted); font-weight: var(--weight-medium); }
.dash-ia-row strong { color: var(--text); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

/* ============ DASHBOARD: HEALTH SCORE GAUGE ============ */
.dash-health { display: flex; align-items: center; gap: 24px; padding: 16px 20px; }
.dash-health-gauge { flex-shrink: 0; }
.dash-gauge-ring {
    width: 100px; height: 100px; border-radius: 50%; position: relative;
    background: conic-gradient(var(--gauge-color, var(--accent)) calc(var(--score, 0) * 3.6deg), var(--fill-tertiary) 0);
    display: flex; align-items: center; justify-content: center;
}
.dash-gauge-center {
    width: 76px; height: 76px; border-radius: 50%; background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dash-gauge-value { font-size: 1.5rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-gauge-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; }

/* ============ DASHBOARD: SPARKLINE ============ */
.dash-sparkline { flex: 1; min-width: 0; }
.dash-sparkline-title { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.dash-sparkline-bars { display: flex; align-items: flex-end; gap: 3px; height: 52px; }
.dash-sparkline-bar {
    flex: 1; min-width: 0; background: var(--accent); border-radius: 3px 3px 0 0;
    transition: height 0.5s ease; cursor: default; opacity: 0.7;
}
.dash-sparkline-bar:last-child { opacity: 1; }
.dash-sparkline-bar:hover { opacity: 1; }

/* ============ DASHBOARD: TEAM RANKING ============ */
.dash-team-ranking { padding: 4px 0; }
.dash-team-row {
    display: flex; align-items: center; gap: 12px; padding: 8px 16px; cursor: pointer;
    transition: background var(--transition-fast);
}
.dash-team-row:hover { background: var(--fill-tertiary); }
.dash-team-rank { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); width: 28px; text-align: center; flex-shrink: 0; }
.dash-team-info { flex: 1; min-width: 0; }
.dash-team-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-team-sub { font-size: 0.72rem; color: var(--text-muted); }
.dash-team-ca { font-size: 0.85rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ============ DASHBOARD: CHANTIERS ACTIFS ============ */
.dash-chantiers { padding: 4px 0; }
.dash-chantiers-summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 16px 12px; }
.dash-chantiers-count { font-size: 1.6rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.dash-chantiers-label { font-size: 0.82rem; color: var(--text-muted); }
.dash-chantier-row {
    display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; cursor: pointer;
    transition: background var(--transition-fast);
}
.dash-chantier-row:hover { background: var(--fill-tertiary); }
.dash-chantier-name { font-size: 0.85rem; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-chantier-status { font-size: 0.75rem; font-weight: 600; flex-shrink: 0; }

/* ============ DOCUMENT CARDS (Untitled UI) ============ */
.doc-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4);
}
.doc-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-4); cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-normal);
}
.doc-card:hover { border-color: var(--border-hover); background: var(--fill-tertiary); }
.doc-card-thumb { width: 100%; height: 100px; background: var(--surface2); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; }
.doc-card-thumb img { max-width: 100%; max-height: 100px; object-fit: cover; }
.doc-card-icon { font-size: 36px; text-align: center; margin-bottom: 8px; }
.doc-card-name { font-size: var(--font-sm); font-weight: var(--weight-semibold); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.doc-card-date { font-size: var(--font-2xs); color: var(--text-muted); margin-top: 4px; }

/* ============ OFFER CARDS (Untitled UI) ============ */
.offer-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4);
}
.offer-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-normal);
}
.offer-card:hover { border-color: var(--border-hover); background: var(--fill-tertiary); }
.offer-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.offer-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.offer-card-ref {
    display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
    font-size: var(--font-2xs); font-weight: var(--weight-semibold);
    background: var(--accent-surface); color: var(--accent); font-family: monospace;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.offer-card-title { font-weight: var(--weight-semibold); font-size: var(--font-md); color: var(--text); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-card-client { font-size: var(--font-sm); color: var(--text-secondary); margin-bottom: 4px; }
.offer-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.offer-card-type { font-size: var(--font-xs); color: var(--text-muted); }
.offer-card-date { font-size: var(--font-2xs); color: var(--text-muted); }

/* ============ OFFER DETAIL PANEL ============ */
.offer-detail-header { margin-bottom: var(--space-4); }
.offer-detail-header-top { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.offer-detail-title { margin: 0; font-size: var(--font-lg); font-weight: var(--weight-semibold); color: var(--text); }
.offer-detail-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.offer-detail-section { margin-bottom: var(--space-4); }
.offer-detail-section-title {
    font-size: var(--font-xs); font-weight: var(--weight-semibold);
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: var(--space-2);
}
.offer-section-row {
    border-bottom: 1px solid var(--border); padding: var(--space-2) 0;
}
.offer-section-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; padding: var(--space-1) 0;
}
.offer-section-name { font-size: var(--font-sm); font-weight: var(--weight-medium); color: var(--text); display: flex; align-items: center; gap: var(--space-2); }
.offer-section-arrow { font-size: var(--font-xs); color: var(--text-muted); transition: transform 0.2s; }
.offer-section-arrow.expanded { transform: rotate(180deg); }
.offer-section-content { padding: var(--space-3) 0; font-size: var(--font-sm); color: var(--text-secondary); }
.offer-highlight-box {
    margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4);
    background: var(--accent-surface); border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}
.offer-highlight-box strong { color: var(--accent); font-weight: var(--weight-semibold); }
.offer-highlight-box .value { font-size: var(--font-lg); font-weight: var(--weight-semibold); color: var(--text); margin-top: var(--space-1); }
.offer-gen-btn {
    padding: var(--space-1) var(--space-3); background: var(--surface2);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: var(--font-xs);
    cursor: pointer; font-family: inherit; display: inline-flex;
    align-items: center; gap: var(--space-1); transition: all var(--transition-fast);
}
.offer-gen-btn:hover { border-color: var(--accent); color: var(--accent); }
.offer-gen-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ PLANNING NAV & MOBILE ============ */
.plan-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-md);
}
.plan-nav-label {
    font-weight: var(--weight-semibold); font-size: var(--font-md); color: var(--text);
}
.plan-mobile-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.plan-mobile-label {
    font-weight: var(--weight-semibold); font-size: var(--font-md);
}
.plan-mobile-label.today { color: var(--accent); }
.plan-mobile-day-container {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-md); min-height: 200px;
}
.plan-mobile-event { padding: var(--space-sm) var(--space-md); }
.plan-mobile-event .plan-event-title { font-size: var(--font-md); }
.plan-mobile-empty {
    padding: var(--space-xl); text-align: center;
    color: var(--text-muted); font-size: var(--font-base);
}
.plan-today-badge {
    background: var(--accent); color: white; border-radius: var(--radius-full);
    width: 28px; height: 28px; display: inline-flex; align-items: center;
    justify-content: center;
}
.plan-today-badge .plan-day-num { color: white; }

/* ============ SHARED LAYOUT ============ */
.module-layout-split {
    display: flex; gap: var(--space-4); align-items: flex-start; position: relative;
}
.module-layout-main { flex: 1; min-width: 0; }

/* ============ THEME TRANSITION ============ */
.theme-transitioning, .theme-transitioning * { transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s !important; }

/* ============ LOAD MORE ============ */
.load-more-btn {
    display: block; width: 100%; padding: var(--space-md);
    background: var(--surface2); border: 1px dashed var(--border);
    border-radius: var(--radius-md); color: var(--text-secondary);
    font-size: var(--font-base); cursor: pointer; transition: all var(--transition-fast);
    text-align: center; margin-top: var(--space-md);
}
.load-more-btn:hover { border-color: var(--accent); color: var(--text); }

/* ============================================================ */
/* ============ RESPONSIVE: MOBILE < 768px ============ */
/* ============================================================ */
@media (max-width: 768px) {
    /* Show bottom nav, hide rail on mobile */
    .bottom-nav { display: flex; }

    .app-rail { display: none; }

    .context-panel {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: 0;
        z-index: var(--z-sidebar);
        border-radius: 0;
    }
    .context-panel.open { width: min(280px, 80vw); }

    .hamburger { display: flex; }

    /* Adjust main for bottom nav */
    .main-content { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom)); }

    /* Module content */
    .module-container { padding: var(--space-md); }
    .module-container.active { padding-bottom: calc(var(--space-md) + var(--bottomnav-h)); }

    /* Stat grid */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
    .cmp-stat-card { padding: var(--space-sm); }
    .stat-value { font-size: var(--font-xl); }
    .stat-icon { width: 32px; height: 32px; font-size: 16px; }

    /* Tables become cards */
    .data-table { border: none; background: none; }
    .data-table thead { display: none; }
    .data-table tbody tr {
        display: block; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--radius-md);
        margin-bottom: var(--space-sm); padding: var(--space-md);
    }
    .data-table tbody td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 4px 0; border-bottom: none; gap: var(--space-sm);
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: var(--font-xs); font-weight: var(--weight-semibold);
        color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0;
    }

    /* Kanban horizontal scroll */
    .kanban-column { min-width: 260px; }

    /* Page header */
    .cmp-page-header { flex-direction: column; align-items: flex-start; }
    .cmp-page-header h2 { font-size: var(--font-xl); }

    /* Detail panel full-width */
    .cmp-detail-panel { border-radius: 0; }
    .detail-row { flex-direction: column; gap: 2px; }
    .detail-row .label { min-width: 0; }

    /* Team sidebar */
    .team-sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        z-index: var(--z-max); transform: translateX(-100%);
        transition: transform var(--transition-spring);
        width: 260px; background: var(--bg);
    }
    .team-sidebar.mobile-open { transform: translateX(0); }
    .team-layout { border: none; border-radius: 0; height: calc(100vh - 100px); }
    .team-mobile-toggle { display: flex; }

    /* Dashboard mobile */
    .dash-grid { grid-template-columns: 1fr; }
    .dash-quick-actions { gap: 6px; }
    .dash-quick-btn { padding: 6px 12px; font-size: var(--font-xs); }
    .dash-pipeline-label { width: 60px; }

    /* Documents / Offers mobile */
    .doc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .doc-card { padding: 12px; }
    .offer-grid { grid-template-columns: 1fr; }
    .module-layout-split { flex-direction: column; }

    /* Autodev / Veille mobile */
    .autodev-card { padding: 10px 12px; }
    .autodev-card-actions { flex-direction: column; gap: 4px; }
    .veille-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .veille-search-bar { flex-direction: column; }
    .veille-input { width: 100% !important; min-width: 0 !important; }
    .seo-form-row { flex-direction: column; }
    .seo-info-grid { grid-template-columns: 1fr; }
    .tender-card-inner { flex-direction: column; gap: 8px; }

    /* Apps */
    .apps-grid { grid-template-columns: 1fr; }

    /* App Viewer */
    .appviewer { height: calc(100vh - 80px); padding-bottom: var(--safe-bottom); }
    .appviewer-tool-url { display: none; }

    /* Task indicator */
    .task-indicator { bottom: calc(70px + var(--bottomnav-h)); }

    /* Toast position */
    #aran-toast-container { top: auto; bottom: calc(var(--bottomnav-h) + var(--space-md)); left: var(--space-md); right: var(--space-md); max-width: none; }

    /* CRM module */
    .crm-pipeline-grid { grid-template-columns: 1fr !important; }
    .crm-notes-list { gap: 8px; }
    .client-fiche { padding: 0; }
    .client-section { padding: 14px; margin-bottom: 10px; }

    /* Finance / Factures */
    .finance-grid, .facture-grid { grid-template-columns: 1fr !important; }
    .finance-summary { flex-direction: column; gap: 8px; }

    /* Notifications push row */
    .notif-push-row { flex-direction: column; gap: 8px; text-align: center; }

    /* Email diagnostics */
    .email-diagnostics-content { padding: 0 !important; }

    /* Module header */
    .module-header { flex-direction: column; align-items: flex-start !important; gap: 8px; }
    .module-header h2 { font-size: 1.1rem; }

    /* Offline banner */
    .offline-banner { font-size: 0.75rem; padding: 6px 12px; }

    /* Rapport module */
    .rapport-module { padding: 0; }

    /* Diagrammes */
    .diagram-type-btn { padding: 4px 10px; font-size: 0.75rem; }

    /* Webhook items */
    .webhook-item { padding: 12px; }

    /* Planning */
    .planning-grid { grid-template-columns: 1fr !important; }

    /* Audit tabs scroll */
    .audit-tabs { -webkit-overflow-scrolling: touch; }
    .audit-tab { padding: 6px 12px; font-size: 0.8rem; }

    /* Estimations */
    .estimation-form { grid-template-columns: 1fr !important; }
}

/* ============ SMALL PHONES < 480px ============ */
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .cmp-page-header h2 { font-size: var(--font-lg); }
    .topbar { padding: 0 var(--space-sm); }
    .kanban-column { min-width: 240px; }
}

/* ============ WIDE DESKTOP > 1280px ============ */
@media (min-width: 1280px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ MODULE CONTENT (SPA compat) ============ */
.module-content { flex: 1; overflow-y: auto; padding: var(--space-lg); background: var(--bg); }
.module-content.hidden { display: none; }

/* ============ CONTEXT PANEL EXTRAS ============ */
.new-chat-btn {
    width: calc(100% - var(--space-4)); margin: 0 var(--space-2) var(--space-2); padding: var(--space-2) var(--space-3);
    background: var(--patrimoine); color: white; border: none;
    border-radius: var(--radius-md); font-size: var(--font-sm);
    font-weight: var(--weight-semibold); cursor: pointer;
    display: flex; align-items: center; gap: var(--space-2);
    transition: all var(--transition-fast); font-family: inherit;
}
.new-chat-btn:hover { background: var(--patrimoine-hover); }
.new-chat-btn:active { transform: scale(0.97); }
.session-group-label { font-size: var(--font-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: var(--space-sm) 0 var(--space-xs); font-weight: var(--weight-semibold); }
.session-item {
    padding: 10px 14px; background: transparent; border-radius: var(--radius-md);
    font-size: var(--font-sm); margin-bottom: 2px; cursor: pointer;
    transition: all var(--transition-normal); position: relative; overflow: hidden;
    border-left: 3px solid transparent;
}
.session-item:hover { background: var(--fill-tertiary); }
.session-item.active { background: var(--accent-surface); border-left-color: var(--accent); }
.session-item .session-preview { font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-item .session-meta { font-size: var(--font-2xs); color: var(--text-muted); margin-top: 2px; display: flex; justify-content: space-between; }
.session-item .session-actions {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition-fast);
}
.session-item:hover .session-actions { opacity: 1; }
@media (hover: none) { .session-item .session-actions { opacity: 1; } }
.session-delete-btn, .session-export-btn, .session-pin-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: var(--space-1); border-radius: var(--radius-xs); font-size: var(--font-sm);
    display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast);
}
.session-delete-btn:hover { background: var(--danger-surface); color: var(--danger); }
.session-export-btn:hover { background: var(--fill-tertiary); color: var(--text); }
.session-pin-btn:hover { color: var(--warning); }
.session-pin-btn.pinned { color: var(--warning); }
.export-dropdown {
    display: none; position: absolute; right: 0; top: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); z-index: var(--z-sidebar);
    box-shadow: var(--shadow-lg); min-width: 130px; overflow: hidden;
}
.export-dropdown.visible { display: block; }
.export-dropdown button {
    display: block; width: 100%; padding: 8px 12px; text-align: left;
    background: none; border: none; color: var(--text); font-size: var(--font-sm);
    cursor: pointer; font-family: inherit;
}
.export-dropdown button:hover { background: var(--fill-tertiary); }
.search-result-item {
    padding: 8px 10px; background: var(--surface2); border-radius: var(--radius-sm);
    font-size: var(--font-sm); margin-bottom: 3px; cursor: pointer; transition: background var(--transition-fast);
}
.search-result-item:hover { background: var(--fill-secondary); }
.search-snippet { color: var(--text-secondary); font-size: var(--font-xs); margin-top: 2px; }
.search-snippet mark { background: var(--accent-glow); color: var(--text); border-radius: 2px; padding: 0 2px; }
.quick-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); margin-bottom: var(--space-2); }
.quick-action-btn {
    padding: var(--space-2) var(--space-2); background: var(--surface2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: var(--font-xs); cursor: pointer;
    transition: all var(--transition-fast); font-family: inherit;
    display: flex; align-items: center; gap: var(--space-1); text-align: left;
}
.quick-action-btn:hover { border-color: var(--accent); color: var(--text); background: var(--fill-tertiary); }
.sidebar-task-mini {
    padding: 6px 8px; background: var(--surface2); border-radius: var(--radius-sm);
    font-size: var(--font-xs); margin-bottom: 3px; border-left: 3px solid var(--accent);
}
.sidebar-task-mini .task-mini-name { font-weight: var(--weight-medium); color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-task-mini .task-mini-bar { height: 3px; background: var(--surface3); border-radius: 2px; overflow: hidden; }
.sidebar-task-mini .task-mini-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* ============ CHAT VIEW ============ */
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; position: relative; }
.view.active { display: flex; }

.messages {
    flex: 1; overflow-y: auto; padding: var(--space-md) var(--space-md) var(--space-sm);
    display: flex; flex-direction: column; gap: 12px;
    scroll-behavior: smooth; overscroll-behavior: contain;
}
.message { max-width: 820px; width: 100%; margin: 0 auto; padding: var(--space-2) 0; position: relative; animation: msgAppear 0.3s ease-out both; }
@keyframes msgAppear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message.user { display: flex; justify-content: flex-end; }
.message.user .message-content {
    background: var(--user-bg); border: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl); max-width: 80%;
    box-shadow: var(--shadow-xs);
}
.message.assistant { display: flex; gap: 12px; align-items: flex-start; }
.message-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--font-sm); font-weight: var(--weight-bold); margin-top: 2px;
}
.message.assistant .message-avatar { background: transparent; overflow: hidden; }
.msg-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.message.user .message-avatar { display: none; }
.message-body { flex: 1; min-width: 0; }
.message-content { padding: 10px 14px; border-radius: var(--radius-xl); font-size: var(--font-md); line-height: 1.75; overflow-wrap: break-word; word-break: break-word; letter-spacing: 0.01em; }
.message.assistant .message-content { background: transparent; padding: 4px 0; border: none; }
.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: var(--accent-light); font-weight: var(--weight-semibold); }
.message-content ul, .message-content ol { padding-left: 20px; margin: 8px 0; }
.message-content li { margin-bottom: 4px; }
.message-content code { background: var(--surface2); padding: 2px 7px; border-radius: var(--radius-sm); font-size: 0.9em; font-family: var(--font-mono); border: 1px solid var(--border-subtle); }
.message-content pre { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin: 10px 0; overflow-x: auto; font-size: var(--font-base); line-height: 1.6; box-shadow: var(--shadow-inset-subtle); }
.message-content pre code { background: none; padding: 0; border: none; }
/* Generated images */
.gen-image-wrap { margin: 10px 0; text-align: center; }
.gen-image { max-width: 100%; max-height: 480px; border-radius: var(--radius-md); cursor: pointer; transition: transform var(--transition-normal); box-shadow: var(--shadow-md); }
.gen-image:hover { transform: scale(1.02); }
.gen-image-caption { display: block; font-size: var(--font-xs); color: var(--text-muted); margin-top: 4px; }
/* Generated videos */
.gen-video-wrap { margin: 10px 0; text-align: center; }
.gen-video { max-width: 100%; max-height: 480px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.message-actions { display: flex; gap: var(--space-1); margin-top: var(--space-1); opacity: 0.4; transition: opacity var(--transition-normal); }
.message:hover .message-actions, .message-actions:focus-within { opacity: 1; }
@media (hover: none) { .message-actions { opacity: 0.7; } }
/* Code block copy button */
pre { position: relative; }
pre .code-copy-btn {
    position: absolute; top: 6px; right: 6px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; padding: 3px 8px;
    font-size: var(--font-2xs); display: flex; align-items: center; gap: 4px; opacity: 0;
    transition: all var(--transition-fast); font-family: inherit;
}
pre:hover .code-copy-btn { opacity: 1; }
pre .code-copy-btn:hover { background: var(--fill-tertiary); color: var(--text); border-color: var(--accent); }
pre .code-copy-btn.copied { color: var(--success); border-color: var(--success); }
.msg-action-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); font-size: var(--font-sm);
    display: flex; align-items: center; gap: var(--space-1); transition: all var(--transition-fast); font-family: inherit;
}
.msg-action-btn:hover { background: var(--fill-tertiary); color: var(--text); }
.msg-action-btn.copied { color: var(--success); }
.msg-action-btn.feedback-up.active { color: var(--success); }
.msg-action-btn.feedback-down.active { color: var(--danger); }
.message-meta { font-size: var(--font-xs); color: var(--text-muted); margin-top: 4px; cursor: default; }
.message-meta .meta-detail { display: none; margin-top: 2px; font-size: var(--font-2xs); color: var(--text-muted); }
.message-meta:hover .meta-detail { display: block; }
.message-time { font-size: var(--font-2xs); color: var(--text-muted); margin-top: 2px; }
.message.user .message-time { text-align: right; }
.message.error .message-content { border-left: 3px solid var(--danger); background: var(--danger-surface); }
.retry-btn { margin-top: 8px; padding: 6px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); font-size: var(--font-sm); cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; transition: all var(--transition-fast); }
.retry-btn:hover { border-color: var(--accent); color: var(--text); background: var(--accent-surface); transform: translateY(-1px); }
.error-detail { margin-top: 4px; }
.error-code { display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); background: var(--danger-surface, rgba(239,68,68,0.1)); color: var(--danger); font-size: var(--font-2xs); font-family: var(--font-mono, monospace); font-weight: 600; }
.subagent-badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--font-xs); color: var(--accent); background: var(--surface2); padding: 2px 8px; border-radius: var(--radius-full); margin-bottom: 4px; }
.agent-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.agent-action-tag { font-size: var(--font-2xs); background: var(--surface2); padding: 1px 6px; border-radius: 4px; color: var(--text-secondary); }
.changes-list { margin-top: 4px; font-size: var(--font-xs); }
.change-item { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.change-item.success { color: var(--success); }
.change-item.error { color: var(--danger); }
.change-item.blocked { color: var(--warning); }
.md-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: var(--font-base); }
.md-table th { background: var(--surface2); padding: 6px 10px; text-align: left; font-weight: var(--weight-semibold); border-bottom: 2px solid var(--border); }
.md-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.md-table tr:hover td { background: var(--fill-tertiary); }

/* Streaming cursor */
.message-content.streaming::after {
    content: ''; display: inline-block; width: 2px; height: 16px;
    background: var(--accent); margin-left: 2px; vertical-align: text-bottom;
    animation: blink-cursor 1s step-end infinite;
}
@keyframes blink-cursor { 0%,100%{opacity:1} 50%{opacity:0} }

/* Typing indicator */
.typing-indicator { display: none; max-width: 820px; width: 100%; margin: 0 auto; padding: 0 0 8px; }
.typing-indicator.visible { display: flex; }
.typing-dots { display: flex; gap: 4px; padding: 12px 16px; margin-left: 40px; }
.typing-dots span { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-4px);opacity:1} }

/* Scroll-to-bottom */
.scroll-bottom-btn {
    position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%) scale(0.9);
    width: 36px; height: 36px; border-radius: 50%; background: var(--surface2);
    border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer;
    display: none; align-items: center; justify-content: center; font-size: 16px;
    z-index: var(--z-sticky); box-shadow: var(--shadow-md); transition: all var(--transition-normal);

}
.scroll-bottom-btn:hover { background: var(--fill-secondary); border-color: var(--border-hover); }
.scroll-bottom-btn.visible { display: flex; transform: translateX(-50%) scale(1); }

/* ============ INPUT AREA ============ */
.input-area { padding: 8px 12px; padding-bottom: calc(12px + var(--safe-bottom)); flex-shrink: 0; position: relative; }
.input-area::before { content: ''; position: absolute; top: -24px; left: 0; right: 0; height: 24px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }
.input-container { max-width: 820px; margin: 0 auto; }
.input-hint {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 3px 0 0; font-size: 10px; color: var(--text-muted); opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.input-hint:hover { opacity: 0.8; }
.input-hint kbd {
    display: inline-block; padding: 0 4px; border-radius: 3px;
    background: var(--fill-tertiary); border: 1px solid var(--border-subtle);
    font-size: 9px; font-family: inherit; line-height: 1.6;
}
.input-hint-sep { color: var(--border); }
@media (max-width: 600px) { .input-hint { display: none; } }
.upload-preview {
    display: none; padding: 6px 8px; margin-bottom: 8px;
    border-radius: var(--radius-md); font-size: var(--font-sm);
    color: var(--text-secondary);
}
.upload-preview.active { display: block; }
.upload-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.upload-chip {
    position: relative; display: flex; align-items: center; gap: var(--space-1);
    padding: var(--space-1) var(--space-3); background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-full); font-size: var(--font-xs); color: var(--text-secondary);
    max-width: 220px; overflow: hidden; transition: border-color var(--transition-fast);
}
.upload-chip.ready { border-color: var(--success); }
.upload-chip.ready .chip-status { color: var(--success); font-weight: 600; }
.upload-chip.uploading { opacity: 0.75; }
.upload-chip .chip-thumb { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.upload-chip .chip-icon { font-size: 16px; flex-shrink: 0; }
.upload-chip .chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.upload-chip .chip-size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.upload-chip .chip-status { color: var(--accent); font-size: 11px; white-space: nowrap; }
.upload-chip .chip-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0 2px; line-height: 1; flex-shrink: 0; }
.upload-chip .chip-remove:hover { color: var(--danger); }
.upload-chip .chip-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--accent); border-radius: 0 0 20px 20px; transition: width 0.2s ease; width: 0; }
.input-pill {
    display: flex; flex-direction: column; gap: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 24px; padding: 12px 14px 8px;
    transition: border-color var(--transition-normal), box-shadow var(--transition-slow);
    box-shadow: var(--shadow-sm);
}
.input-pill:focus-within { border-color: rgba(190, 55, 52, 0.30); box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-glow); }
.input-actions { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; }
.input-actions-left { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.toolbar-btn {
    width: 32px; height: 32px; background: transparent; border: none;
    color: var(--text-muted); cursor: pointer; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    transition: color var(--transition-icon), background var(--transition-fast);
}
.toolbar-btn:hover { background: var(--fill-tertiary); color: var(--text); }
.toolbar-btn.active { color: var(--accent); background: var(--accent-surface); }
.input-field {
    width: 100%; background: transparent; border: none;
    padding: 0 var(--space-1); color: var(--text); font-size: var(--font-md);
    font-family: inherit; resize: none; min-height: 24px; max-height: 150px;
    outline: none; line-height: 1.5;
}
.input-field::placeholder { color: var(--text-placeholder); }
.send-btn {
    width: 34px; height: 34px; background: var(--accent);
    border: none; border-radius: var(--radius-md); color: var(--text-on-accent); font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all var(--transition-normal);
    box-shadow: 0 2px 8px var(--accent-glow);
}
.send-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }
.send-btn:active { transform: scale(0.93) translateY(0); box-shadow: none; }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }
.send-btn svg { width: 18px; height: 18px; }

/* Subagent selector */
.subagent-selector { position: relative; flex-shrink: 0; }
.subagent-current {
    display: flex; align-items: center; gap: 4px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-full); padding: 4px 10px; cursor: pointer;
    font-size: var(--font-sm); color: var(--text-secondary);
    transition: all var(--transition-fast); white-space: nowrap;
}
.subagent-current:hover { border-color: var(--accent); color: var(--text); }
.subagent-dropdown {
    position: absolute; bottom: calc(100% + var(--space-2)); left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: var(--space-1);
    min-width: 200px; max-height: 320px; overflow-y: auto;
    box-shadow: var(--shadow-xl); z-index: var(--z-dropdown);
}
.subagent-dropdown.hidden { display: none; }
.subagent-option {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
    cursor: pointer; font-size: var(--font-sm); color: var(--text-secondary);
    transition: all var(--transition-fast); border: none; background: none;
    width: 100%; text-align: left; font-family: inherit;
}
.subagent-option:hover { background: var(--fill-tertiary); color: var(--text); }
.subagent-option.active { background: var(--accent); color: white; }

/* Model selector */
.model-selector { position: relative; flex-shrink: 0; }
.model-current {
    display: flex; align-items: center; gap: 4px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-full); padding: 4px 10px; cursor: pointer;
    font-size: var(--font-xs); color: var(--text-muted);
    transition: all var(--transition-fast); white-space: nowrap;
}
.model-current:hover { border-color: var(--accent); color: var(--text); }
.model-dropdown {
    position: absolute; bottom: calc(100% + var(--space-2)); left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: var(--space-1);
    min-width: 180px; max-height: 320px; overflow-y: auto;
    box-shadow: var(--shadow-xl); z-index: var(--z-dropdown);
}
.model-dropdown.hidden { display: none; }
.model-option {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
    cursor: pointer; font-size: var(--font-sm); color: var(--text-secondary);
    transition: all var(--transition-fast); border: none; background: none;
    width: 100%; text-align: left; font-family: inherit;
}
.model-option:hover { background: var(--fill-tertiary); color: var(--text); }
.model-option.active { background: var(--accent); color: white; }

/* Drop overlay */
.drop-overlay {
    display: none; position: fixed; inset: 0; z-index: var(--z-max, 100);
    background: var(--accent-glow); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    border: 3px dashed var(--accent);
}
.drop-overlay.active { display: flex; }
.drop-overlay span {
    font-size: var(--font-xl); color: var(--accent); font-weight: var(--weight-semibold);
    background: var(--surface); padding: 16px 32px;
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
}

/* ============ WELCOME SCREEN (Luxury hero) ============ */
.welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: var(--space-10) var(--space-5);
    background: var(--gradient-mesh);
    position: relative;
}
.welcome::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 20%, var(--accent-surface) 0%, transparent 50%);
    pointer-events: none;
}
.welcome-logo {
    width: 88px; height: 88px;
    border-radius: var(--radius-2xl);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: var(--space-6);
    overflow: hidden;
    box-shadow: var(--shadow-glow-gold), var(--shadow-lg);
    border: 2px solid rgba(190, 55, 52, 0.20);
    position: relative; z-index: 1;
}
.welcome-avatar-img {
    width: 100%; height: 100%; object-fit: cover;
}
.welcome h2 {
    font-size: var(--font-display-sm); margin-bottom: var(--space-3);
    font-weight: var(--weight-bold); letter-spacing: var(--letter-spacing-tight);
    background: var(--gradient-gold-text); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; position: relative; z-index: 1;
}
.welcome p {
    color: var(--text-secondary); max-width: 460px;
    line-height: var(--line-height-relaxed); margin-bottom: var(--space-8);
    font-size: var(--font-md); position: relative; z-index: 1;
}
.suggestions {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3);
    max-width: 520px; width: 100%; position: relative; z-index: 1;
}
.suggestion {
    padding: var(--space-3) var(--space-4); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-apple-card);
    color: var(--text-secondary); font-size: var(--font-sm); cursor: pointer;
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1); text-align: left;
    box-shadow: var(--shadow-sm); line-height: var(--line-height-normal);
}
.suggestion:hover {
    border-color: var(--accent); color: var(--text);
    background: var(--accent-surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

/* ============ CAMERA PiP ============ */
.camera-pip-chat {
    display: none; position: absolute; bottom: 80px; right: 16px;
    width: 160px; height: 120px; border-radius: var(--radius-md);
    overflow: hidden; border: 2px solid var(--accent); z-index: var(--z-sticky);
    box-shadow: var(--shadow-lg); background: var(--surface-dark, #000);
}
.camera-pip-chat.active { display: block; }
.camera-pip-chat video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera-pip-close {
    position: absolute; top: var(--space-1); right: var(--space-1);
    width: 24px; height: 24px; background: var(--surface-dark); border: none;
    color: white; font-size: var(--font-sm); border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.8;
}
.camera-pip-close:hover { opacity: 1; }
.camera-pip-close:hover { background: var(--danger); }
.camera-pip-chat .cam-indicator {
    position: absolute; top: 6px; left: 6px;
    width: 8px; height: 8px; background: var(--danger);
    border-radius: 50%; animation: pulse 1.5s infinite;
}

/* ============ PRIVATE MODE ============ */
.private-badge {
    display: none; align-items: center; gap: var(--space-1);
    background: var(--warning-surface); color: var(--text);
    border: 1px solid var(--warning-border);
    font-size: var(--font-xs); font-weight: var(--weight-semibold);
    padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
}
.private-badge.visible { display: inline-flex; }

/* ============ ARTIFACT PANEL ============ */
.artifact-resize {
    width: 0; cursor: col-resize; background: transparent;
    flex-shrink: 0; position: relative; z-index: var(--z-dropdown);
    transition: width var(--transition-normal);
}
.artifact-resize.active { width: 4px; background: var(--border); }
.artifact-resize.active:hover { background: var(--accent); }
.artifact-panel {
    width: 0; overflow: hidden; flex-shrink: 0;
    background: var(--surface); border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    transition: width var(--transition-spring);
}
.artifact-panel.open { width: 45%; min-width: 360px; max-width: 600px; }
.artifact-panel.fullscreen { position: fixed; inset: 0; z-index: var(--z-modal); width: 100% !important; max-width: 100% !important; min-width: 0 !important; border: none; }
.artifact-header {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.artifact-title { flex: 1; font-size: var(--font-base); font-weight: var(--weight-semibold); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-type-badge { font-size: var(--font-2xs); padding: 2px 8px; border-radius: var(--radius-full); background: var(--accent); color: white; font-weight: var(--weight-semibold); text-transform: uppercase; }
.artifact-actions { display: flex; gap: var(--space-1); flex-shrink: 0; }
.artifact-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); font-size: var(--font-sm); font-family: inherit; transition: all var(--transition-fast); }
.artifact-actions button:hover { background: var(--fill-tertiary); color: var(--text); }
.artifact-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.artifact-tabs:empty { display: none; }
.artifact-tab { padding: 6px 14px; font-size: var(--font-sm); color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: all var(--transition-fast); background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.artifact-tab:hover { color: var(--text); background: var(--fill-tertiary); }
.artifact-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.artifact-body { flex: 1; overflow: auto; padding: 0; }
.artifact-body pre { margin: 0; padding: 16px; font-size: var(--font-base); line-height: 1.6; background: var(--surface); overflow-x: auto; }
.artifact-body pre code { font-family: var(--font-mono); }
.artifact-body iframe { width: 100%; height: 100%; border: none; background: white; }
.artifact-body .artifact-svg { display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 200px; }
.artifact-body .artifact-svg svg { max-width: 100%; height: auto; }
.artifact-body .artifact-mermaid { padding: 20px; display: flex; align-items: center; justify-content: center; }
.artifact-body .artifact-table-wrap { padding: 16px; overflow-x: auto; }

/* ============ CONFIRM MODAL ============ */
.confirm-modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: var(--z-modal);
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
}
.confirm-modal-backdrop.visible { display: flex; }
.confirm-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-lg);
    max-width: 360px; width: 90%; text-align: center;
    box-shadow: var(--shadow-xl);
}
.confirm-modal h3 { font-size: var(--font-lg); margin-bottom: var(--space-sm); }
.confirm-modal p { font-size: var(--font-base); color: var(--text-secondary); margin-bottom: var(--space-lg); }
.confirm-modal-actions { display: flex; gap: var(--space-sm); justify-content: center; }
.confirm-modal-actions button {
    padding: var(--space-2) var(--space-5); border-radius: var(--radius-md); font-size: var(--font-sm);
    cursor: pointer; font-family: inherit; font-weight: var(--weight-medium); border: 1px solid var(--border);
    transition: all var(--transition-fast);
}
.confirm-modal-actions .cancel-btn { background: var(--surface2); color: var(--text); }
.confirm-modal-actions .cancel-btn:hover { background: var(--fill-tertiary); }
.confirm-modal-actions .danger-btn { background: var(--danger); color: white; border-color: var(--danger); }
.confirm-modal-actions .danger-btn:hover { opacity: 0.9; }

/* ============ LIGHT THEME CHAT OVERRIDES ============ */
:root.light .message-content code { background: var(--surface3); }
:root.light .message-content pre { background: var(--surface2); border-color: var(--border); }
:root.light .welcome-logo { box-shadow: var(--shadow-lg); }
:root.light .md-table th { background: var(--surface3); }
:root.light .md-table td { border-color: var(--border); }
:root.light .md-table tr:hover td { background: var(--fill-tertiary); }
:root.light .artifact-body pre { background: var(--surface); }
:root.light .hljs { background: var(--surface) !important; }

/* ============ CHAT MOBILE ============ */
@media (max-width: 768px) {
    .messages { padding: var(--space-3) var(--space-3) var(--space-2); }
    .message-content { font-size: var(--font-md); padding: var(--space-2) var(--space-3); }
    .message.user .message-content { max-width: 90%; }
    .input-area { padding: var(--space-1) var(--space-3); padding-bottom: calc(var(--space-1) + var(--bottomnav-h) + var(--safe-bottom)); }
    .camera-pip-chat { width: 120px; height: 90px; bottom: 70px; right: var(--space-3); }
    .welcome { padding: var(--space-6) var(--space-4); }
    .welcome-logo { width: 48px; height: 48px; font-size: var(--font-xl); }
    .welcome h2 { font-size: var(--font-xl); }
    .welcome p { font-size: var(--font-sm); }
    .suggestions { grid-template-columns: 1fr; }
    .suggestion { font-size: var(--font-sm); padding: var(--space-2) var(--space-3); }
    .cmp-modal-backdrop { background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }
    .scroll-bottom-btn { bottom: 75px; }
    .artifact-panel.open { position: fixed; inset: 0; z-index: var(--z-overlay); width: 100% !important; max-width: 100% !important; min-width: 0 !important; border: none; }
    .artifact-resize { display: none; }
    .subagent-current { font-size: var(--font-xs); padding: var(--space-1) var(--space-2); }
    .subagent-dropdown { min-width: 180px; max-height: min(320px, 50vh); }
    .model-dropdown { max-height: min(280px, 50vh); }
}

/* ============ PRINT ============ */
@media print {
    .app-rail, .context-panel, .bottom-nav, .topbar, .hamburger { display: none !important; }
    .module-content, .module-container { overflow: visible; }
    body { background: white !important; color: black !important; }
    /* Presentation print layout */
    .pres-overlay { position: static !important; background: white !important; }
    .pres-topbar { background: white !important; color: black !important; border-bottom: 2px solid #BE3734 !important; }
    .pres-close, #presRefreshInfo { display: none !important; }
    .pres-logo { color: black !important; }
    .pres-date { color: #333 !important; }
    .pres-content { overflow: visible !important; max-width: none !important; }
    .pres-kpi { background: white !important; border: 1px solid #ddd !important; color: black !important; page-break-inside: avoid; }
    .pres-kpi-value { color: black !important; }
    .pres-kpi-label { color: #555 !important; }
    .pres-panel { background: white !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
    .pres-panel-title { color: black !important; }
    .pres-main-row, .pres-bottom-row { page-break-inside: avoid; }
    .pres-funnel-label, .pres-funnel-amount, .pres-list-name, .pres-list-value { color: black !important; }
    .pres-rank-name, .pres-rank-value, .pres-rank-count { color: #333 !important; }
    .pres-big-num { color: black !important; }
    .pres-big-label, .pres-insight { color: #555 !important; }
    .pres-activity-text { color: black !important; }
    .pres-activity-date { color: #666 !important; }
    /* Rapport print */
    .rapport-module { overflow: visible !important; }
    .data-table { page-break-inside: avoid; }
}

/* Artifact link button in chat messages */
/* Artifact inline card in chat */
.artifact-link-btn {
    display: inline-flex; align-items: center; gap: var(--space-1);
    padding: var(--space-1) var(--space-3); margin-top: var(--space-1);
    background: var(--accent-surface); border: 1px solid var(--accent);
    border-radius: var(--radius-full); color: var(--accent);
    font-size: var(--font-sm); cursor: pointer;
    transition: all var(--transition-fast);
}
.artifact-link-btn:hover { background: var(--accent); color: var(--text-on-accent); }
.artifact-preview-card {
    display: flex; flex-direction: column; gap: 0;
    margin-top: var(--space-2); border: 1px solid var(--border);
    border-radius: var(--radius-apple-card); overflow: hidden;
    cursor: pointer; transition: all var(--transition-fast);
    max-width: 360px; background: var(--surface2);
}
.artifact-preview-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.artifact-preview-card-header {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
}
.artifact-preview-card-icon { font-size: 16px; flex-shrink: 0; }
.artifact-preview-card-title { font-size: var(--font-sm); font-weight: 600; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-preview-card-badge { font-size: var(--font-2xs); padding: 1px 6px; border-radius: var(--radius-sm); background: var(--accent-surface); color: var(--accent); font-weight: 600; text-transform: uppercase; }
.artifact-preview-card-body {
    padding: var(--space-2) var(--space-3); font-size: var(--font-xs);
    color: var(--text-muted); line-height: 1.5;
    max-height: 60px; overflow: hidden; position: relative;
    font-family: var(--font-mono, monospace);
}
.artifact-preview-card-body::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 24px; background: linear-gradient(transparent, var(--surface2));
}
.artifact-preview-card-footer {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-1) var(--space-3); border-top: 1px solid var(--border-subtle);
    font-size: var(--font-2xs); color: var(--text-muted);
}
.artifact-preview-card-footer svg { flex-shrink: 0; }

/* ============ MISSING FOCUS/ACTIVE STATES ============ */
.hamburger:focus-visible, .topbar-btn:focus-visible, .btn-icon:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
.hamburger:active, .topbar-btn:active { transform: scale(0.92); }
.btn-secondary:active, .btn-patrimoine:active, .btn-ghost:active { transform: scale(0.97); }
.form-select:hover { background: var(--fill-tertiary); }

/* ============ EXTENDED LIGHT THEME OVERRIDES ============ */

/* Chat & input */
:root.light .drop-overlay { background: var(--accent-surface); }
:root.light .message.user .message-content { border-color: var(--border); box-shadow: var(--shadow-xs); }
:root.light .camera-pip-chat { background: var(--surface2); }
:root.light .artifact-link-btn { background: var(--accent-surface); }
:root.light .md-table { background: var(--surface); }
:root.light .upload-chip { background: var(--surface2); border-color: var(--border); }
:root.light .input-pill { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
:root.light .input-pill:focus-within { box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-glow); }
:root.light .subagent-current { background: var(--surface); border-color: var(--border); }
:root.light .model-current { background: var(--surface); border-color: var(--border); }
:root.light .session-item:hover { background: var(--fill-tertiary); }
:root.light .session-item.active { background: var(--accent-surface); }
:root.light .suggestion { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
:root.light .suggestion:hover { box-shadow: var(--shadow-md); }
:root.light .private-badge { background: var(--warning-surface); }
:root.light .welcome h2 { background: linear-gradient(135deg, #a52e2b 0%, #BE3734 40%, #a52e2b 100%); -webkit-background-clip: text; }

/* Navigation */
:root.light .app-rail { border-right: 1px solid var(--border); }
:root.light .context-panel { background: var(--surface); border-right-color: var(--border); }
:root.light .topbar { background: var(--glass-bg-thick); border-bottom-color: var(--border); }
:root.light .bottom-nav { background: var(--glass-bg-thick); border-top-color: var(--border); }
:root.light .ctx-nav-item.active { background: var(--accent-surface); }

/* Dashboard */
:root.light .cmp-stat-card { box-shadow: var(--shadow-sm); background: var(--surface); border-color: var(--border); }
:root.light .cmp-stat-card:hover { box-shadow: var(--shadow-lg); }
:root.light .dash-section { box-shadow: var(--shadow-sm); background: var(--surface); border-color: var(--border); }
:root.light .dash-quick-btn { background: var(--surface); border-color: var(--border); }
:root.light .dash-quick-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }

/* Module cards & panels */
:root.light .module-page { background: var(--bg); }
:root.light .client-section { background: var(--surface); border-color: var(--border); }
:root.light .crm-note { background: var(--surface2); border-color: var(--border); }
:root.light .kanban-column { background: var(--surface2); }
:root.light .kanban-card { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
:root.light .kanban-card:hover { box-shadow: var(--shadow-md); }
:root.light .doc-card { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
:root.light .doc-card:hover { box-shadow: var(--shadow-md); }

/* Tables */
:root.light .data-table { background: var(--surface); }
:root.light .data-table thead th { background: var(--surface2); border-color: var(--border); }
:root.light .data-table tbody td { border-color: var(--border-subtle); }
:root.light .data-table tbody tr:hover { background: var(--fill-tertiary); }

/* Forms & inputs */
:root.light .form-input, :root.light .form-textarea, :root.light .form-select { background: var(--surface); border-color: var(--border); }

/* Notifications */
:root.light .notif-item { background: var(--surface); border-color: var(--border); }
:root.light .notif-item.notif-unread { background: var(--accent-surface); }
:root.light .notif-push-row { background: var(--surface); border-color: var(--border); }

/* Team chat */
:root.light .team-layout { background: var(--surface); border-color: var(--border); }
:root.light .team-sidebar { background: var(--surface); }
:root.light .team-msg { background: var(--surface2); }

/* Presentation mode */
:root.light .pres-overlay { background: var(--bg); }
:root.light .pres-topbar { background: var(--surface); border-color: var(--border); }
:root.light .pres-kpi { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
:root.light .pres-panel { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }

/* Autodev / Veille / SEO */
:root.light .autodev-card { background: var(--surface); border-color: var(--border); }
:root.light .veille-card { background: var(--surface); border-color: var(--border); }
:root.light .seo-card { background: var(--surface); border-color: var(--border); }

/* Webhooks / Audit / Finance */
:root.light .webhook-item { background: var(--surface); border-color: var(--border); }
:root.light .audit-tab.active { border-bottom-color: var(--accent); }

/* Offline banner */
:root.light .offline-banner { background: var(--warning); color: white; }

/* Modals */
:root.light .cmp-modal { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-2xl); }
:root.light .confirm-modal { background: var(--surface); box-shadow: var(--shadow-2xl); }

/* Voice overlay, pinned panel, search, suggestions (light) */
:root.light .pinned-panel { background: var(--surface); border-color: var(--border); }
:root.light .pinned-item { background: var(--fill-quaternary); border-color: var(--border); }
:root.light .chat-search-bar { background: var(--surface); border-color: var(--border); }
:root.light .chat-search-input { background: var(--fill-quaternary); border-color: var(--border); color: var(--text); }
:root.light .chat-search-highlight { background: rgba(190,55,52,.25); }
:root.light .dynamic-suggestion-chip { background: rgba(99,102,241,.06); border-color: rgba(99,102,241,.12); }
:root.light .crm-chart-wrap { background: var(--fill-quaternary); border-color: var(--border); }

/* Smooth theme transition */
:root.theme-transitioning, :root.theme-transitioning *, :root.theme-transitioning *::before, :root.theme-transitioning *::after {
    transition: background-color 350ms ease, color 350ms ease, border-color 350ms ease, box-shadow 350ms ease !important;
}

/* ============ OVERFLOW SAFETY FOR MOBILE ============ */
@media (max-width: 480px) {
    .subagent-dropdown { max-height: min(320px, 50vh); }
    .command-results { max-height: min(360px, 50vh); }
}

/* ============ ACCESSIBILITY — WCAG AA ============ */

/* Focus-visible on all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
.rail-btn:focus-visible,
.ctx-nav-item:focus-visible,
.topbar-btn:focus-visible,
.toolbar-btn:focus-visible,
.suggestion:focus-visible,
.session-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: var(--shadow-focus);
}

/* Remove default outlines only when :focus-visible is supported */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .typing-dots span { animation: none !important; }
}

/* ============ FORM VALIDATION STYLES ============ */
.field-error input,
.field-error textarea,
.field-error select,
input.field-invalid,
textarea.field-invalid,
select.field-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px var(--danger-surface);
}
.field-error-msg {
    color: var(--danger);
    font-size: var(--font-xs);
    margin-top: 4px;
    display: block;
}

/* ============ SKELETON SHIMMER ============ */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-line {
    height: 14px;
    border-radius: var(--radius-xs);
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-line + .skeleton-line { margin-top: 8px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-card {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
}
.skeleton-card .skeleton-line:first-child { height: 18px; width: 70%; margin-bottom: 8px; }
.skeleton-card .skeleton-line:last-child { height: 12px; width: 40%; }

/* ============ DEV MODE BADGE ============ */
.dev-classification-badge {
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.02em;
}

/* ============ APPLE CARD STYLES ============ */
.app-card-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-apple-btn); background: var(--fill-tertiary); flex-shrink: 0; }
.app-card-icon svg { width: 24px; height: 24px; color: var(--accent); }
.stat-card, .kpi-card { border-radius: var(--radius-apple-card); box-shadow: var(--shadow-apple-sm); transition: box-shadow var(--transition-fast), transform var(--transition-fast); }
.stat-card:hover, .kpi-card:hover { box-shadow: var(--shadow-apple-md); transform: translateY(-1px); }
.md-table thead { background: var(--fill-quaternary); }
.md-table th { font-weight: var(--weight-semibold); }

/* Bulk delete mode */
.ctx-bulk-actions { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-sm); background: var(--surface2); border-radius: var(--radius-md); margin-bottom: var(--space-2); }
.ctx-bulk-actions .bulk-count { font-size: var(--font-sm); color: var(--text-secondary); flex: 1; }
.session-checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; margin-right: var(--space-2); }
.session-item.select-mode { display: flex; align-items: center; }
.session-item.select-mode .session-actions { display: none; }

/* ============ ARAN ANIMATED AVATAR ============ */

/* Container */
.aran-avatar { display: inline-flex; align-items: center; justify-content: center; position: relative; line-height: 0; }
.aran-avatar-svg { display: block; }

/* Image — subtle breathing scale on idle */
.aran-avatar .av-img { transform-origin: center; transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1); }
.aran-avatar.idle .av-img { animation: av-breathe 4s ease-in-out infinite; }
.aran-avatar.thinking .av-img { animation: av-breathe 2.5s ease-in-out infinite; filter: brightness(0.85); }
.aran-avatar.talking .av-img { animation: av-talk-pulse 0.6s ease-in-out infinite alternate; }

/* Idle ring — soft glow pulse */
.aran-avatar .av-ring-idle { transition: opacity 400ms ease; }
.aran-avatar.idle .av-ring-idle { animation: av-glow 4s ease-in-out infinite; }
.aran-avatar.thinking .av-ring-idle { opacity: 0.1; }
.aran-avatar.talking .av-ring-idle { opacity: 0; }

/* Thinking ring — rotating dash */
.aran-avatar .av-ring-think { transition: opacity 400ms ease; }
.aran-avatar.thinking .av-ring-think { opacity: 0.8; animation: av-spin 2.5s linear infinite; }

/* Thinking dots — orbital rotation */
.aran-avatar .av-dots { transition: opacity 400ms ease; }
.aran-avatar.thinking .av-dots { opacity: 1; animation: av-spin 3s linear infinite; }
.aran-avatar.thinking .av-dot-1 { animation: av-dot-pulse 1.2s ease-in-out infinite; }
.aran-avatar.thinking .av-dot-2 { animation: av-dot-pulse 1.2s ease-in-out 0.3s infinite; }
.aran-avatar.thinking .av-dot-3 { animation: av-dot-pulse 1.2s ease-in-out 0.6s infinite; }

/* Talking ring — outward pulse */
.aran-avatar .av-ring-talk { transition: opacity 400ms ease; }
.aran-avatar.talking .av-ring-talk { animation: av-ring-pulse 1s ease-out infinite; }

/* Sound waves — sequential fade */
.aran-avatar .av-waves { transition: opacity 400ms ease; }
.aran-avatar.talking .av-waves { opacity: 1; }
.aran-avatar.talking .av-wave-1 { animation: av-wave 1s ease-in-out infinite; }
.aran-avatar.talking .av-wave-2 { animation: av-wave 1s ease-in-out 0.15s infinite; }
.aran-avatar.talking .av-wave-3 { animation: av-wave 1s ease-in-out 0.05s infinite; }
.aran-avatar.talking .av-wave-4 { animation: av-wave 1s ease-in-out 0.2s infinite; }

/* ---- Keyframes ---- */

@keyframes av-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes av-talk-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes av-glow {
    0%, 100% { opacity: 0.25; stroke-width: 1.5; }
    50% { opacity: 0.55; stroke-width: 2; }
}

@keyframes av-spin {
    from { transform-origin: center; transform: rotate(0deg); }
    to { transform-origin: center; transform: rotate(360deg); }
}

@keyframes av-dot-pulse {
    0%, 100% { r: inherit; opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes av-ring-pulse {
    0% { opacity: 0.6; stroke-width: 2; transform: scale(1); transform-origin: center; }
    100% { opacity: 0; stroke-width: 0.5; transform: scale(1.25); transform-origin: center; }
}

@keyframes av-wave {
    0% { opacity: 0; stroke-dashoffset: 8; }
    30% { opacity: 0.8; }
    70% { opacity: 0.8; }
    100% { opacity: 0; stroke-dashoffset: -8; }
}

/* Welcome hero avatar sizing */
.welcome-logo .aran-avatar { margin: 0 auto; }

/* Rail avatar sizing */
.rail-logo .aran-avatar { width: 40px; height: 40px; }
.rail-logo .aran-avatar-svg { width: 40px; height: 40px; }

/* Message avatar sizing */
.message-avatar .aran-avatar { width: 36px; height: 36px; }
.message-avatar .aran-avatar-svg { width: 36px; height: 36px; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .aran-avatar .av-img,
    .aran-avatar .av-ring-idle,
    .aran-avatar .av-ring-think,
    .aran-avatar .av-ring-talk,
    .aran-avatar .av-dots,
    .aran-avatar .av-waves,
    .aran-avatar .av-wave,
    .aran-avatar .av-dot { animation: none !important; }
}

/* ============================================================
   Phase 4 — New Module Styles (26 Feb 2026)
   ============================================================ */

/* ============ PRESENTATION MODE ============ */

.presentation-mode { position: relative; }
.pres-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg-primary, #0a0a0a);
    display: flex; flex-direction: column; overflow: hidden;
}
.pres-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.02);
}
.pres-logo { font-size: 1.1rem; font-weight: 600; color: var(--text-primary, #fafafa); letter-spacing: -0.01em; }
.pres-date { font-size: 0.82rem; color: var(--text-muted, #71717a); }
.pres-close {
    padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
    background: rgba(255,255,255,.06); color: var(--text-muted, #71717a); border: 1px solid rgba(255,255,255,.08);
    transition: all .2s;
}
.pres-close:hover { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }
.pres-content { flex: 1; overflow-y: auto; padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%; }

.pres-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.pres-kpi {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 16px; padding: 20px; display: flex; align-items: flex-start; gap: 12px;
    transition: transform .2s, box-shadow .2s;
}
.pres-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.pres-kpi-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0; color: white;
}
.pres-kpi-value { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text-primary, #fafafa); }
.pres-kpi-label { font-size: 0.78rem; color: var(--text-muted, #71717a); margin-top: 2px; font-weight: 500; }

.pres-main-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.pres-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

.pres-panel {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 16px; padding: 20px;
}
.pres-panel-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary, #fafafa); margin-bottom: 16px; }
.pres-sub-title { font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #71717a); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 8px; }

.pres-funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pres-funnel-label { width: 80px; font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); flex-shrink: 0; font-weight: 500; }
.pres-funnel-bar-wrap { flex: 1; height: 8px; background: rgba(255,255,255,.04); border-radius: 100px; overflow: hidden; }
.pres-funnel-bar { height: 100%; border-radius: 100px; transition: width .6s ease; }
.pres-funnel-amount { width: 90px; text-align: right; font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #fafafa); font-variant-numeric: tabular-nums; }

.pres-big-num { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary, #fafafa); line-height: 1.1; }
.pres-big-label { font-size: 0.82rem; color: var(--text-muted, #71717a); margin-top: 4px; }

.pres-list-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.pres-list-item:last-child { border-bottom: none; }
.pres-list-name { font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); }
.pres-list-value { font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #fafafa); font-variant-numeric: tabular-nums; }

.pres-rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.pres-rank-row:last-child { border-bottom: none; }
.pres-rank-num { width: 24px; font-size: 0.82rem; font-weight: 700; color: var(--accent, #6366f1); text-align: center; flex-shrink: 0; }
.pres-rank-name { flex: 1; font-size: 0.82rem; color: var(--text-primary, #fafafa); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres-rank-value { font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #fafafa); font-variant-numeric: tabular-nums; }
.pres-rank-count { font-size: 0.72rem; color: var(--text-muted, #71717a); flex-shrink: 0; }

.pres-activity-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.pres-activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--accent, #6366f1); }
.pres-activity-text { flex: 1; font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres-activity-date { font-size: 0.72rem; color: var(--text-muted, #71717a); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.pres-insight { padding: 12px 16px; background: rgba(99,102,241,.08); border-left: 3px solid var(--accent, #6366f1); border-radius: 4px; font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); line-height: 1.5; margin-top: 16px; }
.pres-empty { text-align: center; padding: 32px; color: var(--text-muted, #71717a); font-size: 0.82rem; }

@media (max-width: 768px) {
    .pres-main-row, .pres-bottom-row { grid-template-columns: 1fr; }
    .pres-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .pres-content { padding: 12px; }
}

/* ============ AUTOMATION (auto-*) ============ */

.auto-loops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
.auto-loop-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; padding: 20px; transition: transform .2s, box-shadow .2s; }
.auto-loop-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.auto-loop-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.auto-loop-name { font-size: 0.92rem; font-weight: 600; color: var(--text-primary, #fafafa); }
.auto-loop-key { font-size: 0.72rem; color: var(--text-muted, #71717a); font-family: 'SF Mono', monospace; background: rgba(255,255,255,.04); padding: 2px 6px; border-radius: 4px; }
.auto-loop-metrics { display: flex; gap: 16px; margin-bottom: 12px; }
.auto-loop-stat { display: flex; flex-direction: column; }
.auto-stat-label { font-size: 0.72rem; color: var(--text-muted, #71717a); font-weight: 500; }
.auto-stat-value { font-size: 1.1rem; font-weight: 600; color: var(--text-primary, #fafafa); font-variant-numeric: tabular-nums; }
.auto-loop-rate-bar { height: 6px; background: rgba(255,255,255,.04); border-radius: 100px; overflow: hidden; margin-bottom: 4px; }
.auto-loop-rate-fill { height: 100%; border-radius: 100px; background: #10b981; transition: width .6s ease; }
.auto-loop-rate-label { font-size: 0.72rem; color: var(--text-muted, #71717a); text-align: right; }
.auto-status-bar { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.04); margin-top: 12px; }
.auto-since { font-size: 0.72rem; color: var(--text-muted, #71717a); }
.auto-tab-bar { display: flex; gap: 0; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 16px; overflow-x: auto; }
.auto-tab { padding: 8px 16px; font-size: 0.85rem; font-weight: 500; color: var(--text-muted, #71717a); background: none; border: none; border-bottom: 2px solid transparent; transition: all .2s; white-space: nowrap; cursor: pointer; }
.auto-tab:hover { color: var(--text-primary, #fafafa); background: rgba(255,255,255,.02); }
.auto-tab.active { color: var(--accent, #6366f1); border-bottom-color: var(--accent, #6366f1); }
.auto-filter-label { font-size: 0.72rem; color: var(--text-muted, #71717a); font-weight: 500; margin-right: 4px; }
.auto-filter-select { padding: 4px 8px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 6px; color: var(--text-primary, #fafafa); font-size: 0.82rem; font-family: inherit; outline: none; cursor: pointer; }
.auto-filter-select:focus { border-color: var(--accent, #6366f1); }
.auto-history-wrap { margin-top: 16px; }
.auto-history-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.auto-history-empty { text-align: center; padding: 32px; color: var(--text-muted, #71717a); font-size: 0.82rem; }

/* ============ OUTILS IA (oia-*) ============ */

.oia-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; overflow: hidden; transition: transform .2s, box-shadow .2s; margin-bottom: 12px; }
.oia-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.oia-card-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; transition: background .15s; }
.oia-card-header:hover { background: rgba(255,255,255,.02); }
.oia-card-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; background: rgba(99,102,241,.12); color: var(--accent, #6366f1); }
.oia-card-info { flex: 1; min-width: 0; }
.oia-card-title { font-size: 0.92rem; font-weight: 600; color: var(--text-primary, #fafafa); }
.oia-card-desc { font-size: 0.82rem; color: var(--text-muted, #71717a); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oia-card-chevron { color: var(--text-muted, #71717a); flex-shrink: 0; transition: transform .2s; }
.oia-card-body { padding: 0 20px 20px; border-top: 1px solid rgba(255,255,255,.04); display: none; }
.oia-card.open .oia-card-body { display: block; padding-top: 16px; }
.oia-card.open .oia-card-chevron { transform: rotate(180deg); }

.oia-form { display: flex; flex-direction: column; gap: 16px; }
.oia-field-group { display: flex; flex-direction: column; gap: 4px; }
.oia-label { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary, #a1a1aa); }
.oia-required { color: #ef4444; margin-left: 2px; }
.oia-input { width: 100%; padding: 8px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; color: var(--text-primary, #fafafa); font-size: 0.85rem; font-family: inherit; outline: none; transition: border-color .2s; }
.oia-input:focus { border-color: var(--accent, #6366f1); }
.oia-input::placeholder { color: rgba(255,255,255,.2); }
textarea.oia-input { resize: vertical; min-height: 80px; }
select.oia-input { cursor: pointer; }
.oia-btn-row { display: flex; gap: 12px; margin-top: 8px; }

.oia-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; gap: 12px; }
.oia-loading-text { font-size: 0.82rem; color: var(--text-muted, #71717a); }
.oia-spinner { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,.08); border-top-color: var(--accent, #6366f1); border-radius: 50%; animation: spin .8s linear infinite; }
.oia-spinner-lg { width: 36px; height: 36px; border-width: 4px; }

.oia-results { margin-top: 16px; }
.oia-result-panel { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.oia-result-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.04); }
.oia-result-check { color: #10b981; font-size: 18px; flex-shrink: 0; }
.oia-result-meta { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-left: auto; }
.oia-result-body { padding: 16px; }
.oia-result-text { font-size: 0.85rem; color: var(--text-secondary, #a1a1aa); line-height: 1.6; }
.oia-error { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); border-radius: 8px; font-size: 0.82rem; color: #fca5a5; margin-top: 12px; }
.oia-error-icon { font-size: 18px; flex-shrink: 0; }

.oia-modal { background: var(--bg-primary, #0a0a0a); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; box-shadow: 0 24px 48px rgba(0,0,0,.5); width: 90%; max-width: 640px; max-height: 85vh; display: flex; flex-direction: column; transform: scale(.95); opacity: 0; transition: transform .3s, opacity .3s; }
.oia-modal-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.oia-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.oia-modal-backdrop.open .oia-modal { transform: scale(1); opacity: 1; }
.oia-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.oia-modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.oia-modal-close { background: none; border: none; color: var(--text-muted, #71717a); font-size: 20px; width: 32px; height: 32px; cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.oia-modal-close:hover { background: rgba(255,255,255,.04); color: var(--text-primary, #fafafa); }
.oia-modal-body { padding: 20px; overflow-y: auto; flex: 1; }

.oia-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.oia-gallery img { width: 100%; border-radius: 8px; cursor: pointer; transition: transform .15s; }
.oia-gallery img:hover { transform: scale(1.03); }
.oia-meta-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: rgba(255,255,255,.06); border-radius: 100px; font-size: 0.72rem; color: var(--text-muted, #71717a); font-weight: 500; }
.oia-md-h2 { font-size: 1.2rem; font-weight: 600; color: var(--text-primary, #fafafa); margin: 16px 0 8px; }
.oia-md-h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-primary, #fafafa); margin: 12px 0 8px; }
.oia-md-h4 { font-size: 0.92rem; font-weight: 600; color: var(--text-secondary, #a1a1aa); margin: 8px 0 4px; }
.oia-md-li { font-size: 0.85rem; color: var(--text-secondary, #a1a1aa); line-height: 1.6; margin-bottom: 4px; }
.oia-kv-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 0.82rem; }
.oia-kv-row:last-child { border-bottom: none; }
.oia-kv-key { color: var(--text-muted, #71717a); font-weight: 500; }
.oia-kv-value { color: var(--text-primary, #fafafa); font-weight: 600; font-variant-numeric: tabular-nums; }
.oia-kv-array-label { font-size: 0.72rem; color: var(--text-muted, #71717a); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin: 12px 0 4px; }
.oia-model-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 500; background: rgba(99,102,241,.12); color: var(--accent, #6366f1); border: 1px solid rgba(99,102,241,.2); }
.oia-models-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.82rem; }
.oia-models-table th { padding: 8px 12px; text-align: left; font-size: 0.72rem; color: var(--text-muted, #71717a); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.06); }
.oia-models-table td { padding: 8px 12px; color: var(--text-secondary, #a1a1aa); border-bottom: 1px solid rgba(255,255,255,.04); }
.oia-tier-row { display: flex; align-items: center; gap: 8px; }
.oia-tier-label { font-size: 0.82rem; font-weight: 500; color: var(--text-primary, #fafafa); }
.oia-tier-tag { display: inline-flex; padding: 1px 8px; border-radius: 100px; font-size: 0.68rem; font-weight: 600; background: rgba(255,255,255,.06); color: var(--text-secondary, #a1a1aa); }

/* ============ TERRAIN ============ */

.terrain-module { max-width: 1200px; margin: 0 auto; }
.terrain-tabs { display: flex; gap: 0; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 16px; overflow-x: auto; }
.terrain-section { margin-bottom: 24px; }
.terrain-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.terrain-event-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; padding: 16px; transition: border-color .15s, box-shadow .15s; }
.terrain-event-card:hover { border-color: rgba(255,255,255,.12); box-shadow: 0 4px 12px rgba(0,0,0,.2); }

/* ============ DASHBOARD ADDITIONS ============ */

.dash-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; overflow: hidden; }
.dash-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.dash-activity-list { padding: 8px 0; }
.dash-activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; transition: background .15s; cursor: pointer; }
.dash-activity-item:hover { background: rgba(255,255,255,.02); }
.dash-activity-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; background: rgba(255,255,255,.04); color: var(--text-muted, #71717a); }
.dash-activity-info { flex: 1; min-width: 0; }
.dash-activity-title { font-size: 0.82rem; color: var(--text-primary, #fafafa); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-activity-time { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* ============ MISC SHARED ============ */

.subtitle { font-size: 0.82rem; color: var(--text-muted, #71717a); margin-top: 2px; }
.module-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.module-header h2 { font-size: 1.3rem; font-weight: 600; }
.section-header { font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #71717a); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.form-control { width: 100%; padding: 8px 12px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; color: var(--text-primary, #fafafa); font-size: 0.85rem; font-family: inherit; outline: none; transition: border-color .2s; }
.form-control:focus { border-color: var(--accent, #6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-control::placeholder { color: rgba(255,255,255,.2); }
.loading-skeleton { height: 16px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.spinner-sm { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.08); border-top-color: var(--accent, #6366f1); border-radius: 50%; animation: spin .8s linear infinite; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 500; white-space: nowrap; }
.status-badge.active { background: rgba(16,185,129,.1); color: #10b981; border: 1px solid rgba(16,185,129,.2); }
.status-badge.inactive { background: rgba(255,255,255,.04); color: var(--text-muted, #71717a); border: 1px solid rgba(255,255,255,.06); }
.status-badge.warning { background: rgba(245,158,11,.1); color: #f59e0b; border: 1px solid rgba(245,158,11,.2); }
.status-badge.error { background: rgba(239,68,68,.1); color: #ef4444; border: 1px solid rgba(239,68,68,.2); }
.scope-badge { display: inline-flex; padding: 1px 8px; border-radius: 100px; font-size: 0.68rem; font-weight: 600; background: rgba(59,130,246,.1); color: #3b82f6; border: 1px solid rgba(59,130,246,.2); }
.breadcrumb-deep { display: flex; align-items: center; gap: 4px; font-size: 0.82rem; color: var(--text-muted, #71717a); }
.bc-current { color: var(--text-primary, #fafafa); font-weight: 600; }
.app-pin-btn { background: none; border: none; color: var(--text-muted, #71717a); cursor: pointer; padding: 4px; border-radius: 4px; font-size: 0.82rem; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.app-pin-btn:hover { color: #f59e0b; }
.app-pin-btn.pinned { color: #f59e0b; }
.apps-section { margin-bottom: 24px; }
.apps-section-title { font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #71717a); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.diagram-type-btn { padding: 6px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 500; background: rgba(255,255,255,.03); color: var(--text-secondary, #a1a1aa); border: 1px solid rgba(255,255,255,.08); cursor: pointer; transition: all .15s; }
.diagram-type-btn:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: var(--text-primary, #fafafa); }
.diagram-type-btn.active { background: rgba(99,102,241,.12); color: var(--accent, #6366f1); border-color: var(--accent, #6366f1); }
.webhook-body, .audit-content, .bi-body, .finance-body, .fournisseurs-body, .api-keys-content, .email-diagnostics-content { padding: 0; }
.audit-tabs { display: flex; gap: 0; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 16px; overflow-x: auto; }
.audit-tab { padding: 8px 16px; font-size: 0.85rem; font-weight: 500; color: var(--text-muted, #71717a); background: none; border: none; border-bottom: 2px solid transparent; transition: all .2s; white-space: nowrap; cursor: pointer; }
.audit-tab:hover { color: var(--text-primary, #fafafa); background: rgba(255,255,255,.02); }
.audit-tab.active { color: var(--accent, #6366f1); border-bottom-color: var(--accent, #6366f1); }
.rapport-module { max-width: 1200px; margin: 0 auto; }
.email-banner-icon { font-size: 24px; flex-shrink: 0; }
.client-fiche { max-width: 1200px; margin: 0 auto; }
.client-section { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.crm-notes-list { display: flex; flex-direction: column; gap: 12px; }
.crm-note { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.04); border-radius: 8px; padding: 12px 16px; }
.crm-note-content { font-size: 0.85rem; color: var(--text-secondary, #a1a1aa); line-height: 1.6; }
.crm-note-meta { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-top: 8px; display: flex; gap: 12px; }
.objective-section { margin-bottom: 20px; }
.objective-progress { height: 8px; background: rgba(255,255,255,.04); border-radius: 100px; overflow: hidden; margin-top: 8px; }
.objective-progress-fill { height: 100%; border-radius: 100px; background: var(--accent, #6366f1); transition: width .6s ease; }
.objective-progress-label { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-top: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.team-ch-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #fafafa); }

/* ============ APPVIEWER ============ */

.appviewer-btn { padding: 4px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; color: var(--text-secondary, #a1a1aa); font-size: 0.82rem; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 4px; transition: all .15s; }
.appviewer-btn:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.appviewer-fallback-btn { display: flex; align-items: center; gap: 12px; padding: 16px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; cursor: pointer; transition: all .15s; width: 100%; text-align: left; }
.appviewer-fallback-btn:hover { border-color: var(--accent, #6366f1); background: rgba(99,102,241,.06); }
.appviewer-fallback-icon { font-size: 24px; flex-shrink: 0; }
.appviewer-fallback-info { flex: 1; min-width: 0; }
.appviewer-tab-add { background: none; border: 1px dashed rgba(255,255,255,.12); color: var(--text-muted, #71717a); width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.appviewer-tab-add:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.appviewer-tab-close { background: none; border: none; color: var(--text-muted, #71717a); width: 18px; height: 18px; font-size: 12px; cursor: pointer; border-radius: 3px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s, color .15s; }
*:hover > .appviewer-tab-close { opacity: 1; }
.appviewer-tab-close:hover { color: #ef4444; }
.appviewer-tab-icon { width: 16px; height: 16px; flex-shrink: 0; }
.appviewer-tab-label { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appviewer-tool-icon { width: 20px; height: 20px; flex-shrink: 0; }
.appviewer-toolbar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* ============ REAL-TIME INDICATORS ============ */

.online-count { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(16,185,129,.12); color: #10b981; font-size: 0.72rem; font-weight: 700; margin: 0 auto 4px; }
#typingIndicator { display: none; padding: 4px 12px; font-size: 0.75rem; color: var(--text-muted, #71717a); font-style: italic; }

/* ============ 3D AVATAR ============ */

.avatar-3d-ready canvas { border-radius: 16px; }
.welcome-logo { position: relative; display: flex; align-items: center; justify-content: center; min-height: 80px; }
.welcome-logo.avatar-3d-ready { min-height: 240px; }
.welcome-logo canvas { box-shadow: 0 8px 32px rgba(0,0,0,.3); }

/* ============ OFFLINE BANNER ============ */
.offline-banner { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 9999; padding: 8px 16px; text-align: center; font-size: 0.82rem; font-weight: 500; background: var(--warning); color: white; }
.offline-banner.visible { display: block; }

/* ============ PUSH NOTIFICATIONS ROW ============ */
.notif-push-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; margin-bottom: 16px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; }

/* ============ PERFORMANCE: MODULE TRANSITIONS ============ */

.module-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 16px; color: var(--text-muted, #71717a); }
#moduleContent > * { animation: fadeInModule .25s ease; }
@keyframes fadeInModule { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============ CRM SVG CHARTS ============ */
.crm-chart-wrap { margin-bottom: 20px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; padding: 20px; }
.crm-chart-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary, #fafafa); margin-bottom: 12px; }
.crm-chart-svg text { font-family: 'Inter', sans-serif; }
.crm-chart-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.crm-chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-muted, #71717a); }
.crm-chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============ VOICE CONVERSATION OVERLAY ============ */
.voice-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: radial-gradient(ellipse at center, rgba(20,20,30,.97) 0%, rgba(5,5,10,.99) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    opacity: 0; pointer-events: none; transition: opacity .35s ease;
}
.voice-overlay.open { opacity: 1; pointer-events: auto; }

.voice-topbar {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.voice-title { font-size: 0.92rem; font-weight: 600; color: rgba(255,255,255,.8); }
.voice-close-btn {
    padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
    background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.2);
    transition: all .2s;
}
.voice-close-btn:hover { background: rgba(239,68,68,.25); }

.voice-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px; }

.voice-avatar-wrap { width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; }
.voice-avatar-wrap .aran-avatar { width: 120px; height: 120px; }
.voice-avatar-wrap .aran-avatar-svg { width: 120px; height: 120px; }

.voice-status { font-size: 1rem; font-weight: 500; color: rgba(255,255,255,.7); letter-spacing: -0.01em; }

.voice-waveform {
    display: flex; align-items: center; gap: 3px; height: 48px;
    opacity: 0; transition: opacity .3s;
}
.voice-waveform.active { opacity: 1; }
.voice-waveform span {
    width: 4px; border-radius: 2px; background: var(--accent, #6366f1);
    animation: voiceWave 1.2s ease-in-out infinite;
}
.voice-waveform span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 32px; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 24px; animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { height: 40px; animation-delay: 0.15s; }
.voice-waveform span:nth-child(6) { height: 28px; animation-delay: 0.25s; }
.voice-waveform span:nth-child(7) { height: 36px; animation-delay: 0.05s; }
.voice-waveform span:nth-child(8) { height: 20px; animation-delay: 0.35s; }
.voice-waveform span:nth-child(9) { height: 32px; animation-delay: 0.12s; }
.voice-waveform span:nth-child(10) { height: 16px; animation-delay: 0.28s; }
.voice-waveform span:nth-child(11) { height: 24px; animation-delay: 0.08s; }
.voice-waveform span:nth-child(12) { height: 12px; animation-delay: 0.32s; }
@keyframes voiceWave {
    0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
    50% { transform: scaleY(1); opacity: 1; }
}

.voice-transcript {
    max-width: 600px; text-align: center; font-size: 1.1rem; color: rgba(255,255,255,.9);
    min-height: 28px; line-height: 1.5; padding: 0 20px;
}

.voice-controls { display: flex; align-items: center; gap: 20px; padding: 32px; }
.voice-mic-btn {
    width: 72px; height: 72px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--accent, #6366f1); color: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 0 rgba(99,102,241,.4); transition: all .2s;
}
.voice-mic-btn.active {
    background: #ef4444;
    box-shadow: 0 0 0 12px rgba(239,68,68,.15);
    animation: voicePulse 1.5s ease-in-out infinite;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 8px rgba(239,68,68,.15); }
    50% { box-shadow: 0 0 0 16px rgba(239,68,68,.08); }
}
.voice-interrupt-btn {
    width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.06); color: rgba(255,255,255,.6); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.voice-interrupt-btn:hover { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }

.voice-mode-btn { position: relative; }
.voice-mode-btn::after {
    content: ''; position: absolute; top: 2px; right: 2px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent, #6366f1); opacity: 0.8;
}

/* ============ MESSAGE PINNING ============ */
.pin-btn.active svg { fill: var(--accent, #6366f1); stroke: var(--accent, #6366f1); }

.pinned-panel {
    position: absolute; top: 52px; right: 12px; z-index: 100;
    width: 320px; max-height: 400px; overflow-y: auto;
    background: var(--glass-bg-thick, var(--bg-primary, #0a0a0a));
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 12px; box-shadow: var(--shadow-2xl, 0 24px 48px rgba(0,0,0,.5));
    display: none; backdrop-filter: var(--glass-blur, blur(20px));
}
.pinned-panel.open { display: block; }
.pinned-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
    font-size: 0.85rem; font-weight: 600; color: var(--text-primary, #fafafa);
}
.pinned-close {
    background: none; border: none; color: var(--text-muted, #71717a); font-size: 18px;
    cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: all .15s;
}
.pinned-close:hover { background: var(--fill-tertiary); color: var(--text-primary); }
.pinned-list { padding: 8px; }
.pinned-item {
    position: relative; padding: 10px 12px; border-radius: 8px;
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.04);
    margin-bottom: 6px; transition: background .15s;
}
.pinned-item:hover { background: rgba(255,255,255,.06); }
.pinned-text { font-size: 0.82rem; color: var(--text-secondary, #a1a1aa); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pinned-meta { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-top: 4px; }
.pinned-remove {
    position: absolute; top: 8px; right: 8px; background: none; border: none;
    color: var(--text-muted, #71717a); cursor: pointer; font-size: 16px; opacity: 0; transition: opacity .15s;
}
.pinned-item:hover .pinned-remove { opacity: 1; }
.pinned-empty { text-align: center; padding: 24px 16px; font-size: 0.82rem; color: var(--text-muted, #71717a); }

/* ============ DYNAMIC SUGGESTIONS ============ */
.dynamic-suggestions {
    display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 60px 16px;
    animation: fadeInModule .3s ease;
}
.dynamic-suggestion-chip {
    padding: 6px 14px; border-radius: 20px; font-size: 0.82rem;
    background: rgba(99,102,241,.08); color: var(--accent, #6366f1);
    border: 1px solid rgba(99,102,241,.15); cursor: pointer;
    transition: all .2s; font-family: inherit;
}
.dynamic-suggestion-chip:hover {
    background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.3);
    transform: translateY(-1px);
}

/* ============ CHAT SEARCH BAR ============ */
.chat-search-bar {
    display: none; align-items: center; gap: 8px;
    padding: 8px 16px; background: var(--surface, rgba(255,255,255,.03));
    border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
}
.chat-search-bar.open { display: flex; }
.chat-search-input {
    flex: 1; background: var(--fill-tertiary, rgba(255,255,255,.04)); border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 8px; padding: 6px 12px; color: var(--text, #fafafa); font-size: 0.85rem;
    font-family: inherit; outline: none; transition: border-color .2s;
}
.chat-search-input:focus { border-color: var(--accent, #6366f1); }
.chat-search-input::placeholder { color: var(--text-muted, #71717a); }
.chat-search-count { font-size: 0.72rem; color: var(--text-muted, #71717a); white-space: nowrap; }
.chat-search-close {
    background: none; border: none; color: var(--text-muted, #71717a); font-size: 18px;
    cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: all .15s;
}
.chat-search-close:hover { background: var(--fill-tertiary); color: var(--text-primary); }
.chat-search-highlight { background: rgba(190,55,52,.3); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ============ FOCUS / ZEN MODE ============ */
body.focus-mode .app-rail,
body.focus-mode .context-panel,
body.focus-mode .topbar,
body.focus-mode .bottom-nav,
body.focus-mode .fab-container,
body.focus-mode .chat-search-bar { display: none !important; }
body.focus-mode .main-content { margin-left: 0 !important; padding-top: 0 !important; }
body.focus-mode .chat-container { max-width: 800px; margin: 0 auto; }
body.focus-mode .input-area { max-width: 800px; margin: 0 auto; }
body.focus-mode .messages { padding-top: 24px; }
/* Focus exit hint */
body.focus-mode::after {
    content: 'Echap pour quitter le mode focus';
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100;
    font-size: 0.72rem; color: rgba(255,255,255,.25); pointer-events: none;
    animation: fadeInModule .5s ease;
}

/* ============ MESSAGE TEMPLATES ============ */
.templates-backdrop {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
.templates-backdrop.open { opacity: 1; pointer-events: auto; }
.templates-panel {
    width: 90%; max-width: 520px; max-height: 80vh;
    background: var(--glass-bg-thick, var(--bg-primary, #0a0a0a));
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 16px; box-shadow: var(--shadow-2xl, 0 24px 48px rgba(0,0,0,.5));
    display: flex; flex-direction: column; overflow: hidden;
    transform: scale(.95) translateY(10px); opacity: 0;
    transition: transform .3s, opacity .3s;
    backdrop-filter: var(--glass-blur, blur(20px));
}
.templates-backdrop.open .templates-panel { transform: scale(1) translateY(0); opacity: 1; }
.templates-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
    font-size: 0.92rem; font-weight: 600; color: var(--text-primary, #fafafa);
}
.templates-close {
    background: none; border: none; color: var(--text-muted, #71717a); font-size: 20px;
    cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: all .15s;
}
.templates-close:hover { background: var(--fill-tertiary); color: var(--text-primary); }
.templates-list { overflow-y: auto; padding: 12px; flex: 1; }
.template-cat {
    padding: 8px 8px 4px; font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #71717a);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.template-item {
    display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px;
    background: none; border: 1px solid transparent; cursor: pointer;
    transition: all .15s; font-family: inherit;
}
.template-item:hover { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.06); }
.template-label { font-size: 0.85rem; font-weight: 500; color: var(--text-primary, #fafafa); }
.template-preview { font-size: 0.72rem; color: var(--text-muted, #71717a); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ FAB (Floating Action Button) ============ */
.fab-container {
    position: fixed; bottom: 80px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px;
}
@media (min-width: 769px) { .fab-container { bottom: 24px; right: 24px; } }

.fab-main {
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--accent, #6366f1); color: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(99,102,241,.35);
    transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s;
}
.fab-main:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(99,102,241,.45); }
.fab-main.active { transform: rotate(45deg); background: var(--danger, #ef4444); box-shadow: 0 4px 16px rgba(239,68,68,.35); }

.fab-menu {
    display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
    opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none;
    transition: opacity .2s, transform .25s cubic-bezier(.4,0,.2,1);
}
.fab-container.open .fab-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.fab-action {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px;
    background: var(--glass-bg-thick, rgba(20,20,30,.95)); border: 1px solid rgba(255,255,255,.08);
    border-radius: 28px; color: var(--text-primary, #fafafa); cursor: pointer;
    font-size: 0.82rem; font-family: inherit; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.3); transition: all .15s;
    backdrop-filter: blur(12px);
}
.fab-action:hover { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.2); }
.fab-action svg { flex-shrink: 0; }

/* ============ RAIL AI ACTIVITY INDICATOR ============ */
.rail-ai-indicator {
    position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
    border-radius: 50%; opacity: 0; transition: opacity .3s;
    pointer-events: none;
}
.rail-ai-indicator.thinking {
    opacity: 1; background: var(--warning, #f59e0b);
    animation: railAiPulse 1.2s ease-in-out infinite;
}
.rail-ai-indicator.talking {
    opacity: 1; background: var(--success, #10b981);
    animation: railAiPulse 0.8s ease-in-out infinite;
}
@keyframes railAiPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}
/* Rail button needs position relative for indicator */
.rail-btn { position: relative; }

/* ============ LIGHT THEME — Phase 4j ============ */
:root.light .templates-panel { background: var(--surface); border-color: var(--border); }
:root.light .template-item:hover { background: var(--fill-quaternary); border-color: var(--border); }
:root.light .fab-action { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-apple-sm); }
:root.light .fab-action:hover { background: var(--fill-quaternary); }
:root.light body.focus-mode::after { color: rgba(0,0,0,.2); }

/* ============ USER POPOVER ============ */
.user-popover {
    position: fixed;
    bottom: 12px;
    left: 60px;
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-apple-xl);
    padding: 8px;
    min-width: 220px;
    flex-direction: column;
    gap: 2px;
    animation: popoverIn 0.15s ease;
}
@keyframes popoverIn {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.user-popover-header {
    padding: 8px 10px;
}
.user-popover-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.user-popover-email {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.user-popover-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}
.user-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.user-popover-item:hover {
    background: var(--fill-secondary);
    color: var(--text);
}
.user-popover-danger { color: var(--danger); }
.user-popover-danger:hover { background: var(--danger-surface); color: var(--danger); }

/* ============ TOPBAR SEARCH TRIGGER ============ */
.topbar-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 200px;
}
.topbar-search-trigger:hover {
    border-color: var(--border-hover);
    background: var(--surface2);
}
.topbar-search-trigger kbd {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-faint);
    background: var(--fill-tertiary);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ============ PLUS MENU ============ */
.input-plus-menu {
    position: relative;
}
.plus-menu-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-apple-lg);
    padding: 6px;
    min-width: 200px;
    z-index: 100;
    animation: popoverIn 0.15s ease;
}
.plus-menu-dropdown.hidden { display: none; }
.plus-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all var(--transition-fast);
}
.plus-menu-item:hover {
    background: var(--fill-secondary);
    color: var(--text);
}

/* ============ CTX-NAV GROUP LABELS ============ */
.ctx-nav-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    padding: 12px 12px 4px;
}
.ctx-nav-group-label:first-child {
    padding-top: 4px;
}

/* Mobile: hide search trigger on small screens */
@media (max-width: 767px) {
    .topbar-search-trigger { display: none; }
}

/* ============ PRINT — hide FAB, overlays ============ */
@media print {
    .fab-container, .voice-overlay, .templates-backdrop, .pinned-panel, .chat-search-bar { display: none !important; }
}
