    /* ═══════════════════════════ VARIABLES */
    :root {
      --bg:          #080d14;
      --surface:     #0f1923;
      --card:        #162032;
      --card-hover:  #1c2a40;
      --border:      #1e2d42;
      --border-soft: #162032;
      --text:        #e8edf3;
      --muted:       #a8c0d4;
      --dim:         #a6bed2;

      --accent:      #4f8ef7;
      --accent-dim:  rgba(79,142,247,.12);
      --accent-glow: rgba(79,142,247,.25);
      --accent-2:    #38bdf8;
      --gradient-accent: linear-gradient(135deg, #4f8ef7, #38bdf8);

      --green:       #3dd68c;
      --green-dim:   rgba(61,214,140,.1);
      --amber:       #f5a623;
      --amber-dim:   rgba(245,166,35,.1);
      --red:         #f06565;
      --red-dim:     rgba(240,101,101,.1);
      --red-vivid:   #e74c3c;
      --red-dark:    #c0392b;
      --warn:        #f59e0b;
      --tool:        #38bdf8;
      --tool-dim:    rgba(56,189,248,.08);
      --purple:      #a78bfa;
      --blue:        #60a5fa;
      --voice-text:  #a8bdd0;
      --code-bg:     #0d1b2a;
      --output-bg:   #080f18;
      --spin-border: rgba(255,255,255,.25);
      --spin-top:    #fff;

      --user-bg:     #1a2640;
      --radius:      14px;
      --radius-sm:   8px;
      --radius-lg:   24px;
      --shadow:      0 8px 40px rgba(0,0,0,.6);
      --shadow-sm:   0 2px 12px rgba(0,0,0,.4);
      --shadow-btn:  0 4px 16px rgba(79,142,247,.3);
      --sidebar-w:   260px;
      --ease-spring: cubic-bezier(.16,1,.3,1);
      --ease-std:    cubic-bezier(.4,0,.2,1);
      --duration-sm: 150ms;
      --duration-md: 250ms;
    }

    /* ═══════════════════════════ SCREEN READER ONLY */
    .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;
    }

    /* ═══════════════════════════ SKIP NAV */
    #skip-nav {
      position: absolute; top: -40px; left: 0;
      background: var(--accent); color: var(--text);
      padding: 8px 16px; z-index: 8999;
      font-size: 14px; border-radius: 0 0 8px 0;
      transition: top 0.2s;
    }
    #skip-nav:focus { top: 0; }

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

    body {
      font-family: 'Inter', system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      height: 100vh;
      height: var(--app-h, 100dvh);
      overflow: hidden;
      font-size: 15px;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
    }

    /* ═══════════════════════════ FOCUS VISIBLE (accessibilité clavier) */
    button:focus-visible, [role="button"]:focus-visible, a:focus-visible,
    .conv-item:focus-visible, .chip:focus-visible, .act-btn:focus-visible,
    .voice-btn:focus-visible, .send-btn:focus-visible, .login-btn:focus-visible,
    .mission-btn:focus-visible, .sidebar-toggle:focus-visible, .h-btn:focus-visible,
    .sidebar-new-btn:focus-visible, .sidebar-close-btn:focus-visible,
    .wf-resume-btn:focus-visible, .wf-resume-dismiss:focus-visible,
    .retry-btn:focus-visible, .voice-stop-btn:focus-visible, .voice-cancel:focus-visible,
    input:focus-visible, textarea:focus-visible, select:focus-visible,
    .tools-collapse-toggle:focus-visible, .tool-header:focus-visible,
    .phase-dot:focus-visible, #scroll-bottom-btn:focus-visible,
    .voice-play-btn:focus-visible, .voice-speed-btn:focus-visible,
    .wrc-phase:focus-visible, .ann-btn:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* ═══════════════════════════ SCROLLBARS */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
    .messages-area, #sidebar, #conv-list, .tool-output, pre, .thinking-text, .code-block, .output-block { scrollbar-width: thin; scrollbar-color: var(--dim) transparent; }

    /* ═══════════════════════════ LOGIN */
    #login-screen {
      position: fixed; inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg);
      background-image: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79,142,247,.08) 0%, transparent 70%);
      z-index: 1000;
    }

    .login-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 52px 48px 44px;
      width: 100%;
      max-width: 420px;
      box-shadow: var(--shadow);
      animation: slideUp .4s var(--ease-spring);
    }

    @keyframes slideUp {
      from { opacity:0; transform: translateY(24px) scale(.97); }
      to   { opacity:1; transform: translateY(0) scale(1); }
    }
    @keyframes loginShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
    .login-card.shake { animation: loginShake 0.4s ease; }

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

    .logo-mark {
      display: inline-flex; align-items: center; justify-content: center;
      width: 56px; height: 56px;
      background: var(--gradient-accent);
      border-radius: 16px;
      font-size: 24px; font-weight: 800; color: #fff;
      margin-bottom: 16px;
      box-shadow: 0 0 32px var(--accent-glow);
    }

    .logo-name {
      font-size: 28px; font-weight: 800;
      background: var(--gradient-accent);
      -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
      letter-spacing: -.5px;
    }

    .logo-tagline { font-size: 13px; color: var(--muted); margin-top: 6px; }

    .login-label {
      display: block; font-size: 12px; font-weight: 600;
      text-transform: uppercase; letter-spacing: .06em;
      color: var(--muted); margin-bottom: 8px;
    }

    .login-input {
      width: 100%; background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--text);
      font-family: inherit; font-size: 15px; padding: 13px 16px;
      outline: none; transition: border-color .2s, box-shadow .2s; margin-bottom: 16px;
    }
    .login-input::placeholder { color: var(--dim); opacity: 1; }
    .login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
    .login-input:-webkit-autofill { -webkit-box-shadow: 0 0 0 30px var(--card) inset !important; -webkit-text-fill-color: var(--text) !important; caret-color: var(--text); }

    .login-btn {
      width: 100%; background: var(--gradient-accent);
      border: none; border-radius: var(--radius-sm); color: white;
      font-family: inherit; font-size: 15px; font-weight: 600; padding: 14px;
      cursor: pointer; transition: opacity var(--duration-md), transform .1s, box-shadow var(--duration-md);
      box-shadow: var(--shadow-btn);
    }
    .login-btn:hover  { opacity: .92; box-shadow: 0 6px 24px rgba(79,142,247,.4); }
    .login-btn:active { transform: scale(.98); }
    .login-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
    .login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent-glow); }

    .login-error { margin-top: 12px; min-height: 20px; font-size: 13px; color: var(--red); text-align: center; }
    @media (max-width: 768px) { .login-input { font-size: 16px; } }

    /* ═══════════════════════════ KD-DIALOG (modales partagées) */
    .kd-dialog {
      border: none; background: transparent;
      padding: 0; margin: auto;
      max-width: 100vw; max-height: 100vh;
      /* Centrage explicite desktop */
      position: fixed; inset: 0;
      width: fit-content; height: fit-content;
      border-radius: var(--radius-lg);
    }
    .kd-dialog::backdrop {
      background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    }
    .kd-dialog-body {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-lg); padding: 36px 32px 28px;
      max-width: 420px; width: calc(100vw - 32px);
      box-shadow: var(--shadow); text-align: center;
      animation: slideUp .3s var(--ease-spring);
    }
    /* Mobile : bottom sheet natif */
    @media (max-width: 600px) {
      .kd-dialog {
        margin: 0; position: fixed; inset: auto 0 0 0;
        width: 100%; max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      }
      .kd-dialog-body {
        max-width: 100%; width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px));
        animation: sheetUp .3s var(--ease-spring);
        padding-bottom: max(28px, calc(20px + env(safe-area-inset-bottom, 0px)));
      }
      .kd-project-list { max-height: 50vh; }
      .kd-dialog-actions { flex-direction: column; }
      .kd-btn { width: 100%; padding: 14px; font-size: 16px; }
    }
    @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    .kd-dialog-icon {
      font-size: 36px; margin-bottom: 12px; display: inline-block;
    }
    .kd-dialog-icon.danger { filter: grayscale(.2); }
    .kd-dialog-title {
      font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 8px;
    }
    .kd-dialog-text {
      font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 20px;
    }
    .kd-dialog-subtitle {
      font-size: 12px; color: var(--dim); font-style: italic;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      max-width: 100%; margin-bottom: 12px;
    }
    .kd-dialog-actions {
      display: flex; gap: 10px; justify-content: center;
    }
    .kd-btn {
      padding: 10px 24px; border-radius: var(--radius-sm); border: none;
      font-family: inherit; font-size: 14px; font-weight: 600;
      cursor: pointer; transition: opacity .15s, transform .1s, box-shadow .2s;
    }
    .kd-btn:active { transform: scale(.97); }
    .kd-btn:disabled { opacity: .4; cursor: not-allowed; }
    .kd-btn.primary {
      background: var(--gradient-accent); color: white;
      box-shadow: var(--shadow-btn);
    }
    .kd-btn.primary:hover { opacity: .9; }
    .kd-btn.secondary {
      background: var(--card); color: var(--muted); border: 1px solid var(--border);
    }
    .kd-btn.secondary:hover { color: var(--text); background: var(--card-hover); }
    .kd-btn.danger {
      background: linear-gradient(135deg, var(--red-vivid), var(--red-dark)); color: white;
      box-shadow: 0 2px 10px rgba(231,76,60,.3);
    }
    .kd-btn.danger:hover { opacity: .9; }

    /* ── Project list dans la modale assign ── */
    .kd-project-list {
      max-height: 280px; overflow-y: auto; text-align: left;
      margin-bottom: 16px; border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }
    .kd-project-item {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 12px; cursor: pointer;
      transition: background .1s;
      border-bottom: 1px solid var(--border-soft);
    }
    .kd-project-item:last-child { border-bottom: none; }
    .kd-project-item:hover { background: var(--card-hover); }
    .kd-project-item input[type="checkbox"] {
      accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0;
    }
    .kd-project-item-icon { font-size: 14px; flex-shrink: 0; }
    .kd-project-item-name { font-size: 13px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .kd-project-item-type { font-size: 10px; color: var(--dim); flex-shrink: 0; }
    .kd-project-group {
      padding: 6px 12px 4px; font-size: 10px; font-weight: 700;
      color: var(--dim); text-transform: uppercase; letter-spacing: .05em;
      background: var(--bg); border-bottom: 1px solid var(--border-soft);
    }

    /* ═══════════════════════════ LAYOUT CHAT */
    #chat-screen {
      display: none;
      height: 100vh;
      height: var(--app-h, 100dvh);
    }
    #chat-screen.active { display: flex; flex-direction: row; height: 100%; }

    /* ═══════════════════════════ SIDEBAR */
    #sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: linear-gradient(180deg, var(--surface) 0%, rgba(15,25,35,.95) 100%);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transition: width var(--duration-md) var(--ease-spring), transform var(--duration-md) var(--ease-spring);
    }

    #sidebar.collapsed { width: 0; overflow: hidden; }
    @media (max-width: 768px) { #sidebar.collapsed { width: 0; transform: translateX(-100%); overflow: hidden; } }

    .sidebar-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 14px;
      height: 56px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .sidebar-logo {
      font-size: 15px; font-weight: 800;
      background: linear-gradient(135deg, #4f8ef7, #38bdf8);
      -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
      user-select: none;
    }

    .sidebar-new-btn {
      background: var(--accent-dim);
      border: 1px solid rgba(79,142,247,.3);
      border-radius: var(--radius-sm);
      color: var(--accent);
      cursor: pointer; font-family: inherit;
      font-size: 18px; font-weight: 400;
      width: 44px; height: 44px;
      display: flex; align-items: center; justify-content: center;
      transition: background .15s, color .15s, border-color .15s; flex-shrink: 0;
    }
    @media (hover: hover) { .sidebar-new-btn:hover { background: var(--accent); color: white; border-color: var(--accent); } }
    .sidebar-new-btn:active { transform: scale(0.95); }

    #conv-list {
      flex: 1;
      overflow-y: auto;
      padding: 8px 0;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    .conv-item {
      padding: 10px 14px;
      cursor: pointer;
      border-radius: var(--radius-sm);
      margin: 2px 8px;
      transition: background .15s, border-color .15s;
      display: flex; align-items: flex-start; gap: 10px;
      position: relative;
      border: 1px solid transparent;
    }
    @media (hover: hover) { .conv-item:hover { background: var(--card); } }
    .conv-item.active { background: var(--accent-dim); border: 1px solid rgba(79,142,247,.2); }

    .conv-item-icon {
      width: 28px; height: 28px; border-radius: var(--radius-sm);
      background: var(--card);
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; flex-shrink: 0; color: var(--muted);
      margin-top: 1px;
    }
    .conv-item.active .conv-item-icon { background: var(--accent-dim); color: var(--accent); }

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

    .conv-title {
      font-size: 13px; font-weight: 500; color: var(--text);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .conv-item.active .conv-title { color: var(--accent); }

    .conv-meta {
      font-size: 11px; color: var(--muted); margin-top: 2px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    .conv-del, .conv-assign {
      background: none; border: none; color: var(--dim);
      cursor: pointer; font-size: 14px; padding: 2px 4px;
      border-radius: 4px; opacity: 0; transition: opacity .15s, color .15s;
      flex-shrink: 0;
      min-width: 28px; min-height: 28px;
      display: flex; align-items: center; justify-content: center;
    }
    .conv-assign { font-size: 12px; }
    .conv-item:hover .conv-del, .conv-item:hover .conv-assign { opacity: 1; }
    .conv-item:focus-within .conv-del, .conv-item:focus-within .conv-assign { opacity: 1; }
    @media (hover: hover) { .conv-del:hover { color: var(--red); } .conv-assign:hover { color: var(--accent); } }
    .conv-del:active { color: var(--red); }
    .conv-assign:active { color: var(--accent); }

    .conv-empty {
      text-align: center; padding: 40px 16px;
      color: var(--dim); font-size: 12px; font-style: italic;
    }
    .conv-empty::before { content: '💬'; display: block; font-size: 24px; margin-bottom: 8px; font-style: normal; }

    /* ═══════════════════════════ SEARCH BAR */
    /* ── Project bar ── */
    .proj-bar {
      padding: 6px 10px;
      flex-shrink: 0;
      border-bottom: 1px solid var(--border);
      position: relative;
      display: flex; align-items: center; gap: 4px;
      flex-wrap: wrap;
    }
    .proj-current {
      flex: 1;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--bg-secondary);
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
      text-align: left;
      transition: border-color .15s, background .15s;
    }
    .proj-current:hover { border-color: var(--accent); background: var(--bg); }
    .proj-current[aria-expanded="true"] { border-color: var(--accent); }
    .proj-icon { font-size: 14px; line-height: 1; flex-shrink: 0; }
    .proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
    .proj-chevron { flex-shrink: 0; opacity: .5; transition: transform .15s; }
    .proj-current[aria-expanded="true"] .proj-chevron { transform: rotate(180deg); }
    .proj-add-btn {
      width: 26px; height: 26px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--bg-secondary);
      color: var(--dim);
      cursor: pointer;
      font-size: 14px;
      display: flex; align-items: center; justify-content: center;
      transition: color .15s, border-color .15s;
    }
    .proj-add-btn:hover { color: var(--accent); border-color: var(--accent); }
    .proj-dropdown {
      display: none;
      position: absolute;
      left: 8px; right: 8px;
      top: calc(100% + 2px);
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0,0,0,.25);
      z-index: 200;
      max-height: 240px;
      overflow-y: auto;
      padding: 4px;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }
    .proj-dropdown.open { display: block; }
    .proj-opt {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: 7px;
      cursor: pointer;
      font-size: 12px;
      transition: background .1s;
    }
    .proj-opt:hover { background: var(--bg-secondary); }
    .proj-opt.active { background: rgba(79,142,247,.15); background: color-mix(in srgb, var(--accent) 15%, transparent); }
    .proj-opt-icon { font-size: 15px; flex-shrink: 0; }
    .proj-opt-info { flex: 1; min-width: 0; }
    .proj-opt-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .proj-opt-meta { font-size: 10px; color: var(--dim); margin-top: 1px; }
    .proj-opt-del {
      background: none; border: none; color: var(--dim);
      cursor: pointer; font-size: 11px; padding: 2px 6px;
      border-radius: 4px; opacity: 0; transition: opacity .15s, color .15s;
      flex-shrink: 0; margin-left: auto;
    }
    .proj-opt:hover .proj-opt-del { opacity: 1; }
    .proj-opt-del:hover { color: var(--red); background: var(--red-dim); }
    .proj-opt-badge {
      font-size: 9px;
      padding: 1px 5px;
      border-radius: 4px;
      background: var(--bg-secondary);
      color: var(--dim);
      flex-shrink: 0;
      text-transform: uppercase;
      letter-spacing: .3px;
    }
    /* Hierarchical sub-items (containers) */
    .proj-opt.sub { padding-left: 32px; font-size: 11px; }
    .proj-opt.sub .proj-opt-icon { font-size: 13px; }
    .proj-sep { height: 1px; background: var(--border); margin: 3px 8px; }
    /* Linked projects chips (multi-env) */
    .proj-linked {
      display: none;
      padding: 4px 0 0;
      gap: 4px;
      flex-wrap: wrap;
    }
    .proj-linked.has-items { display: flex; }
    .proj-chip {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 7px;
      border-radius: 10px;
      font-size: 10px;
      background: var(--bg-secondary);
      color: var(--dim);
      cursor: pointer;
      border: 1px solid transparent;
      transition: border-color .15s, color .15s;
    }
    .proj-chip:hover { border-color: var(--accent); color: var(--text); }
    .proj-chip.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
    .proj-chip-more { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
    .proj-chip-more:hover { background: var(--accent); color: white; }
    .proj-linked { position: relative; }
    .proj-linked-dropdown {
      display: none; position: absolute; top: 100%; left: 0; z-index: 600;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 4px 0;
      box-shadow: var(--shadow); max-height: 240px; overflow-y: auto;
      min-width: 200px; margin-top: 4px;
    }
    .proj-linked-dropdown.open { display: block; }
    .proj-linked-item {
      padding: 6px 12px; font-size: 11px; cursor: pointer;
      color: var(--muted); white-space: nowrap;
      transition: background .1s, color .1s;
    }
    .proj-linked-item:hover { background: var(--card-hover); color: var(--text); }
    /* Git activity section */
    .git-activity-item {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      font-size: 11px;
      color: var(--dim);
      border-bottom: 1px solid var(--border);
    }
    .git-activity-item:last-child { border-bottom: none; }
    .git-act-icon { font-size: 13px; flex-shrink: 0; }
    .git-act-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .git-act-time { flex-shrink: 0; font-size: 10px; opacity: .6; }
    .git-activity-new { animation: gitSlideIn .3s ease; }
    @keyframes gitSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
    /* Git loading card */
    .git-loading-card {
      margin: 16px 12px;
      padding: 16px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg-secondary);
    }
    .glc-header {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 12px;
    }
    .glc-spinner {
      display: inline-block;
      width: 14px; height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: glcSpin .8s linear infinite;
    }
    @keyframes glcSpin { to { transform: rotate(360deg); } }
    .glc-steps { display: flex; flex-direction: column; gap: 6px; }
    .glc-step {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--dim);
      padding: 2px 0;
    }
    .glc-step.done { color: var(--text); }
    .glc-step.pending { color: var(--accent); }
    .glc-step-icon { flex-shrink: 0; font-size: 13px; }
    .glc-step-new { animation: gitSlideIn .25s ease; }
    .conv-search-wrap {
      padding: 8px 10px 4px;
      flex-shrink: 0;
    }
    .conv-search-box {
      position: relative;
      display: flex;
      align-items: center;
    }
    .conv-search-icon {
      position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
      color: var(--dim); font-size: 13px; pointer-events: none;
      line-height: 1;
    }
    #conv-search {
      width: 100%;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text);
      font-family: inherit;
      font-size: 13px;
      padding: 8px 32px 8px 30px;
      outline: none;
      transition: border-color .2s, box-shadow .2s;
    }
    #conv-search::placeholder { color: var(--dim); opacity: .7; }
    #conv-search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
    .conv-search-clear {
      position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
      background: none; border: none; color: var(--dim); cursor: pointer;
      font-size: 14px; padding: 2px 4px; border-radius: 4px;
      display: none; line-height: 1;
      transition: color .15s;
    }
    .conv-search-clear:hover { color: var(--text); }
    .conv-search-clear.visible { display: flex; align-items: center; justify-content: center; }
    #conv-count {
      font-size: 11px; color: var(--dim); padding: 3px 10px 0; text-align: right;
    }
    .conv-no-result {
      text-align: center; padding: 32px 16px;
      color: var(--dim); font-size: 12px; font-style: italic;
      display: none;
    }
    .conv-no-result::before { content: '🔍'; display: block; font-size: 20px; margin-bottom: 6px; font-style: normal; }

    /* WS status indicator */
    .ws-dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: var(--dim); flex-shrink: 0;
    }
    .ws-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); animation: wsDotPulse 3s ease-in-out infinite; }
    @keyframes wsDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
    .ws-dot.error     { background: var(--red); }

    /* ═══════════════════════════ MAIN AREA */
    #main-area {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      position: relative;
    }

    /* Header */
    .header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 20px; height: 56px;
      background: var(--surface); border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      z-index: 100; position: relative;
    }

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

    .sidebar-toggle {
      background: none; border: none; color: var(--muted);
      cursor: pointer; font-size: 18px; padding: 4px 6px;
      border-radius: 6px; transition: color .15s, background .15s;
      line-height: 1;
    }
    @media (hover: hover) { .sidebar-toggle:hover { color: var(--text); background: var(--card); } }

    .header-logo {
      font-size: 18px; font-weight: 800;
      background: linear-gradient(135deg, #4f8ef7, #38bdf8);
      -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
      letter-spacing: -.3px;
      user-select: none;
    }

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

    .header-user { font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

    .h-btn {
      background: transparent; border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--muted);
      cursor: pointer; font-family: inherit;
      font-size: 12px; font-weight: 500; padding: 5px 12px;
      min-height: 32px;
      transition: background var(--duration-sm) var(--ease-std), color var(--duration-sm) var(--ease-std), border-color var(--duration-sm) var(--ease-std);
    }
    @media (hover: hover) { .h-btn:hover { background: var(--card); color: var(--text); border-color: var(--dim); } }
    .h-btn:active { transform: scale(0.97); }

    /* Messages area */
    .messages-area {
      flex: 1; overflow-y: auto; padding: 32px 20px 16px;
      position: relative; min-height: 0;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: manipulation;
    }

    .msgs {
      max-width: 760px; margin: 0 auto;
      display: flex; flex-direction: column; gap: 24px;
      padding-bottom: 24px;
    }

    /* Loader messages */
    .msgs-loader {
      display: flex; align-items: center; justify-content: center;
      gap: 8px; padding: 24px 0; color: var(--muted); font-size: 12px;
      animation: skeletonPulse 1.5s ease-in-out infinite;
    }
    @keyframes skeletonPulse { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
    .msgs-loader .spin { display:inline-block; width:16px; height:16px; }
    .msgs-loader .spin::after {
      content:''; display:block; width:16px; height:16px;
      border:2px solid var(--border); border-top-color: var(--muted);
      border-radius:50%; animation: spin .8s linear infinite;
    }
    /* Sentinel infinite scroll */
    .scroll-sentinel { height: 1px; }

    /* Welcome */
    .welcome {
      text-align: center; padding: 60px 24px 40px; color: var(--muted);
    }

    .welcome-logo {
      font-size: clamp(32px, 8vw, 56px); font-weight: 800;
      background: linear-gradient(135deg, #4f8ef7 0%, #38bdf8 100%);
      -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
      margin-bottom: 16px;
    }

    .welcome-text { font-size: 15px; line-height: 1.7; margin-bottom: 32px; }

    .welcome-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

    .chip {
      background: var(--card); border: 1px solid var(--border);
      border-radius: 20px; color: var(--text);
      cursor: pointer; font-family: inherit; font-size: 13px; padding: 7px 16px;
      transition: background .15s, color .15s, border-color .15s;
      max-width: 100%;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    @media (hover: hover) { .chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); } }
    .chip:active { transform: scale(0.95); }

    /* Messages */
    .msg { display: flex; gap: 14px; position: relative; }
    .msg.user { flex-direction: row-reverse; }

    .avatar {
      width: 34px; height: 34px; border-radius: var(--radius-sm); flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-size: 13px; font-weight: 700; margin-top: 2px; text-transform: uppercase;
    }
    .msg.user      .avatar { background: var(--accent); color: white; }
    .msg.assistant .avatar { background: linear-gradient(135deg,#4f8ef7,#38bdf8); color: white; border: 1px solid rgba(79,142,247,.2); }

    .msg-body { flex: 1; min-width: 0; overflow: hidden; position: relative; }
    .msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

    .bubble {
      background: var(--user-bg); border: 1px solid var(--border);
      border-radius: var(--radius) var(--radius) 4px var(--radius);
      padding: 12px 16px; max-width: 76%;
      font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; word-break: break-word;
      white-space: pre-wrap;
    }
    @media (max-width: 768px) { .bubble { max-width: 92%; } }

    /* Voice message bubble */
    .voice-bubble {
      background: var(--user-bg); border: 1px solid var(--border);
      border-radius: var(--radius) var(--radius) 4px var(--radius);
      padding: 12px 14px; max-width: 320px; min-width: 240px;
      max-width: min(320px, calc(100vw - 80px));
      display: flex; flex-direction: column; gap: 6px;
    }
    .voice-bubble .voice-audio-row {
      display: flex; align-items: center; gap: 8px;
    }
    .voice-bubble .voice-play-btn {
      width: 40px; height: 40px; flex-shrink: 0;
      background: linear-gradient(135deg, var(--accent), #38bdf8);
      border: none; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; color: #fff; transition: background .2s, transform .2s;
      padding: 0; box-shadow: 0 2px 8px rgba(99,102,241,.3);
    }
    @media (hover: hover) {
      .voice-bubble .voice-play-btn:hover:not(:disabled) { transform: scale(1.08); box-shadow: 0 3px 12px rgba(99,102,241,.45); }
    }
    .voice-bubble .voice-play-btn:active:not(:disabled) {
      transform: scale(0.95);
    }
    .voice-bubble .voice-play-btn:disabled {
      opacity: 0.4; cursor: default; background: var(--muted);
      box-shadow: none;
    }
    .voice-bubble .voice-play-btn svg { width: 18px; height: 18px; }
    .voice-bubble .voice-waveform-wrap {
      flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
    }
    .voice-bubble .voice-waveform {
      height: 32px; display: flex; align-items: center; gap: 1.5px;
      cursor: pointer; position: relative; touch-action: none;
      padding: 2px 0;
    }
    .voice-bubble .voice-waveform .vw-bar {
      flex: 1; min-width: 2px; max-width: 5px;
      border-radius: 1.5px; transition: background .15s;
      background: var(--border);
    }
    .voice-bubble .voice-waveform .vw-bar.played {
      background: linear-gradient(180deg, var(--accent), #38bdf8);
    }
    .voice-bubble .voice-info-row {
      display: flex; align-items: center; justify-content: space-between;
      gap: 6px; padding: 0 2px;
    }
    .voice-bubble .voice-time {
      font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .voice-bubble .voice-speed-btn {
      font-size: 11px; font-weight: 600; color: var(--accent);
      background: transparent; border: 1.5px solid var(--accent);
      border-radius: 10px; padding: 1px 7px; cursor: pointer;
      transition: background .2s, color .2s, border-color .2s; line-height: 1.4;
      font-variant-numeric: tabular-nums;
    }
    @media (hover: hover) {
      .voice-bubble .voice-speed-btn:hover { background: var(--accent); color: #fff; }
    }
    .voice-bubble .voice-speed-btn:active { background: var(--accent); color: #fff; }
    @media (max-width: 768px) {
      .voice-bubble .voice-speed-btn { min-width: 44px; min-height: 44px; font-size: 12px; }
      .voice-bubble .voice-play-btn { min-width: 44px; min-height: 44px; }
    }
    .voice-bubble .voice-translated-text {
      font-size: 13px; line-height: 1.5; color: var(--voice-text);
      border-top: 1px solid var(--border);
      padding-top: 6px; margin-top: 2px;
      white-space: pre-wrap; overflow-wrap: break-word;
    }
    .voice-bubble .voice-loading {
      display: flex; align-items: center; justify-content: center;
      height: 32px; gap: 4px;
    }
    .voice-bubble .voice-loading .vl-dot {
      width: 5px; height: 5px; border-radius: 50%;
      background: var(--accent); opacity: .5;
      animation: vlPulse .8s ease-in-out infinite;
    }
    .voice-bubble .voice-loading .vl-dot:nth-child(2) { animation-delay: .15s; }
    .voice-bubble .voice-loading .vl-dot:nth-child(3) { animation-delay: .3s; }
    @keyframes vlPulse {
      0%, 100% { opacity: .3; transform: scale(.8); }
      50% { opacity: 1; transform: scale(1.2); }
    }

    .msg-time {
      font-size: 10px; color: var(--dim);
      margin-top: 5px; font-family: 'JetBrains Mono', monospace;
      user-select: none;
    }
    .msg.user .msg-time { text-align: right; }

    /* Assistant text */
    .asst-text {
      font-size: 14.5px; line-height: 1.7;
      color: var(--text); overflow-wrap: anywhere; word-break: break-word;
    }

    .asst-text p { margin: 0 0 12px; text-wrap: pretty; }
    .asst-text p:last-child { margin-bottom: 0; }
    .asst-text h1,.asst-text h2,.asst-text h3 { font-weight: 700; margin: 16px 0 8px; color: var(--text); text-rendering: optimizeLegibility; line-height: 1.25; }
    .asst-text h1 { font-size: 20px; } .asst-text h2 { font-size: 17px; } .asst-text h3 { font-size: 15px; }
    .asst-text ul,.asst-text ol { margin: 8px 0 8px 20px; }
    .asst-text ul ul, .asst-text ol ol, .asst-text ul ol, .asst-text ol ul { margin: 4px 0 4px 16px; }
    .asst-text li { margin-bottom: 4px; }
    .asst-text input[type="checkbox"] { margin-right: 6px; accent-color: var(--accent); }
    .asst-text li.task-list-item { list-style: none; margin-left: -20px; }
    .asst-text code:not(pre code) {
      background: var(--card); border: 1px solid var(--border);
      border-radius: 4px; padding: 1px 6px;
      font-family: 'JetBrains Mono', monospace; font-size: 13px;
    }
    .asst-text pre {
      font-family: 'JetBrains Mono', monospace;
      background: var(--code-bg); border: 1px solid var(--border);
      border-radius: var(--radius-sm); overflow-x: auto;
      margin: 12px 0; padding: 16px;
      box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
      position: relative;
      -webkit-overflow-scrolling: touch;
    }
    .asst-text pre code { font-size: 13px; font-family: 'JetBrains Mono', monospace; background: none; border: none; padding: 0; white-space: pre; overflow-wrap: normal; word-break: normal; }
    .asst-text strong, .asst-text b { color: var(--text); }
    .asst-text strong code, .asst-text b code { font-weight: 600; }
    .asst-text a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(79,142,247,.3); text-underline-offset: 2px; text-decoration-skip-ink: auto; transition: text-decoration-color var(--duration-sm); }
    .asst-text a:hover { text-decoration-color: var(--accent); }
    .asst-text img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
    .asst-text hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
    .asst-text blockquote {
      border-left: 3px solid var(--accent); padding-left: 12px;
      color: var(--muted); margin: 10px 0;
    }
    .asst-text .table-wrapper {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin: 12px 0;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      max-height: 500px;
      overflow-y: auto;
    }
    .asst-text .table-wrapper table { margin: 0; }
    .asst-text table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
    .asst-text th,.asst-text td { border: 1px solid var(--border); padding: 8px 12px; }
    .asst-text th { background: var(--card); font-weight: 600; text-align: left; }

    /* Cursor */
    .cursor {
      display: inline-block; width: 2px; height: 1em;
      background: var(--accent); margin-left: 2px;
      vertical-align: text-bottom;
      animation: blink 1s step-end infinite;
    }
    @keyframes blink { 50% { opacity: 0; } }

    /* Curseur streaming via CSS — pas besoin de JS */
    .asst-cur::after {
      content: '';
      display: inline-block;
      width: 2px;
      height: 1em;
      background: var(--accent);
      margin-left: 2px;
      vertical-align: text-bottom;
      animation: blink 1s step-end infinite;
    }

    /* Thinking */
    .thinking-block {
      background: rgba(167,139,250,.06); border: 1px solid rgba(167,139,250,.2);
      border-radius: var(--radius-sm); margin-bottom: 12px;
      overflow: hidden;
    }
    .thinking-label {
      font-size: 11px; font-weight: 600; text-transform: uppercase;
      letter-spacing: .06em; color: var(--purple);
      padding: 8px 12px; border-bottom: 1px solid var(--border-soft);
      display: flex; align-items: center; gap: 8px;
    }
    .thinking-time {
      font-size: 10px; color: var(--dim);
      font-family: 'JetBrains Mono', monospace;
      font-weight: 400; text-transform: none; letter-spacing: 0;
      margin-left: auto;
    }
    .thinking-text {
      padding: 10px 12px; font-size: 12.5px; color: var(--muted);
      font-style: italic; line-height: 1.6; max-height: 80px; overflow: hidden; overflow-wrap: break-word;
      position: relative; cursor: pointer;
      transition: max-height var(--duration-md) var(--ease-std);
    }
    .thinking-text.expanded { max-height: 400px; overflow-y: auto; transition: max-height 0.4s var(--ease-std); }
    .thinking-text.expanded::after { display: none; }
    .thinking-text.no-overflow::after { display: none; }
    .thinking-text::after {
      content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
      background: linear-gradient(transparent, rgba(167,139,250,.06));
      pointer-events: none;
    }
    .thinking-text:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; border-radius: var(--radius-sm); }
    .thinking-block.thinking-done { opacity: .6; }
    .thinking-block.thinking-done .thinking-label::after { content: ' ✓'; font-size: 10px; opacity: .7; }

    /* Tool cards */
    .tool-card {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm); margin-bottom: 8px;
      overflow: hidden; transition: border-color .2s;
    }
    .tool-card.executing { border-color: var(--amber); animation: toolPulse 2s ease-in-out infinite; }
    @keyframes toolPulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
    .tool-card.done      { border-color: var(--border-soft); background: rgba(16,185,129,.04); }

    .tool-header {
      display: flex; align-items: center; gap: 8px;
      padding: 9px 12px; cursor: pointer; user-select: none;
      transition: background .15s;
    }
    @media (hover: hover) { .tool-header:hover { background: var(--card-hover); } }
    .tool-header:active { background: var(--card-hover); }

    .tool-body {
      max-height: 0; overflow: hidden;
      opacity: 0;
      transition: max-height 0.22s ease-out, opacity 0.18s ease-out;
      contain: content;
    }
    .tool-card.open .tool-body {
      max-height: min(600px, 80vh);
      overflow-y: auto;
      opacity: 1;
      border-top: 1px solid var(--border-soft);
      transition: max-height 0.28s ease-in, opacity 0.22s ease-in;
    }

    .tool-icon {
      width: 24px; height: 24px; border-radius: 6px;
      background: var(--tool-dim); color: var(--tool);
      display: flex; align-items: center; justify-content: center;
      font-size: 9px; font-weight: 700; font-family: 'JetBrains Mono',monospace;
      flex-shrink: 0;
    }
    .tool-name { font-size: 12px; font-weight: 600; color: var(--tool); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
    .tool-summary { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tool-time {
      font-size: 10px; color: var(--dim);
      font-family: 'JetBrains Mono', monospace;
      flex-shrink: 0; white-space: nowrap;
    }
    .tool-badge {
      font-size: 10px; font-family: 'JetBrains Mono',monospace;
      border-radius: 20px; padding: 2px 8px; flex-shrink: 0;
      white-space: nowrap; text-align: center; min-width: 24px;
    }
    .badge-gen  { background: rgba(245,166,35,.1); color: var(--amber); }
    .badge-run  { background: var(--amber-dim); color: var(--amber); }
    .badge-done { background: var(--green-dim); color: var(--green); }
    .tool-chevron { font-size: 9px; color: var(--muted); transition: transform .2s; }
    .tool-card.open .tool-chevron { transform: rotate(180deg); }

    .body-section { padding: 10px 12px; }
    .body-section + .body-section { border-top: 1px solid var(--border-soft); }
    .body-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }

    .code-block {
      background: var(--code-bg); border-radius: 6px; padding: 10px 12px;
      font-family: 'JetBrains Mono',monospace; font-size: 12px;
      color: var(--text); white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
      max-height: 200px; overflow-y: auto; overflow-x: auto;
      -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    }
    .output-block {
      background: var(--output-bg); border-radius: 6px; padding: 10px 12px;
      font-family: 'JetBrains Mono',monospace; font-size: 11.5px; color: var(--muted);
      white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
      max-height: 400px; overflow-y: auto; overflow-x: auto;
      -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    }
    .output-block::-webkit-scrollbar-thumb { background: var(--dim); }
    /* Agent output rendered as markdown — override monospace and increase height */
    .output-block p, .output-block h1, .output-block h2, .output-block h3,
    .output-block ul, .output-block ol, .output-block table {
      font-family: 'Inter', system-ui, sans-serif;
      font-size: 13px; color: var(--text); white-space: normal;
    }
    .output-block h1, .output-block h2, .output-block h3 { margin: 12px 0 6px; font-weight: 600; }
    .output-block h2 { font-size: 14px; }
    .output-block h3 { font-size: 13px; color: var(--muted); }
    .output-block table { font-size: 11.5px; }
    .output-block pre { white-space: pre-wrap; }

    /* Agent card: extracted summary section */
    .agent-summary-section {
      border-top: 1px solid var(--border-soft);
      padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
    }
    .agent-stats-row {
      display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    }
    .agent-stat-pill {
      font-size: 10px; font-family: 'JetBrains Mono', monospace;
      padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 4px;
    }
    .pill-critical { background: rgba(239,68,68,.15); color: #f87171; }
    .pill-high     { background: rgba(245,158,11,.15); color: var(--amber); }
    .pill-medium   { background: rgba(59,130,246,.12); color: var(--accent); }
    .pill-files    { background: var(--code-bg); color: var(--muted); }
    .agent-files-row {
      display: flex; flex-wrap: wrap; gap: 4px 6px;
    }
    .agent-file-pill {
      font-size: 10px; font-family: 'JetBrains Mono', monospace;
      background: var(--code-bg); border: 1px solid var(--border-soft);
      border-radius: 4px; padding: 2px 7px; color: var(--muted);
      max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .agent-file-pill:hover { color: var(--text); border-color: var(--accent); }

    .sub-label { font-size: 10px; color: var(--dim); padding: 4px 0 2px; }

    .sub-tools-section {
      padding: 6px 8px 4px;
      border-top: 1px solid var(--border-soft);
      display: flex; flex-direction: column; gap: 4px;
    }
    /* Agent card: live progress during execution */
    .agent-live {
      border-top: 1px solid var(--border-soft);
      padding: 10px 12px;
    }
    .agent-live-header {
      display: flex; align-items: center; gap: 8px;
      font-size: 11px; color: var(--accent); font-weight: 500; margin-bottom: 6px;
    }
    .agent-live-dot {
      width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
      animation: agentPulse 1.2s ease-in-out infinite;
    }
    @keyframes agentPulse { 0%,100%{opacity:.3;transform:scale(.8)} 50%{opacity:1;transform:scale(1.2)} }
    .agent-live-dot.waiting { background: var(--dim); animation: agentPulse 2.5s ease-in-out infinite; }
    .agent-live-log {
      display: flex; flex-direction: column; gap: 1px;
      max-height: 200px; overflow-y: auto; overflow-x: hidden;
      scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
    }
    .agent-live-entry {
      font-size: 11px; font-family: 'JetBrains Mono', monospace;
      color: var(--muted); padding: 2px 0; line-height: 1.4;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .agent-live-entry .ale-icon { color: var(--tool); font-weight: 600; margin-right: 4px; }
    .agent-live-entry .ale-path { color: var(--dim); }

    /* Bash card: live progress during execution */
    .bash-live {
      border-top: 1px solid var(--border-soft);
      padding: 10px 12px;
    }
    .bash-live-header {
      display: flex; align-items: center; gap: 8px;
      font-size: 11px; color: var(--accent); font-weight: 500; margin-bottom: 6px;
    }
    .bash-live-dot {
      width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
      animation: agentPulse 1.2s ease-in-out infinite;
    }
    .bash-live-output {
      font-size: 11px; font-family: 'JetBrains Mono', monospace;
      color: var(--muted); line-height: 1.4;
      max-height: 200px; overflow-y: auto; overflow-x: auto;
      white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
      scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
    }
    .bash-live-output::-webkit-scrollbar { width: 4px; height: 4px; }
    .bash-live-output::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 2px; }
    .bash-live-output::-webkit-scrollbar-track { background: transparent; }

    .sub-tools-header {
      font-size: 10px; font-weight: 600; text-transform: uppercase;
      letter-spacing: .05em; color: var(--tool); padding: 2px 4px 4px;
      display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
    }
    .sub-tools-header .sub-tools-count { color: var(--muted); font-weight: 400; }
    .sub-tools-header .sub-tools-chevron { font-size: 8px; color: var(--muted); transition: transform .2s; }
    .sub-tools-section.collapsed .sub-tools-chevron { transform: rotate(-90deg); }
    .sub-tools-section.collapsed .tool-card { display: none; }
    .sub-tools-section .tool-card {
      margin-bottom: 0;
      margin-left: 12px;
      border-left: 2px solid var(--accent-dim);
    }

    /* Agent card: thinking section */
    .agent-thinking-section {
      border-top: 1px solid var(--border-soft);
      padding: 6px 8px 4px;
    }
    .agent-thinking-section .thinking-block { margin-bottom: 4px; }

    /* Agent card: files touched */
    .agent-files-section {
      border-top: 1px solid var(--border-soft);
      padding: 8px 12px;
    }
    .agent-files-section .body-label { margin-bottom: 6px; }
    .agent-files-list { display: flex; flex-wrap: wrap; gap: 4px 6px; }
    .agent-file-tag {
      font-size: 10px; font-family: 'JetBrains Mono', monospace;
      background: var(--code-bg); border: 1px solid var(--border-soft);
      border-radius: 4px; padding: 2px 7px;
      color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
      max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .agent-file-tag .file-op { font-weight: 700; font-size: 9px; flex-shrink: 0; }
    .file-op-read { color: var(--blue); }
    .file-op-edit { color: var(--amber); }
    .file-op-write { color: var(--green); }
    .file-op-search { color: var(--purple); }
    .file-op-exec { color: var(--tool); }

    /* Agent card: sub-agent text */
    .agent-subtext-section {
      border-top: 1px solid var(--border-soft);
      padding: 8px 12px;
    }
    .agent-subtext-content {
      font-size: 12px; color: var(--muted); line-height: 1.5;
      max-height: 150px; overflow-y: auto; overflow-wrap: break-word;
    }

    .tools-collapse-toggle {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 12px; margin: 4px 0;
      background: var(--card); border: 1px dashed var(--border);
      border-radius: var(--radius-sm); color: var(--muted);
      cursor: pointer; font-size: 11.5px; font-family: 'JetBrains Mono', monospace;
      transition: color .15s, background .15s;
      user-select: none;
    }
    @media (hover: hover) { .tools-collapse-toggle:hover { color: var(--text); background: var(--card-hover); } }
    .tools-collapse-toggle:active { color: var(--text); background: var(--card-hover); }
    .tools-collapsed { display: none; }
    .tools-collapsed.expanded { display: block; }

    .msg-stats-footer {
      display: flex; gap: 8px; flex-wrap: wrap;
      margin-top: 8px; padding-top: 6px;
      border-top: 1px solid var(--border-soft);
    }
    .msg-stats-footer .stat-chip {
      font-size: 10.5px; font-family: 'JetBrains Mono', monospace;
      color: var(--muted); background: var(--card);
      border: 1px solid var(--border-soft);
      border-radius: 20px; padding: 2px 9px;
      font-variant-numeric: tabular-nums;
    }

    /* ═══ Input area — modern messaging style ═══ */
    .input-area {
      padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
      background: var(--bg); flex-shrink: 0;
    }
    .input-wrap { max-width: 760px; margin: 0 auto; }

    .input-row {
      display: flex; align-items: flex-end;
      background: var(--card); border: 1.5px solid var(--border);
      border-radius: 24px; padding: 6px 8px 6px 16px;
      transition: border-color .2s, box-shadow .25s;
      gap: 8px;
    }
    .input-row:focus-within {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-glow);
    }

    #msg-input {
      flex: 1; min-width: 0;
      width: 100%; background: transparent; border: none; color: var(--text);
      display: block; font-family: 'Inter', sans-serif; font-size: 16px;
      line-height: 1.5; max-height: 180px; min-height: 44px;
      outline: none; overflow-y: auto; padding: 10px 0; resize: none;
      -webkit-overflow-scrolling: touch;
    }
    #msg-input::placeholder { color: var(--dim); }
    #msg-input:focus-visible { outline: none; }

    /* ── Boutons intégrés dans la barre ── */
    .input-actions {
      display: flex; align-items: center; gap: 8px;
      flex-shrink: 0; padding-bottom: 4px;
    }

    /* ── Mission dropdown (remplace l'ancien bouton simple) ── */
    .mission-dropdown { position: relative; flex-shrink: 0; }

    .mission-btn {
      width: 40px; height: 40px;
      background: transparent; border: 1.5px solid var(--border);
      border-radius: 50%; color: var(--muted);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      font-size: 16px; flex-shrink: 0;
      transition: color .2s, background .2s, border-color .2s, transform .15s ease;
    }
    @media (hover: hover) { .mission-btn:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.08); } }
    .mission-btn:active { transform: scale(0.92); }
    .mission-btn.active-dev {
      color: #fff; background: var(--accent);
      border-color: var(--accent);
      box-shadow: 0 0 12px var(--accent-glow);
    }
    .mission-btn.active-audit {
      color: #fff; background: var(--amber);
      border-color: var(--amber);
      box-shadow: 0 0 12px rgba(245,166,35,.3);
    }
    .mission-btn:disabled { opacity: .35; cursor: not-allowed; }

    .mission-menu {
      display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
      transform: translateX(-50%);
      background: var(--card); border: 1.5px solid var(--border);
      border-radius: 14px; padding: 6px;
      min-width: 160px;
      box-shadow: 0 8px 24px rgba(0,0,0,.4);
      z-index: 100;
      animation: menu-pop .15s ease;
    }
    .mission-menu.open { display: block; }
    @keyframes menu-pop { from { opacity: 0; transform: translateX(-50%) translateY(4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
    @media (max-width: 768px) {
      /* Sur mobile, ancrer le menu à gauche pour éviter le dépassement sur petits écrans */
      .mission-menu {
        left: 0; transform: none;
        max-width: calc(100vw - 24px);
        min-width: 0;
        overflow-x: hidden; /* Bloquer le débordement horizontal uniquement */
        overflow-y: auto;   /* Permettre le scroll si le panel de phases custom est long */
        max-height: calc(100vh - 120px);   /* fallback pour navigateurs sans dvh */
        max-height: calc(100dvh - 120px); /* Empêcher le menu de dépasser en haut de l'écran */
        /* Correction animation : @keyframes menu-pop utilise translateX(-50%) qui déplace le menu sur mobile */
        animation-name: menu-pop-mobile;
      }
      @keyframes menu-pop-mobile {
        from { opacity: 0; transform: translateY(4px); }
        to   { opacity: 1; transform: translateY(0); }
      }
    }

    .mission-menu-item {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 14px; border-radius: 10px;
      cursor: pointer; font-size: 13px; color: var(--text);
      transition: background .15s;
      white-space: nowrap;
    }
    .mission-menu-item:hover { background: rgba(79,142,247,.1); }
    .mission-menu-item.selected { background: rgba(79,142,247,.15); font-weight: 600; }
    .mission-menu-item .mi-icon {
      width: 28px; height: 28px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 14px; flex-shrink: 0;
      border: 1.5px solid var(--border);
    }
    .mission-menu-item .mi-icon.mi-off { color: var(--muted); }
    .mission-menu-item .mi-icon.mi-dev { color: var(--accent); border-color: var(--accent); }
    .mission-menu-item .mi-icon.mi-audit { color: var(--amber); border-color: var(--amber); }
    .mission-menu-item .mi-icon.mi-custom { color: #a78bfa; border-color: #a78bfa; }
    .mission-menu-item .mi-label { flex: 1; }
    .mission-menu-item .mi-desc { font-size: 11px; color: var(--muted); font-weight: 400; }
    .mission-btn.active-custom { border-color: #a78bfa; background: rgba(167,139,250,.12); }

    /* Phases selection panel */
    .mission-phases-panel {
      padding: 8px 12px;
      border-top: 1px solid var(--border);
      background: var(--bg-secondary);
      border-radius: 0 0 12px 12px;
      max-height: 220px;
      overflow-y: auto;
    }
    .mp-header {
      font-size: 11px;
      font-weight: 600;
      color: var(--dim);
      text-transform: uppercase;
      letter-spacing: .5px;
      margin-bottom: 6px;
    }
    .mp-phase {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 3px 0;
      font-size: 12px;
      color: var(--text);
      cursor: pointer;
    }
    .mp-phase input[type="checkbox"] {
      width: 14px; height: 14px;
      accent-color: #a78bfa;
      cursor: pointer;
    }
    .mp-phase span {
      font-weight: 600;
      color: var(--dim);
      min-width: 14px;
    }

    /* ── Phase proposal container (persistent, above input) ── */
    .phase-proposal-container {
      flex-shrink: 0;
      padding: 0 16px;
      animation: ppSlideUp .25s ease-out;
    }
    @keyframes ppSlideUp {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .phase-proposal-card {
      border: 1.5px solid var(--accent);
      border-radius: 12px;
      padding: 14px 16px;
      background: var(--bg-secondary);
      max-width: 520px;
      margin: 0 auto 6px;
      box-shadow: 0 -2px 12px rgba(0,0,0,.15);
    }
    .pp-header {
      font-weight: 600;
      font-size: 13px;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .pp-timer {
      font-size: 11px;
      color: var(--dim);
      font-weight: 400;
      font-variant-numeric: tabular-nums;
    }
    .pp-phases {
      display: flex;
      flex-wrap: wrap;
      gap: 4px 12px;
      margin-bottom: 10px;
    }
    .pp-phase {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 12px;
      cursor: pointer;
      min-width: 140px;
    }
    .pp-phase input { accent-color: var(--accent); cursor: pointer; }
    .pp-phase span { font-weight: 600; color: var(--dim); min-width: 14px; }
    .pp-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }
    .pp-btn {
      padding: 6px 14px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--bg);
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
      transition: background .15s, opacity .15s;
    }
    .pp-btn:hover { background: var(--bg-secondary); }
    .pp-btn:disabled { opacity: .4; cursor: default; }
    .pp-validate { border-color: var(--accent); color: var(--accent); font-weight: 600; }
    .pp-all { border-color: var(--dim); }
    .pp-ignore { border: none; color: var(--dim); font-size: 11px; margin-left: auto; }
    .pp-ignore:hover { color: var(--text); }

    .send-btn {
      width: 40px; height: 40px;
      background: linear-gradient(135deg, #4f8ef7, #3578e5);
      border: none; border-radius: 50%; color: white;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      font-size: 16px; flex-shrink: 0;
      transition: opacity .2s, transform .15s ease, box-shadow .2s;
      box-shadow: 0 2px 10px rgba(79,142,247,.35);
    }
    .send-btn svg { width: 18px; height: 18px; }
    @media (hover: hover) { .send-btn:hover { opacity: .9; box-shadow: 0 4px 16px rgba(79,142,247,.45); transform: scale(1.08); filter: brightness(1.15); } }
    .send-btn:active { transform: scale(.92); }
    .send-btn:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; transform: none; }
    .send-btn.cancel-mode {
      background: linear-gradient(135deg, var(--red-vivid), var(--red-dark));
      box-shadow: 0 2px 10px rgba(231,76,60,.35);
    }
    .send-btn.cancel-mode:hover { box-shadow: 0 4px 16px rgba(231,76,60,.5); }

    /* Inline info/error banners in chat */
    .asst-inline-info {
      color: var(--accent); border: 1px solid var(--accent);
      border-radius: var(--radius-sm); padding: 8px 14px;
      margin: 8px 0; font-size: 13px;
    }
    .asst-inline-error {
      color: var(--red); border: 1px solid var(--red);
      border-radius: var(--radius-sm); padding: 10px 14px;
      margin: 8px 0; font-size: 13px;
    }
    .asst-inline-standalone {
      text-align: center; color: var(--accent); font-size: 12px;
      padding: 6px 0; opacity: .8;
    }

    .hidden { display: none !important; }

    /* Touch — supprime le délai 300ms et le double-tap zoom */
    button, [role="button"], .act-btn, .chip, .send-btn, .conv-item, .h-btn, .mission-btn,
    .sidebar-new-btn, .sidebar-close-btn, .proj-add-btn, .proj-current, .proj-opt,
    .phase-dot, .notif-item, .user-menu-trigger, .tool-header, .git-section-header,
    .kd-project-item, .mission-menu-item, .conv-del, .conv-assign { touch-action: manipulation; }

    /* Badge agent actif dans la phase bar */
    .phase-agent-badge {
      background: var(--card); border: 1px solid var(--border);
      border-radius: 20px; padding: 2px 10px;
      font-size: 10px; color: var(--tool); font-family: 'JetBrains Mono',monospace;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
      animation: pulse-badge 1.5s ease-in-out infinite;
    }
    @keyframes pulse-badge {
      0%,100% { opacity: 1; }
      50%      { opacity: .6; }
    }

    .input-footer {
      display: flex; align-items: center; justify-content: space-between;
      margin-top: 8px; padding: 0 8px; font-size: 11px; color: var(--dim);
    }

    .stats-pills { display: flex; gap: 8px; flex-wrap: wrap; }
    .stat-pill {
      background: var(--card); border: 1px solid var(--border-soft);
      border-radius: 20px; padding: 3px 10px;
      font-family: 'JetBrains Mono',monospace; font-size: 10.5px; color: var(--muted);
      min-width: 0; text-align: center; font-variant-numeric: tabular-nums;
      flex-shrink: 0;
    }
    .hint-kb { font-size: 11px; color: var(--dim); }
    .char-count { font-size: 10px; color: var(--amber); font-family: 'JetBrains Mono', monospace; opacity: 0; transition: opacity .2s; pointer-events: none; }
    .char-count.visible { opacity: 1; pointer-events: auto; }
    .char-count.danger { color: var(--red); }

    /* Code block copy button */
    .code-copy-btn {
      position: absolute; top: 6px; right: 6px;
      background: var(--card); border: 1px solid var(--border);
      border-radius: 4px; color: var(--muted); cursor: pointer;
      font-size: 14px; padding: 2px 6px; opacity: 0;
      transition: opacity .15s, color .15s, background .15s;
      z-index: 1;
    }
    @media (hover: hover) { pre:hover .code-copy-btn { opacity: 1; } }
    @media (hover: none) { .code-copy-btn { opacity: .7; } }
    .code-copy-btn:hover { color: var(--text); background: var(--card-hover); }
    .code-copy-btn.copied { color: var(--green); }
    .code-copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }

    /* Spinner */
    .spin {
      display: inline-block; width: 16px; height: 16px;
      border: 2px solid var(--spin-border); border-top-color: var(--spin-top);
      border-radius: 50%; animation: spin .65s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Typing indicator */
    .typing-dots { display: flex; align-items: center; gap: 8px; padding: 6px 2px; }
    .typing-dots .tdots { display: flex; align-items: center; gap: 5px; }
    .typing-dots span {
      width: 7px; height: 7px; border-radius: 50%; background: var(--dim);
      animation: tdot 1.2s ease-in-out infinite;
    }
    .typing-dots span:nth-child(2) { animation-delay: .2s; }
    .typing-dots span:nth-child(3) { animation-delay: .4s; }
    @keyframes tdot { 0%,60%,100% { transform:translateY(0); opacity:.4; } 30% { transform:translateY(-5px); opacity:1; } }
    .typing-status { font-size: 11px; color: var(--dim); font-style: italic; }
    .stream-status-bar {
      display: flex; align-items: center; gap: 8px;
      font-size: 11px; color: var(--dim); margin-bottom: 6px;
      padding: 4px 8px; min-height: 22px;
      background: rgba(79,142,247,.04); border-radius: 6px;
    }
    .stream-status-bar .status-elapsed {
      font-variant-numeric: tabular-nums; font-weight: 600;
      color: var(--accent); min-width: 36px;
    }
    .stream-status-bar .status-phase { font-style: italic; }
    .stream-status-bar .status-phase.warn { color: var(--warn); font-style: normal; font-weight: 600; }

    /* Toast */
    .toast {
      position: fixed;
      top: max(18px, calc(env(safe-area-inset-top, 0px) + 8px)); /* overridden per-toast by JS */
      right: max(18px, env(safe-area-inset-right, 0px));
      background: var(--surface); border: 1px solid var(--red);
      border-radius: var(--radius-sm); color: var(--text);
      font-size: 13px; padding: 11px 16px; z-index: 9000;
      max-width: min(340px, calc(100vw - 36px));
      pointer-events: auto;
      animation: toastIn .3s cubic-bezier(.16,1,.3,1);
      box-shadow: 0 4px 16px rgba(0,0,0,.4);
    }
    .toast-info { border-color: var(--accent); color: var(--text); }

    /* Export PDF button */
    .export-pdf { position: relative; }
    .export-pdf .pdf-spinner {
      display: inline-block; width: 14px; height: 14px;
      border: 2px solid var(--muted); border-top-color: var(--accent);
      border-radius: 50%; animation: pdfSpin .7s linear infinite;
      vertical-align: middle; margin-right: 4px;
    }
    @keyframes pdfSpin { to { transform: rotate(360deg); } }
    .export-pdf:disabled { opacity: .5; cursor: not-allowed; }
    @keyframes toastIn { from { opacity:0; transform: translateX(16px); } to { opacity:1; transform: translateX(0); } }
    .retry-banner {
      display: flex; align-items: center; gap: 10px; justify-content: center;
      padding: 10px 16px; margin: 8px 16px; border-radius: var(--radius-sm);
      background: var(--amber-dim); border: 1px solid var(--amber);
      color: var(--text); font-size: 13px;
    }
    .retry-btn {
      background: var(--amber); color: #1a1200; border: none; border-radius: var(--radius-sm);
      padding: 5px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
      transition: opacity var(--duration-sm), transform .1s;
    }
    .retry-btn:hover { opacity: .85; }
    .retry-btn:active { transform: scale(0.96); }

    /* Banniere workflow interrompu */
    .wf-resume-banner {
      display: flex; align-items: center; gap: 12px; justify-content: space-between;
      flex-wrap: wrap;
      padding: 12px 16px; margin: 0 16px 8px;
      border-radius: var(--radius-sm);
      background: var(--surface); border: 1px solid var(--accent);
      color: var(--text); font-size: 13px;
      animation: toastIn .3s cubic-bezier(.16,1,.3,1);
    }
    .wf-resume-text { flex: 1; min-width: 0; line-height: 1.4; }
    .wf-resume-mission { opacity: .7; font-size: 12px; }
    .wf-resume-actions { display: flex; gap: 8px; flex-shrink: 0; }
    .wf-resume-btn {
      background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
      padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
      transition: opacity var(--duration-sm), transform .1s;
    }
    .wf-resume-btn:hover { opacity: .85; }
    .wf-resume-btn:active { transform: scale(0.96); }
    .wf-resume-dismiss {
      background: transparent; color: var(--dim); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 6px 12px; font-size: 13px; cursor: pointer;
      transition: background var(--duration-sm), color var(--duration-sm), transform .1s;
    }
    .wf-resume-dismiss:hover { background: var(--card); color: var(--text); }
    .wf-resume-dismiss:active { transform: scale(0.96); }

    /* Mobile */
    #sidebar-backdrop {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,0,0,.45);
      z-index: 500;
      animation: backdropIn .2s ease;
    }
    #sidebar-backdrop.visible { display: block; }
    @keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

    .sidebar-close-btn {
      display: none;
      background: none; border: none; color: var(--muted);
      cursor: pointer; font-size: 20px; padding: 2px 6px;
      border-radius: 6px; line-height: 1;
      transition: color .15s, background .15s;
    }
    .sidebar-close-btn:hover { color: var(--text); background: var(--card); }

    @media (max-width: 768px) {
      #sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 501;
        transform: translateX(-100%);
        width: var(--sidebar-w);
        transition: transform var(--duration-md) var(--ease-spring);
      }
      #sidebar.open { transform: translateX(0); }
      .sidebar-close-btn { display: flex; align-items: center; justify-content: center; }
      .header { padding: 0 14px; }
      .messages-area { padding: 20px 14px 10px; }
      .input-area {
        padding: 10px 14px;
        /* iOS < 11.2 fallback */
        padding-bottom: 14px;
        padding-bottom: constant(safe-area-inset-bottom, 14px);
        padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
      }
      .login-card { padding: 36px 24px 32px; margin: 16px; border-radius: 18px; }
      .bubble { max-width: 88%; }

      /* --- Git button: masquer le texte "Git" sur mobile pour éviter le surencombrement du header --- */
      .git-btn { font-size: 0; padding: 5px 10px; min-width: 44px; }
      .git-btn svg { display: inline-block; }
      .git-btn .git-badge { font-size: 9px; }

      /* --- Header compact --- */
      .header-user { display: none; }
      #logout-btn { font-size: 0; padding: 7px 9px; min-width: 44px; min-height: 44px; }
      #logout-btn::before { content: '↩'; font-size: 14px; }

      /* --- Input mobile --- */
      .input-footer > span.hint-kb { display: none; }
      .input-row { border-radius: 22px; padding: 6px 6px 6px 14px; }
      #msg-input { font-size: 16px; min-height: 44px; }
      .mission-btn { width: 44px; height: 44px; font-size: 17px; }
      .send-btn { width: 44px; height: 44px; font-size: 17px; }

      /* --- Notif button: touch target minimum 44px --- */
      .notif-btn { min-height: 44px; min-width: 44px; }

      /* --- touch-action: éliminer le délai de 300ms sur tous les boutons interactifs --- */
      button, [role="button"], .conv-item, .chip, .tool-header,
      .git-section-header, .phase-dot, .kd-btn, .proj-opt, .kd-project-item,
      .sidebar-new-btn, .sidebar-close-btn, .proj-add-btn, .proj-current,
      .notif-item, .user-menu-trigger, .mission-menu-item, .conv-del, .conv-assign {
        touch-action: manipulation;
      }

      /* --- Conv delete/assign: toujours visible sur touch --- */
      .conv-del { opacity: 0.55 !important; min-width: 44px; min-height: 44px; }
      .conv-assign { opacity: 0.55 !important; min-width: 44px; min-height: 44px; }
      .conv-item:active .conv-del { opacity: 1 !important; color: var(--red); }
      .conv-item:active .conv-assign { opacity: 1 !important; color: var(--accent); }

      /* --- Welcome screen moins de padding --- */
      .welcome { padding: 28px 12px 18px; }
      .welcome-text { font-size: 13.5px; margin-bottom: 18px; }
      .welcome-chips { gap: 8px; }
      .chip { font-size: 12px; padding: 6px 12px; }

      /* --- Messages: avatar légèrement plus petit --- */
      .msg { gap: 10px; }
      .avatar { width: 30px; height: 30px; font-size: 11px; }

      /* --- Annotation popover en bas de l'écran (bottom-sheet) --- */
      .annotation-popover {
        position: fixed !important;
        bottom: max(90px, calc(70px + env(safe-area-inset-bottom, 0px))) !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        top: auto !important;
        z-index: 800;
        border-radius: 14px;
        box-shadow: 0 -4px 32px rgba(0,0,0,.5);
        border-top: 2px solid var(--accent);
      }
      .msg.user .annotation-popover,
      .msg.assistant .annotation-popover {
        left: 12px !important;
        right: 12px !important;
      }

      /* --- Stats pills compactes --- */
      .stats-pills { gap: 5px; }
      .stat-pill { font-size: 10.5px; padding: 1px 6px; min-width: 0; }
      .toast { max-width: calc(100vw - 24px); left: 12px; right: 12px; width: auto; }

      /* --- Phase agent badge plus court --- */
      .phase-agent-badge { max-width: 120px; font-size: 9px; }

      /* --- Login screen: safe area haut/bas --- */
      #login-screen {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
      }
      /* --- Sidebar: évite que le contenu passe sous la Dynamic Island / notch iOS --- */
      #sidebar { padding-top: env(safe-area-inset-top, 0px); }
      /* --- Input: font-size ≥ 16px pour empêcher l'auto-zoom iOS --- */
      .annotation-popover textarea { font-size: 16px; }
      #conv-search { font-size: 16px; }

      /* --- Touch targets : 44×44px minimum (WCAG 2.5.5 / Apple HIG) --- */
      .sidebar-toggle { min-width: 44px; min-height: 44px; padding: 10px 12px; }
      .sidebar-close-btn { min-width: 44px; min-height: 44px; }
      .h-btn { min-height: 44px; min-width: 44px; }
      .act-btn { width: 44px; height: 44px; min-width: 44px; }
      /* proj-add-btn: agrandir la zone cliquable sans changer le visuel */
      .proj-add-btn { width: 44px; height: 44px; }
      /* phase-dot: agrandir sur mobile (défaut 28px trop petit) */
      .phase-dot { width: 32px; height: 32px; font-size: 10px; }
      /* git-section-header: agrandir zone de touch */
      .git-section-header { min-height: 44px; }

      /* --- Header : safe area pour notch / Dynamic Island --- */
      .header {
        padding-top: constant(safe-area-inset-top, 0px);
        padding-top: env(safe-area-inset-top, 0px);
      }

      /* --- Phase proposal card (CAS 3 workflow) --- */
      .phase-proposal-container { padding: 0 10px; }
      .phase-proposal-card {
        padding: 10px 12px;
        max-width: 100%;
        max-height: 50vh;
        max-height: 50dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
      }
      .pp-header { font-size: 12px; margin-bottom: 6px; }
      .pp-phases { gap: 2px 8px; }
      .pp-phase {
        min-height: 44px;
        min-width: 0;
        padding: 4px 0;
        touch-action: manipulation;
      }
      .pp-phase input[type="checkbox"] {
        width: 18px; height: 18px;
        min-width: 18px;
        touch-action: manipulation;
      }
      .pp-actions { gap: 8px; flex-wrap: wrap; margin-top: 8px; }
      .pp-btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 13px;
        touch-action: manipulation;
      }
      .pp-ignore { min-height: 36px; font-size: 12px; }
    }

    /* --- Very small screen height --- */
    @media (max-height: 400px) {
      .login-card { max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
    }

    @media (max-width: 480px) {
      .login-card { padding: 32px 24px 28px; max-width: calc(100% - 32px); }
    }

    /* --- Très petits écrans (≤ 390px) --- */
    @media (max-width: 390px) {
      /* Phase proposal : colonne unique sous 390px */
      .pp-phases { flex-direction: column; gap: 0; }
      .pp-phase { min-width: 0; width: 100%; }
      .pp-actions { flex-wrap: wrap; }
      .pp-btn { flex: 1 1 auto; min-width: 80px; }
      .login-card { padding: 28px 18px 22px; margin: 12px; }
      .logo-mark { width: 48px; height: 48px; font-size: 20px; }
      .logo-name { font-size: 24px; }
      .input-row { gap: 6px; padding: 5px 5px 5px 12px; border-radius: 20px; }
      .send-btn { width: 42px; height: 42px; }
      .mission-btn { width: 42px; height: 42px; }
      #msg-input { font-size: 16px; min-height: 42px; padding: 9px 0; }
      .header-logo { font-size: 16px; }
      .messages-area { padding: 16px 10px 8px; }
      .voice-bubble { min-width: 180px; }
    }
    /* --- Ultra petits écrans (320px) --- */
    @media (max-width: 320px) {
      .login-card { padding: 24px 14px 20px; margin: 8px; max-width: calc(100% - 16px); }
      .logo-mark { width: 42px; height: 42px; font-size: 18px; }
      .logo-name { font-size: 20px; }
      .welcome-logo { font-size: 28px; }
      .welcome-chips { flex-direction: column; }
      .chip { white-space: normal; text-align: center; }
      .msgs { gap: 16px; }
      .bubble { max-width: 95%; font-size: 13.5px; padding: 10px 12px; }
      .voice-bubble { max-width: 95%; min-width: min(200px, calc(100vw - 80px)); }
      .asst-text { font-size: 13.5px; }
      .input-row { gap: 4px; padding: 4px 4px 4px 10px; border-radius: 18px; }
      .send-btn { width: 40px; height: 40px; }
      .mission-btn { width: 40px; height: 40px; }
      .voice-btn { width: 40px; height: 40px; }
      #msg-input { font-size: 16px; min-height: 38px; padding: 8px 0; }
      .header-logo { font-size: 14px; }
      .header { padding: 0 10px; height: 48px; }
      .phase-dot { width: 26px; height: 26px; font-size: 9px; }
      .tool-card { font-size: 11px; }
      .toast { max-width: calc(100vw - 20px); right: 10px; font-size: 12px; padding: 8px 12px; }
    }

    /* ── Phase progress bar ── */
    #phase-bar {
      display: none;
      align-items: center;
      gap: 12px;
      padding: 7px 20px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      font-size: 11.5px;
      flex-shrink: 0;
    }
    #phase-bar.visible { display: flex; }
    .phase-steps {
      display: flex; align-items: center; gap: 3px; flex-shrink: 0;
    }
    .phase-dot {
      width: 28px; height: 28px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
      flex-shrink: 0; transition: background .3s, color .3s, border-color .3s, transform .3s;
      background: var(--card); color: var(--dim); border: 1px solid var(--border);
    }
    @media (hover: hover) {
      .phase-dot:hover { background: var(--card-hover); }
      .phase-dot.done:hover { background: var(--green-dim); }
      .phase-dot.active:hover { background: var(--accent-dim); }
    }
    .phase-dot.done   { background: var(--green-dim); color: var(--green); border-color: var(--green); }
    .phase-dot.skipped { background: transparent; color: var(--muted); border-color: var(--border); opacity: 0.4; text-decoration: line-through; }
    .phase-dot.active {
      background: var(--accent-dim); color: var(--accent); border-color: var(--accent);
      box-shadow: 0 0 8px var(--accent-glow);
      animation: pulseDot 1.5s ease-in-out infinite;
    }
    @keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: .7; } }
    .phase-sep { font-size: 8px; color: var(--border); }
    /* Phases non sélectionnées (grisées) */
    .phase-dot.pre-skipped { opacity: 0.25; pointer-events: none; }
    .phase-sep.pre-skipped { opacity: 0.25; }
    /* Badge compteur de lancements sur le dot */
    .phase-run-count {
      position: absolute; top: -5px; right: -5px;
      min-width: 14px; height: 14px; border-radius: 7px;
      background: var(--accent); color: var(--bg); font-size: 8px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      line-height: 1; padding: 0 3px;
    }
    .phase-dot { position: relative; }
    #phase-bar-name { color: var(--accent); font-weight: 600; font-size: 12px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #phase-bar-progress {
      font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; flex-shrink: 0;
    }
    @media (max-width: 768px) {
      #phase-bar { padding: 5px 12px; gap: 8px; overflow-x: auto; flex-wrap: nowrap; }
      .phase-steps { overflow-x: auto; flex-shrink: 1; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
      .phase-dot { scroll-snap-align: start; flex-shrink: 0; touch-action: manipulation; }
      #phase-bar-name { font-size: 10.5px; min-width: 0; }
      #phase-bar-progress { display: none; }
    }

    /* ── Bouton scroll-to-bottom ── */
    #scroll-bottom-btn {
      position: absolute;
      bottom: 68px;
      left: 50%;
      transform: translateX(-50%) translateY(8px);
      width: 36px; height: 36px;
      border-radius: 50%;
      background: var(--card);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      border: 1px solid var(--border);
      color: var(--muted);
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s, transform .2s, background .15s, color .15s;
      z-index: 50;
      box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }
    #scroll-bottom-btn.visible {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(0);
    }
    @media (hover: hover) {
      #scroll-bottom-btn:hover {
        background: var(--card-hover);
        color: var(--accent);
        border-color: var(--accent);
      }
    }
    #scroll-bottom-btn:active {
      transform: translateX(-50%) scale(0.93);
    }
    #scroll-bottom-btn svg { width: 18px; height: 18px; }

    @media (max-width: 768px) {
      #scroll-bottom-btn { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; }
      #scroll-bottom-btn svg { width: 16px; height: 16px; }
    }

    /* ── Phase summary cards ── */
    .phase-summary-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-left: 3px solid var(--green);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      padding: 14px 16px;
      margin: 8px 0;
      animation: msgFadeIn 0.3s ease-out;
    }
    .phase-summary-card.psc-error {
      border-left-color: var(--amber);
    }
    .phase-summary-card.psc-empty {
      border-left-color: var(--red);
    }
    .phase-summary-card .psc-title {
      font-size: 12px;
      font-weight: 700;
      color: var(--green);
      text-transform: uppercase;
      letter-spacing: .5px;
      margin-bottom: 6px;
      display: flex; align-items: center; gap: 6px;
    }
    .phase-summary-card.psc-error .psc-title { color: var(--amber); }
    .phase-summary-card.psc-empty .psc-title { color: var(--red); }
    .phase-summary-card .psc-body {
      font-size: 13px;
      color: var(--text);
      line-height: 1.6;
      max-height: 400px;
      overflow-y: auto;
    }

    /* ── Workflow recap card ── */
    .workflow-recap-card {
      background: var(--card);
      border: 1px solid var(--accent);
      border-radius: var(--radius-sm);
      padding: 16px 20px;
      margin: 12px 0;
      max-height: 500px;
      overflow-y: auto;
      animation: msgFadeIn 0.3s ease-out;
    }
    .workflow-recap-card .wrc-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: .5px;
      margin-bottom: 10px;
      display: flex; align-items: center; gap: 8px;
    }
    .workflow-recap-card .wrc-phase {
      display: flex; align-items: center; gap: 8px;
      padding: 5px 0;
      font-size: 13px;
      color: var(--text);
      border-bottom: 1px solid var(--border-soft);
    }
    .workflow-recap-card .wrc-phase:last-child { border-bottom: none; }
    .workflow-recap-card .wrc-phase:hover { background: var(--card); }
    .workflow-recap-card .wrc-check { color: var(--green); font-size: 14px; flex-shrink: 0; }
    .workflow-recap-card .wrc-num { color: var(--muted); font-size: 11px; min-width: 18px; }
    .workflow-recap-card .wrc-status {
      font-size: 12px;
      padding: 2px 8px;
      border-radius: 10px;
      background: var(--green-dim);
      color: var(--green);
      margin-left: auto;
      flex-shrink: 0;
    }

    /* ── Agent sections — conteneurs visuels par agent dans un workflow multi-agent ── */
    .agent-section {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      margin: 10px 0;
      overflow: hidden;
      background: var(--bg);
      transition: border-color .2s;
    }
    .agent-section-header {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 12px;
      background: var(--card);
      border-bottom: 1px solid var(--border-soft);
      font-size: 12px; font-weight: 600;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: .06em;
    }
    .agent-section-header .agent-icon {
      width: 22px; height: 22px; border-radius: 6px;
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700;
      background: var(--accent-dim); color: var(--accent);
    }
    .agent-section-header .agent-idx {
      font-size: 10px; color: var(--muted); font-weight: 400;
      margin-left: auto;
    }
    .agent-section-header .agent-status {
      font-size: 10px; font-weight: 400; color: var(--muted);
      margin-left: auto;
    }
    .agent-section-header .agent-status.running { color: var(--accent); }
    .agent-section-header .agent-status.done { color: var(--green); }
    .agent-section-body {
      padding: 8px 10px 4px;
      min-height: 20px;
    }
    .agent-section-footer {
      padding: 4px 12px 6px;
      font-size: 10px; color: var(--muted);
      border-top: 1px solid var(--border-soft);
      background: var(--card);
    }
    .agent-section.active { border-color: var(--accent); }
    .agent-section.completed { border-color: var(--green); opacity: .92; }
    .agent-section.empty-output { border-color: var(--border); opacity: .65; }
    .agent-section.empty-output .agent-section-body {
      padding: 10px 12px;
      font-size: 12px;
      color: var(--muted);
      font-style: italic;
    }
    .agent-section.empty-output .agent-section-body::before { content: '—'; color: var(--dim); font-style: italic; }

    /* ── Phase headers inline dans les réponses ── */
    .asst-text .phase-header {
      display: flex; align-items: center; gap: 10px;
      margin: 20px 0 12px;
      padding: 10px 14px;
      background: var(--accent-dim);
      border-left: 3px solid var(--accent);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      font-size: 15px; font-weight: 700; color: var(--text);
    }
    .asst-text .phase-header::before {
      content: '▶';
      font-size: 10px;
      color: var(--accent);
      flex-shrink: 0;
    }

    /* ═══════════════════════════ MSG ACTIONS */
    .msg-actions {
      display: flex; align-items: center; gap: 4px;
      margin-top: 4px;
      opacity: 0; pointer-events: none;
      transform: translateY(2px);
      transition: opacity .15s ease-out, transform .15s ease-out;
      background: var(--surface); border-radius: var(--radius-sm); padding: 2px; border: 1px solid var(--border-soft);
    }
    @media (hover: hover) {
      .msg-body:hover .msg-actions { opacity: 1; pointer-events: auto; transform: translateY(0); }
    }
    @media (hover: none) {
      .msg-body:hover .msg-actions { opacity: 0; pointer-events: none; }
    }
    .msg.touch-active .msg-actions {
      opacity: 1; pointer-events: auto; transform: translateY(0);
    }
    .msg.user .msg-actions { justify-content: flex-end; }

    .act-btn {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--muted);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      font-size: 13px; width: 32px; height: 32px; flex-shrink: 0;
      transition: color var(--duration-sm), background var(--duration-sm), transform .1s;
      position: relative;
    }
    @media (hover: hover) { .act-btn:hover { color: var(--text); background: var(--card-hover); transform: scale(1.08); } }
    .act-btn:active { transform: scale(.92); }
    .act-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
    .act-btn.act-success { color: var(--green) !important; }
    .act-btn[data-action="pin"].pinned { color: var(--accent) !important; }
    .act-btn[data-action="annotate"].has-note::after {
      content: ''; position: absolute; top: 3px; right: 3px;
      width: 5px; height: 5px; border-radius: 50%; background: var(--amber);
    }

    .pin-badge {
      display: none; position: absolute; top: -4px; right: -8px;
      font-size: 11px; line-height: 1; pointer-events: none;
    }
    .msg.pinned .pin-badge { display: block; }

    .annotation-popover {
      position: fixed; z-index: 800;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 12px;
      box-shadow: var(--shadow);
      width: 320px; max-width: calc(100vw - 48px);
    }
    /* position:fixed — left/top set by JS in openAnnotationPopover */
    .annotation-popover h4 { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
    .annotation-popover textarea {
      width: 100%; background: var(--card); border: 1px solid var(--border);
      border-radius: 6px; color: var(--text); font-family: 'Inter',sans-serif;
      font-size: 16px; line-height: 1.5; padding: 8px 10px; resize: vertical;
      min-height: 72px; outline: none;
      transition: border-color var(--duration-sm), box-shadow var(--duration-sm);
    }
    .annotation-popover textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
    .annotation-popover .ann-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
    .annotation-popover .ann-btn {
      font-size: 12px; padding: 4px 12px; border-radius: 6px;
      border: 1px solid var(--border); background: transparent; color: var(--muted);
      cursor: pointer; transition: background .15s, color .15s;
    }
    .annotation-popover .ann-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
    .annotation-popover .ann-btn:hover { background: var(--card-hover); color: var(--text); }
    .annotation-popover .ann-btn.primary:hover { opacity: .88; }

    .act-toast.act-toast-ok { border-color: var(--green); }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
      .login-card { animation: none; }
      .msgs-loader .spin::after { animation: none; }
      .cursor, .asst-cur::after { animation: none; }
      .phase-agent-badge { animation: none; }
      .typing-dots .tdots span { animation: none; }
      .toast, .act-toast { animation: none; }
      #sidebar-backdrop { animation: none; }
      .phase-dot.active { animation: none; }
      .msg-actions { transition: none; }
      .act-btn { transition: none; }
      .mission-btn, .send-btn { transition: none; transform: none !important; }
      .voice-btn { transition: none; }
      .voice-btn.recording { animation: none; }
      .voice-btn.processing svg { animation: none; }
      .voice-overlay { transition: none; }
      .voice-card { transition: none; }
      .voice-waveform .vw-bar { transition: none; }
      .voice-bubble .voice-play-btn { transition: none; }
      .voice-bubble .vl-dot { animation: none; }
      .voice-processing-spinner { animation: none; border-top-color: var(--accent); }
      .voice-transcript { transition: none; }
      .voice-stop-btn { transition: none; }
      .bash-live-dot { animation: none; }
    }

    /* ═══ Voice button ═══ */
    .voice-btn {
      width: 40px; height: 40px; touch-action: manipulation;
      background: transparent; border: 1.5px solid var(--border);
      border-radius: 50%; color: var(--muted);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      font-size: 16px; flex-shrink: 0; position: relative;
      transition: color .2s, background .2s, border-color .2s, transform .15s ease, box-shadow .3s;
    }
    @media (hover: hover) { .voice-btn:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.08); } }
    .voice-btn:active { transform: scale(0.92); }
    .voice-btn:disabled { opacity: .35; cursor: not-allowed; }
    .voice-btn svg { width: 18px; height: 18px; }
    .voice-btn.recording {
      color: #fff; background: var(--red-vivid); border-color: var(--red-vivid);
      animation: voice-pulse 1.5s ease-in-out infinite;
    }
    .voice-btn.processing {
      color: var(--accent); border-color: var(--accent);
      cursor: wait; opacity: .7;
    }
    .voice-btn.processing svg { animation: voice-spin 1s linear infinite; }

    @keyframes voice-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,.5); }
      50% { box-shadow: 0 0 0 10px rgba(231,76,60,0); }
    }
    @keyframes voice-spin {
      to { transform: rotate(360deg); }
    }

    .voice-timer {
      position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
      font-size: 11px; color: var(--red-vivid); font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      white-space: nowrap; pointer-events: none;
      background: var(--surface); padding: 1px 6px; border-radius: var(--radius-sm);
      border: 1px solid rgba(231,76,60,.3); /* matches --red-vivid */
    }

    /* Touch-action for voice button */
    .voice-btn.unsupported { display: none !important; }

    /* Mobile responsive for voice button */
    @media (max-width: 768px) {
      .voice-btn { width: 44px; height: 44px; font-size: 17px; }
    }
    @media (max-width: 390px) {
      .voice-btn { width: 42px; height: 42px; }
    }

    /* ═══ Voice Recording Overlay ═══ */
    .voice-overlay {
      position: fixed; inset: 0; z-index: 9998;
      background: rgba(8,13,20,.94);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; visibility: hidden;
      transition: opacity .3s ease, visibility .3s ease;
    }
    .voice-overlay.active { opacity: 1; visibility: visible; }
    body:has(.voice-overlay.active) #login-screen,
    body.voice-active #login-screen { pointer-events: none; }
    body:has(.voice-overlay.active) #chat-screen .header,
    body:has(.voice-overlay.active) #chat-screen .input-area,
    body:has(.voice-overlay.active) #chat-screen #main-area,
    body:has(.voice-overlay.active) #chat-screen #sidebar,
    body.voice-active #chat-screen .header,
    body.voice-active #chat-screen .input-area,
    body.voice-active #chat-screen #main-area,
    body.voice-active #chat-screen #sidebar { pointer-events: none; }

    .voice-card {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 28px;
      padding: 40px 36px 36px;
      width: 380px; max-width: calc(100vw - 32px);
      display: flex; flex-direction: column; align-items: center; gap: 24px;
      box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(79,142,247,.08);
      transform: scale(.92) translateY(12px);
      transition: transform .35s cubic-bezier(.16,1,.3,1);
      will-change: transform;
    }
    .voice-overlay.active .voice-card {
      transform: scale(1) translateY(0);
    }

    .voice-status {
      font-size: 14px; color: var(--muted);
      font-weight: 500; letter-spacing: .3px;
      text-align: center;
    }
    .voice-status.recording-text { color: var(--red-vivid); }
    .voice-status.processing-text { color: var(--accent); }
    .voice-status.success-text { color: var(--green); }

    .voice-timer-display {
      font-family: 'JetBrains Mono', monospace;
      font-size: clamp(36px, 8vw, 42px); font-weight: 600;
      color: var(--text);
      letter-spacing: .05em;
      font-variant-numeric: tabular-nums;
      line-height: 1;
    }

    /* Waveform bars */
    .voice-waveform {
      display: flex; align-items: center; justify-content: center;
      gap: 3px; height: 64px; width: 100%;
      padding: 0 8px;
    }
    .voice-waveform .bar {
      width: 4px; min-height: 4px;
      border-radius: 3px;
      background: linear-gradient(180deg, var(--accent), rgba(79,142,247,.4));
      transition: height .08s ease;
      will-change: height;
    }

    /* Processing spinner in overlay */
    .voice-processing-spinner {
      width: 48px; height: 48px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: voice-spin 0.8s linear infinite;
    }

    /* Stop button in overlay */
    .voice-stop-btn {
      width: 64px; height: 64px;
      background: linear-gradient(135deg, var(--red-vivid), var(--red-dark));
      border: none; border-radius: 50%;
      color: white; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 20px rgba(231,76,60,.4);
      transition: transform .15s ease, box-shadow .2s;
    }
    .voice-stop-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(231,76,60,.5); }
    .voice-stop-btn:active { transform: scale(.92); }
    .voice-stop-btn svg { width: 24px; height: 24px; }

    /* Cancel link */
    .voice-cancel {
      font-size: 13px; color: var(--dim);
      cursor: pointer; background: none; border: none;
      text-decoration: none; transition: color .2s;
    }
    .voice-cancel:hover { color: var(--text); }

    /* Transcription preview */
    .voice-transcript {
      font-size: 15px; color: var(--text);
      text-align: center; max-height: 80px;
      overflow-y: auto; word-break: break-word;
      line-height: 1.5; padding: 0 8px;
      opacity: 0; transition: opacity .3s;
    }
    .voice-transcript.show { opacity: 1; }

    /* Mobile overlay */
    @media (max-width: 768px) {
      .voice-card {
        width: 100%; max-width: 100%;
        border-radius: 0; min-height: 100vh; min-height: 100dvh;
        padding: 60px 24px 40px;
        padding-top: calc(60px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
        justify-content: center;
      }
      .voice-stop-btn { width: 72px; height: 72px; }
      .voice-stop-btn svg { width: 28px; height: 28px; }
      .voice-timer-display { font-size: 52px; }
      .voice-waveform { height: 80px; }
      .voice-waveform .bar { width: 5px; }
      /* Voice cancel: touch target minimum 44px pleine largeur */
      .voice-cancel { min-height: 44px; width: 100%; display: flex; align-items: center; justify-content: center; }
      /* Voice transcript: scroll momentum iOS */
      .voice-transcript { -webkit-overflow-scrolling: touch; }
    }
    @media (max-width: 390px) {
      .voice-card { padding: 48px 18px 32px; }
      .voice-timer-display { font-size: 44px; }
    }

    @media print {
      #sidebar, .input-area, .header, #phase-bar, #scroll-bottom-btn,
      .msg-actions, .voice-overlay, #login-screen, .sidebar-toggle,
      .toast, .wf-resume-banner, .retry-banner, #sidebar-backdrop { display: none !important; }
      #chat-screen { display: block !important; }
      #main-area { overflow: visible !important; }
      .messages-area { overflow: visible !important; padding: 0 !important; }
      body { background: white !important; color: black !important; font-size: 12pt !important; }
      .msg { break-inside: avoid; margin-bottom: 12pt; }
      .avatar { background: #999 !important; color: black !important; border: 1px solid #ccc !important; print-color-adjust: exact; }
      .bubble { background: #f0f0f0 !important; border-color: #ccc !important; color: black !important; max-width: 80% !important; }
      .asst-text, .asst-text *, .msg-body { color: black !important; }
      .asst-text pre, .asst-text code { background: #f5f5f5 !important; color: #333 !important; border-color: #ddd !important; }
      .asst-text a { color: #0055aa !important; text-decoration: underline !important; }
      .phase-summary-card, .workflow-recap-card, .agent-section { border: 1px solid #ccc !important; background: #fafafa !important; }
      .tool-card { border: 1px solid #ddd !important; background: #fafafa !important; }
      .tool-card .tool-body { max-height: none !important; opacity: 1 !important; overflow: visible !important; }
      a[href]::after { content: " (" attr(href) ")"; font-size: 10pt; color: #666; }
    }

    .msg.msg-new { animation: msgFadeIn 0.2s ease-out; }
    @keyframes msgFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

    ::selection { background: var(--accent-dim); color: var(--text); }

    /* ═══ High contrast / forced-colors mode ═══ */
    @media (forced-colors: active) {
      .phase-dot, .tool-card, .chip, .act-btn, .send-btn, .mission-btn, .voice-btn {
        border: 1px solid ButtonText;
      }
      .send-btn, .login-btn { forced-color-adjust: none; }
      .asst-text a { color: LinkText; }
      .sidebar-logo, .header-logo, .logo-name, .welcome-logo {
        -webkit-text-fill-color: unset;
        background: none; color: ButtonText;
      }
    }

    /* ═══════════════════════════ NOTIFICATIONS */
    .notif-wrap { position: relative; }
    .notif-btn { position: relative; padding: 5px 8px; }
    .notif-badge {
      position: absolute; top: -3px; right: -3px;
      min-width: 16px; height: 16px; padding: 0 4px;
      background: var(--red-vivid); color: white;
      font-size: 9px; font-weight: 700; line-height: 16px;
      border-radius: 8px; display: none;
      text-align: center;
    }
    .notif-badge.visible { display: block; }

    .notif-panel {
      position: absolute; top: calc(100% + 6px); right: 0;
      width: 340px; max-width: calc(100vw - 24px);
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      box-shadow: var(--shadow); z-index: 7000;
      display: none; flex-direction: column;
      animation: slideUp .2s var(--ease-spring);
    }
    .notif-panel.open { display: flex; }

    .notif-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 14px; border-bottom: 1px solid var(--border);
    }
    .notif-title { font-size: 13px; font-weight: 700; color: var(--text); }
    .notif-clear {
      background: none; border: none; color: var(--accent);
      font-size: 11px; font-weight: 600; cursor: pointer;
      padding: 2px 8px; border-radius: 4px;
      transition: background .15s;
    }
    .notif-clear:hover { background: var(--accent-dim); }

    .notif-list {
      max-height: 360px; overflow-y: auto;
      scrollbar-width: thin;
    }
    .notif-empty {
      padding: 32px 16px; text-align: center;
      color: var(--dim); font-size: 12px; font-style: italic;
    }
    .notif-item {
      display: flex; gap: 10px; padding: 10px 14px;
      border-bottom: 1px solid var(--border-soft);
      transition: background .1s; cursor: default;
    }
    .notif-item:last-child { border-bottom: none; }
    .notif-item:hover { background: var(--card-hover); }
    .notif-item.unread { background: var(--accent-dim); }
    .notif-item-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
    .notif-item-body { flex: 1; min-width: 0; }
    .notif-item-text {
      font-size: 12px; color: var(--text); line-height: 1.4;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .notif-item-time { font-size: 10px; color: var(--dim); margin-top: 3px; }
    .notif-item-label {
      display: inline-block; font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: .04em;
      color: var(--accent); background: var(--accent-dim);
      padding: 1px 5px; border-radius: 3px; margin-right: 4px;
      vertical-align: middle;
    }
    .notif-item-dismiss {
      background: none; border: none; color: var(--dim);
      cursor: pointer; font-size: 12px; padding: 2px;
      opacity: 0; transition: opacity .15s, color .15s;
      flex-shrink: 0; align-self: flex-start;
    }
    .notif-item:hover .notif-item-dismiss { opacity: 1; }
    .notif-item-dismiss:hover { color: var(--red); }

    @media (max-width: 600px) {
      .notif-panel {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0;
        width: 100%; max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: sheetUp .3s var(--ease-spring);
        padding-bottom: env(safe-area-inset-bottom, 0px);
      }
      .notif-list { max-height: 50vh; }
    }

    /* ═══════════════════════════ USER MENU DROPDOWN */
    .user-menu-wrap {
      position: relative;
    }
    .user-menu-trigger {
      display: flex; align-items: center; gap: 6px;
      padding: 4px 10px; cursor: pointer;
    }
    .user-menu-avatar {
      width: 26px; height: 26px; border-radius: 50%;
      background: var(--accent-dim); color: var(--accent);
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700;
    }
    .user-menu-name {
      font-size: 12px; color: var(--text); font-weight: 500;
      max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .user-menu {
      position: absolute; top: calc(100% + 6px); right: 0;
      min-width: 200px;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      box-shadow: var(--shadow);
      z-index: 7000;
      display: none; flex-direction: column;
      padding: 4px 0;
    }
    .user-menu.open { display: flex; }
    .user-menu-item {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 14px; font-size: 13px; color: var(--text);
      cursor: pointer; transition: background .15s;
    }
    .user-menu-item:hover { background: var(--card-hover); }
    .user-menu-item:focus-visible { background: var(--card-hover); outline: none; }
    .um-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
    .um-danger { color: var(--red); }
    .um-danger:hover { background: var(--red-dim); }
    .user-menu-sep {
      height: 1px; background: var(--border); margin: 4px 10px;
    }
    @media (max-width: 768px) {
      .user-menu-name { display: none; }
    }

    /* ═══════════════════════════ CHANGE PASSWORD MODAL */
    .pw-dialog {
      position: fixed; top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      margin: 0;
      border: 1px solid var(--border); border-radius: var(--radius);
      background: var(--surface); color: var(--text);
      padding: 28px 24px; width: 380px; max-width: calc(100vw - 32px);
      box-shadow: 0 16px 60px rgba(0,0,0,.7);
      z-index: 9000;
    }
    .pw-dialog[open] { display: flex; flex-direction: column; }
    .pw-dialog::backdrop {
      background: rgba(0,0,0,.6);
      -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    }
    .pw-title {
      margin: 0 0 20px; font-size: 17px; font-weight: 600;
      text-align: center;
    }
    .pw-label {
      display: block; font-size: 13px; font-weight: 500;
      color: var(--muted); margin-bottom: 6px; margin-top: 14px;
    }
    .pw-label:first-of-type { margin-top: 0; }
    .pw-input {
      display: block; width: 100%; padding: 12px 14px;
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm); color: var(--text);
      font-size: 16px; box-sizing: border-box;
      transition: border-color .15s;
      -webkit-appearance: none; appearance: none;
    }
    .pw-input:focus {
      border-color: var(--accent); outline: none;
      box-shadow: 0 0 0 3px var(--accent-glow);
    }
    .pw-error {
      color: var(--red); font-size: 13px; min-height: 20px;
      margin-top: 10px; text-align: center;
    }
    .pw-actions {
      display: flex; gap: 10px;
      margin-top: 20px;
    }
    .pw-cancel {
      flex: 1;
      background: var(--card); border: 1px solid var(--border);
      color: var(--muted); padding: 12px 16px;
      border-radius: var(--radius-sm); cursor: pointer;
      font-size: 14px; transition: all .15s;
      text-align: center;
    }
    .pw-cancel:hover { background: var(--card-hover); color: var(--text); }
    .pw-submit {
      flex: 1;
      background: var(--gradient-accent); border: none;
      color: #fff; padding: 12px 20px;
      border-radius: var(--radius-sm); cursor: pointer;
      font-size: 14px; font-weight: 600;
      transition: opacity .15s;
      text-align: center;
    }
    .pw-submit:hover { opacity: .9; }
    .pw-submit:disabled { opacity: .5; cursor: not-allowed; }
    @media (max-width: 768px) {
      .pw-dialog {
        left: 0; right: 0; width: auto; padding: 24px 18px;
        top: auto; bottom: 0;
        transform: none;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - 20px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 20px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
      }
      .pw-input { font-size: 16px; padding: 14px; }
      .pw-cancel, .pw-submit { padding: 14px; font-size: 15px; }
      .pw-actions { flex-direction: column-reverse; }
    }

    /* ═══════════════════════════ PROJECT DIALOG EXTRAS */
    .proj-auth-toggle {
      display: flex; gap: 0; border: 1px solid var(--border);
      border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 8px;
    }
    .proj-auth-opt {
      flex: 1; padding: 8px; font-size: 12px; font-weight: 500;
      background: var(--card); color: var(--muted);
      border: none; cursor: pointer; text-align: center;
      transition: all .15s;
    }
    .proj-auth-opt.active {
      background: var(--accent-dim); color: var(--accent); font-weight: 600;
    }
    .proj-auth-opt:not(.active):hover { background: var(--card-hover); }
    .proj-status {
      margin-top: 12px; padding: 10px 12px;
      border-radius: var(--radius-sm);
      font-size: 12px; line-height: 1.5;
      background: var(--card); border: 1px solid var(--border);
      max-height: 120px; overflow-y: auto;
    }
    .proj-status .ps-line {
      display: flex; align-items: center; gap: 6px; padding: 2px 0;
    }
    .proj-status .ps-icon { flex-shrink: 0; font-size: 13px; }
    .proj-status .ps-ok { color: var(--green); }
    .proj-status .ps-fail { color: var(--red); }
    .proj-status .ps-spin {
      width: 12px; height: 12px;
      border: 2px solid var(--spin-border); border-top-color: var(--accent);
      border-radius: 50%; animation: spin .6s linear infinite;
      flex-shrink: 0;
    }

    /* ═══════════════════════════ GIT SIDEBAR */
    .git-sidebar {
      position: fixed; top: 0; right: 0; bottom: 0;
      width: 380px; max-width: 90vw;
      background: var(--surface);
      border-left: 1px solid var(--border);
      z-index: 6000;
      display: flex; flex-direction: column;
      transform: translateX(100%);
      transition: transform .3s var(--ease-spring);
      box-shadow: -8px 0 40px rgba(0,0,0,.5);
    }
    .git-sidebar.open { transform: translateX(0); }
    .git-sidebar-backdrop {
      position: fixed; inset: 0; z-index: 5999;
      background: rgba(0,0,0,.4); opacity: 0; pointer-events: none;
      transition: opacity .25s var(--ease-std);
    }
    .git-sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

    .git-sidebar-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 16px; border-bottom: 1px solid var(--border);
      min-height: 56px;
    }
    .git-sidebar-header h3 {
      margin: 0; font-size: 14px; font-weight: 600; color: var(--text);
      display: flex; align-items: center; gap: 8px;
    }
    .git-sidebar-close {
      background: none; border: none; color: var(--muted);
      font-size: 18px; cursor: pointer; padding: 4px 8px;
      border-radius: var(--radius-sm);
      transition: background .15s, color .15s;
    }
    .git-sidebar-close:hover { background: var(--card-hover); color: var(--text); }

    .git-sidebar-body {
      flex: 1; overflow-y: auto; padding: 12px 14px;
      display: flex; flex-direction: column; gap: 14px;
    }

    /* Section card */
    .git-section {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm);
    }
    .git-section-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 12px; cursor: pointer;
      transition: background .15s;
      user-select: none;
      border-radius: var(--radius-sm);
    }
    .git-section-header:hover { background: var(--card-hover); }
    .git-section-title {
      font-size: 11px; font-weight: 600; text-transform: uppercase;
      letter-spacing: .05em; color: var(--muted);
      display: flex; align-items: center; gap: 6px;
    }
    .git-section-chevron {
      color: var(--dim); font-size: 12px;
      transition: transform .2s var(--ease-std);
    }
    .git-section.collapsed .git-section-chevron { transform: rotate(-90deg); }
    .git-section-body {
      padding: 8px 12px 12px;
      max-height: 500px; overflow-y: auto;
    }
    .git-section.collapsed .git-section-body {
      display: none;
    }

    /* Repo info */
    .git-repo-info { display: flex; flex-direction: column; gap: 6px; }
    .git-info-row {
      display: flex; align-items: center; gap: 8px;
      font-size: 12px; color: var(--muted);
    }
    .git-info-row .gi-label {
      font-weight: 500; color: var(--dim); min-width: 55px;
    }
    .git-info-row .gi-value {
      color: var(--text); font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
    }
    .git-info-row .gi-badge {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 8px; border-radius: 10px;
      font-size: 10px; font-weight: 600;
    }
    .gi-badge.badge-ok { background: var(--green-dim); color: var(--green); }
    .gi-badge.badge-warn { background: var(--amber-dim); color: var(--amber); }
    .gi-badge.badge-env { background: var(--accent-dim); color: var(--accent); }

    /* Worktree items */
    .git-wt-item {
      display: flex; align-items: flex-start; gap: 8px;
      padding: 8px 0; border-bottom: 1px solid var(--border-soft);
    }
    .git-wt-item:last-child { border-bottom: none; }
    .git-wt-dot {
      width: 8px; height: 8px; border-radius: 50%;
      margin-top: 4px; flex-shrink: 0;
    }
    .git-wt-dot.wt-main { background: var(--green); }
    .git-wt-dot.wt-active { background: var(--accent); animation: wsDotPulse 3s ease-in-out infinite; }
    .git-wt-dot.wt-stale { background: var(--amber); }
    .git-wt-info { flex: 1; min-width: 0; }
    .git-wt-branch {
      font-size: 12px; font-weight: 600; color: var(--text);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .git-wt-path {
      font-size: 10px; color: var(--dim);
      font-family: 'JetBrains Mono', monospace;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .git-wt-meta {
      font-size: 10px; color: var(--muted);
    }
    .git-wt-clean-btn {
      background: var(--amber-dim); color: var(--amber);
      border: none; font-size: 10px; padding: 2px 8px;
      border-radius: 10px; cursor: pointer; white-space: nowrap;
      transition: background .15s;
    }
    .git-wt-clean-btn:hover { background: rgba(245,166,35,.25); }

    /* Commit items */
    .git-commit-item {
      padding: 8px 0; border-bottom: 1px solid var(--border-soft);
    }
    .git-commit-item:last-child { border-bottom: none; }
    .git-commit-top {
      display: flex; align-items: center; gap: 8px;
    }
    .git-commit-hash {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px; color: var(--accent); font-weight: 500;
    }
    .git-commit-date {
      font-size: 10px; color: var(--dim); margin-left: auto;
    }
    .git-commit-msg {
      font-size: 12px; color: var(--text); margin-top: 2px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .git-commit-stats {
      display: flex; align-items: center; gap: 8px; margin-top: 4px;
    }
    .git-commit-stat {
      font-size: 10px; font-family: 'JetBrains Mono', monospace;
    }
    .git-commit-stat.ins { color: var(--green); }
    .git-commit-stat.del { color: var(--red); }
    .git-commit-stat.files { color: var(--muted); }
    .git-commit-diff-btn {
      background: none; border: 1px solid var(--border);
      color: var(--muted); font-size: 10px; padding: 2px 8px;
      border-radius: 10px; cursor: pointer; margin-left: auto;
      transition: all .15s;
    }
    .git-commit-diff-btn:hover {
      border-color: var(--accent); color: var(--accent);
    }

    /* Diff viewer */
    .git-diff-viewer {
      margin-top: 6px; background: var(--code-bg);
      border-radius: var(--radius-sm); overflow: hidden;
      max-height: 300px; overflow-y: auto;
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px; line-height: 1.5;
      display: none;
    }
    .git-diff-viewer.visible { display: block; }
    .git-diff-viewer pre {
      margin: 0; padding: 10px; white-space: pre-wrap; word-break: break-all;
    }
    .diff-add { color: var(--green); }
    .diff-del { color: var(--red); }
    .diff-hunk { color: var(--accent); font-weight: 600; }

    /* File status items */
    .git-file-item {
      display: flex; align-items: center; gap: 8px;
      padding: 4px 0; font-size: 11px;
    }
    .git-file-status {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600; width: 16px; text-align: center;
    }
    .git-file-status.st-M { color: var(--amber); }
    .git-file-status.st-A, .git-file-status.st-q { color: var(--green); }
    .git-file-status.st-D { color: var(--red); }
    .git-file-path {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px; color: var(--text);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      flex: 1;
    }

    /* Env selector */
    .git-env-option {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 10px; border-radius: var(--radius-sm);
      cursor: pointer; transition: background .15s;
    }
    .git-env-option:hover { background: var(--card-hover); }
    .git-env-radio {
      width: 14px; height: 14px; border-radius: 50%;
      border: 2px solid var(--border);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .git-env-option.active .git-env-radio {
      border-color: var(--accent);
    }
    .git-env-option.active .git-env-radio::after {
      content: ''; width: 6px; height: 6px;
      border-radius: 50%; background: var(--accent);
    }
    .git-env-label { font-size: 12px; color: var(--text); }
    .git-env-desc { font-size: 10px; color: var(--dim); }

    /* Header git button */
    .git-btn {
      position: relative;
    }
    .git-btn .git-badge {
      position: absolute; top: -2px; right: -2px;
      min-width: 14px; height: 14px;
      background: var(--green); color: var(--bg);
      font-size: 9px; font-weight: 700;
      border-radius: 7px; display: none;
      align-items: center; justify-content: center;
      padding: 0 3px; line-height: 14px;
    }
    .git-btn .git-badge.visible { display: flex; }
    .git-btn .git-badge.pulsing {
      animation: wsDotPulse 3s ease-in-out infinite;
    }

    /* Loading spinner for git sidebar */
    .git-loading {
      display: flex; align-items: center; justify-content: center;
      padding: 30px; color: var(--muted); font-size: 12px;
      gap: 8px;
    }
    .git-loading .spin {
      width: 16px; height: 16px;
      border: 2px solid var(--spin-border); border-top-color: var(--spin-top);
      border-radius: 50%; animation: spin .6s linear infinite;
    }

    /* Empty state */
    .git-empty {
      padding: 20px; text-align: center;
      color: var(--dim); font-size: 12px;
    }

    /* Refresh button */
    .git-refresh-btn {
      background: none; border: none; color: var(--muted);
      font-size: 14px; cursor: pointer; padding: 4px;
      border-radius: var(--radius-sm);
      transition: all .15s;
    }
    .git-refresh-btn:hover { color: var(--accent); background: var(--accent-dim); }
    .git-refresh-btn.spinning { animation: spin .6s linear infinite; }

    @media (max-width: 768px) {
      .git-sidebar { width: 100vw; max-width: none; }
      .git-sidebar-body {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
      }
      .git-sidebar-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    }

    /* ═══════════════════════════════════════════════════════════════════
       TOUCH DEVICES — Réinitialisation des états :hover collants
       Sur iOS/Android, le pseudo-class :hover peut rester actif après
       un tap. Ces règles neutralisent les effets visuels indésirables
       sur appareils sans pointeur précis (hover: none).
       ═══════════════════════════════════════════════════════════════════ */
    @media (hover: none) {
      /* Boutons principaux */
      .login-btn:hover { opacity: 1; box-shadow: var(--shadow-btn); }
      .kd-btn.primary:hover  { opacity: 1; }
      .kd-btn.secondary:hover { color: var(--muted); background: var(--card); }
      .kd-btn.danger:hover   { opacity: 1; }

      /* Sélecteur de projet */
      .kd-project-item:hover { background: transparent; }
      .proj-current:hover    { border-color: var(--border); background: var(--card); }
      .proj-add-btn:hover    { color: var(--dim); border-color: var(--border); }
      .proj-opt:hover        { background: transparent; }
      .proj-opt:hover .proj-opt-del { opacity: 0; }
      .proj-opt-del:hover    { color: var(--dim); background: transparent; }
      /* Rendre le bouton supprimer toujours visible au toucher */
      .proj-opt-del          { opacity: 0.55; }
      .proj-chip:hover       { border-color: transparent; color: var(--dim); }
      .proj-chip.active:hover { border-color: var(--accent); color: var(--accent); }
      .proj-chip-more:hover  { background: var(--accent-dim); color: var(--accent); }
      .proj-linked-item:hover { background: transparent; color: var(--muted); }

      /* Recherche */
      .conv-search-clear:hover { color: var(--dim); }

      /* Mission menu */
      .mission-menu-item:hover { background: transparent; }

      /* Boutons inline chat */
      .pp-btn:hover          { background: var(--bg); }
      .pp-ignore:hover       { color: var(--dim); }
      .send-btn.cancel-mode:hover { box-shadow: 0 2px 10px rgba(231,76,60,.35); }

      /* Code */
      .code-copy-btn:hover   { color: var(--muted); background: var(--card); }

      /* Bannières */
      .retry-btn:hover        { opacity: 1; }
      .wf-resume-btn:hover    { opacity: 1; }
      .wf-resume-dismiss:hover { background: transparent; color: var(--dim); }

      /* Sidebar */
      .sidebar-close-btn:hover { color: var(--muted); background: transparent; }

      /* Annotation popover */
      .annotation-popover .ann-btn:hover         { background: transparent; color: var(--muted); }
      .annotation-popover .ann-btn.primary:hover { opacity: 1; }

      /* Voice overlay */
      .voice-stop-btn:hover  { transform: none; box-shadow: 0 4px 20px rgba(231,76,60,.4); }
      .voice-cancel:hover    { color: var(--muted); }

      /* Notifications — dismiss toujours visible au toucher */
      .notif-clear:hover              { background: transparent; }
      .notif-item:hover               { background: transparent; }
      .notif-item.unread:hover        { background: var(--accent-dim); }
      .notif-item:hover .notif-item-dismiss { opacity: 0; }
      .notif-item-dismiss             { opacity: 0.55; }
      .notif-item-dismiss:hover       { color: var(--dim); }

      /* Menu utilisateur */
      .user-menu-item:hover  { background: transparent; }
      .um-danger:hover       { background: transparent; }

      /* Changement de mot de passe */
      .pw-cancel:hover       { background: transparent; color: var(--muted); }
      .pw-submit:hover       { opacity: 1; }

      /* Auth projet */
      .proj-auth-opt:not(.active):hover { background: transparent; }

      /* Workflow recap */
      .workflow-recap-card .wrc-phase:hover { background: transparent; }

      /* Fichiers agent */
      .agent-file-pill:hover { color: var(--muted); border-color: var(--border-soft); }

      /* Git sidebar */
      .git-sidebar-close:hover    { background: transparent; color: var(--muted); }
      .git-section-header:hover   { background: transparent; }
      .git-wt-clean-btn:hover     { background: rgba(245,166,35,.15); }
      .git-commit-diff-btn:hover  { opacity: 1; }
      .git-env-option:hover       { background: transparent; }
      .git-refresh-btn:hover      { color: var(--muted); background: transparent; }

      /* Liens dans les messages assistant */
      .asst-text a:hover { text-decoration-color: var(--accent); }
    }

    /* ═══════════════════════════ MOBILE COMPATIBILITY — CORRECTIONS COMPLÉMENTAIRES */

    /* Prevent scroll bounce propagation from nested scrollable areas */
    body { overscroll-behavior: none; }
    .messages-area, #conv-list, .proj-dropdown, .notif-list, .git-sidebar-body,
    .code-block, .output-block, pre {
      overscroll-behavior: contain;
    }

    @media (max-width: 768px) {
      /* Touch targets : tous les éléments interactifs ≥ 44px */
      .proj-opt { min-height: 44px; align-items: center; }
      .mission-menu-item { min-height: 44px; }
      .user-menu-item { min-height: 44px; }
      .wf-resume-btn { min-height: 44px; padding: 8px 16px; }
      .wf-resume-dismiss { min-height: 44px; padding: 8px 14px; }
      .pp-btn { min-height: 44px; padding: 10px 16px; font-size: 13px; }
      .pp-ignore { min-height: 44px; padding: 10px 12px; }

      /* Phase proposal card : pleine largeur sur mobile */
      .phase-proposal-card { max-width: 100%; }
      .pp-phase { flex: 1 1 45%; }

      /* Workflow resume banner : empiler verticalement sur petits écrans */
      .wf-resume-banner { flex-wrap: wrap; gap: 8px; }
      .wf-resume-actions { width: 100%; justify-content: flex-end; }

      /* proj-opt-del : toujours visible au toucher */
      .proj-opt-del { opacity: 0.55; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
      .proj-opt:active .proj-opt-del { opacity: 1; color: var(--red); }

      /* Checkboxes mp-phase : agrandir zone de toucher */
      .mp-phase { min-height: 36px; padding: 4px 0; }
      .mp-phase input[type="checkbox"] { width: 20px; height: 20px; }
    }

    @media (max-width: 600px) {
      /* User menu : bottom sheet sur mobile comme notif-panel */
      .user-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 32px rgba(0,0,0,.5);
        z-index: 7000;
        animation: sheetUp .25s var(--ease-spring);
      }
      .user-menu.open { display: flex; flex-direction: column; }
      .user-menu-item { padding: 14px 20px; font-size: 15px; min-height: 52px; }
      .user-menu-sep { margin: 6px 16px; }

      /* Mission menu : items plus hauts, autoriser le retour à la ligne */
      .mission-menu-item { min-height: 48px; padding: 12px 16px; white-space: normal; }
      .mission-menu-item .mi-icon { width: 32px; height: 32px; font-size: 16px; }

      /* Phase proposal card : padding ajusté */
      .phase-proposal-container { padding: 0 10px; }
      .phase-proposal-card { padding: 12px 14px; }
    }

    /* Empêcher le zoom iOS sur tous les champs de saisie */
    @media (max-width: 768px) {
      input[type="text"]:not([readonly]),
      input[type="password"],
      input[type="email"],
      input[type="number"],
      input[type="tel"],
      input[type="search"],
      textarea,
      select {
        font-size: max(16px, 1em) !important;
      }
    }

    /* ═══════════════════════════ MOBILE — CORRECTIONS ADDITIONNELLES */

    /* Scroll momentum iOS sur les conteneurs scrollables non couverts */
    .notif-list {
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }
    .git-sidebar-body {
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }

    @media (max-width: 768px) {
      /* Phase bar : scroll momentum horizontal sur iOS */
      #phase-bar { -webkit-overflow-scrolling: touch; }

      /* Phase dots : agrandir à 40px pour approcher le seuil WCAG 44px */
      .phase-dot { width: 40px; height: 40px; }

      /* Code copy button : zone de tap minimale 44px (WCAG 2.5.5) */
      .code-copy-btn { min-width: 44px; min-height: 44px; padding: 8px 10px; }

      /* Notification dismiss : zone de tap minimale 44px */
      .notif-item-dismiss { min-width: 44px; min-height: 44px; padding: 10px; display: flex; align-items: center; justify-content: center; }

      /* Git sidebar close : zone de tap minimale 44px */
      .git-sidebar-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

      /* Git sidebar wt-clean/commit-diff : touch targets 44px (WCAG 2.5.5) */
      .git-wt-clean-btn { min-height: 44px; padding: 10px 12px; }
      .git-commit-diff-btn { min-height: 44px; padding: 10px 12px; }
    }

    /* Ultra-petits écrans : réduire les phase dots */
    @media (max-width: 320px) {
      .phase-dot { width: 28px; height: 28px; }
    }