  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

  :root {
    /* Vercel/Linear inspired neutral palette */
    --bg-primary: #000000;
    --bg-secondary: #0A0A0A;
    --bg-tertiary: #111111;
    --bg-pane: #0A0A0A; 
    --bg-sidebar: #000000;
    --bg-input: #111111;
    
    --border-color: rgba(255,255,255,0.1);
    --border-accent: rgba(255,255,255,0.1);
    
    --text-primary: #EDEDED;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;
    
    /* White Primary Accents */
    --accent-primary: #FFFFFF;
    --accent-primary-text: #000000;
    
    /* Diff config colors */
    --diff-added-color: #2ea043;
    --diff-removed-color: #f85149;
    --diff-added-bg: rgba(46, 160, 67, 0.25);
    --diff-added-border: var(--diff-added-color);
    --diff-removed-bg: rgba(248, 81, 73, 0.25);
    --diff-removed-border: var(--diff-removed-color);
    
    /* Selection */
    --selection-bg: #FF69B4;
    --selection-text: #000000;
    --search-match-bg: rgba(255, 105, 180, 0.35);
    --search-match-border: #FF69B4;
    
    --sidebar-width: 320px;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --r: 6px;
    --pane-header-height: 42px;
    
    --pane-min-width: 160px;
    --pane-min-height: 100px;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: none; }

  html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
  }

  ::-webkit-scrollbar { width: 0; height: 0; display: none; }

  /* ── BOOT LOADING SCREEN ── */
  #boot-screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 200;
    background: var(--bg-primary);
    gap: 16px;
    transition: opacity 0.3s ease;
  }
  #boot-screen.hidden { display: none; }
  #boot-screen .boot-logo {
    width: 44px; height: 44px; overflow: hidden; position: relative; border-radius: 8px;
  }
  #boot-screen .boot-logo #boot-logo-stage {
    width: 240px; height: 240px;
    transform: scale(0.1833); transform-origin: top left;
    position: absolute; top: 0; left: 0;
  }
  #boot-screen .boot-text {
    font-size: 13px; color: var(--text-muted); font-weight: 400;
  }

  /* ── UPLOAD / PASTE SCREEN ── */
  #upload-screen {
    --bg-input: #0a0a0a;
    position: fixed; inset: 0;
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 120px;
    z-index: 100;
    background: rgba(0,0,0,0.75);
  }
  #upload-screen.visible { display: flex; }
  #upload-screen.hidden { display: none; }

  .startup-container {
    width: 640px;
    /* background: rgba(15, 15, 15, 0.85); */
    /* border: 1px solid var(--border-color); */
    /* border-radius: 16px; */
    padding: 32px;
    /* box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 32px 64px rgba(0,0,0,0.8); */
    display: flex; flex-direction: column; gap: 20px;
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .startup-container.fade-out {
    opacity: 0;
    transform: scale(0.97) translateY(12px);
    pointer-events: none;
  }
  .startup-header h2 { font-size: 20px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
  .startup-header p { color: var(--text-secondary); font-size: 14px; }

  /* ── STARTUP TABS ── */
  .startup-tabs {
    display: flex;
    justify-content: flex-start;
    gap: -20px;
    margin-top: 16px;
    margin-bottom: -21px; /* Overlaps input box to hide top border, offsets gap: 20px */
    position: relative;
    z-index: 10;
  }
  .startup-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 12px 32px 13px 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans); font-size: 13px; font-weight: 500;
    cursor: pointer;
    z-index: 1;
    text-align: left;
    outline: none;
  }
  .startup-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #151515;
    border-radius: 6px 6px 0 0;
    transform: perspective(100px) rotateX(12deg);
    transform-origin: bottom left;
  }
  .startup-tab:hover { color: var(--text-primary); }
  .startup-tab:hover::before { background: rgba(255, 255, 255, 0.05); }
  .startup-tab.active {
    color: var(--text-primary);
    z-index: 3;
  }
  .startup-tab.active::before {
    background: var(--bg-input);
    border-bottom: none;
  }

  /* ── TAB PANELS ── */
  .startup-tab-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
  }
  .startup-tab-panel.active { display: flex; }

  /* ── PROMPT COMPOSER (colour-caret input) ── */
  .prompt-composer {
    background: var(--bg-input);
    border-radius: 0 var(--r) var(--r) var(--r);
    border: 1px solid #151515;
    display: flex; flex-direction: column;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 5;
  }

  .prompt-editor-container {
    position: relative;
    padding: 14px 14px 8px 14px;
    cursor: text;
  }

  #prompt-editor {
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    outline: none;
    caret-color: transparent;
  }

  #prompt-editor:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block;
  }

  /* Custom Caret */
  #prompt-custom-caret {
    position: absolute;
    width: 2px;
    pointer-events: none;
    display: none;
    z-index: 10;
    transition: left 0.05s linear, top 0.05s linear;
  }

  .caret-blink {
    animation: caretBlink 1s step-end infinite;
  }
  @keyframes caretBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
  }

  /* Trail Elements */
  .prompt-caret-trail {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease-out;
  }

  /* Selection styling using dynamic variable */
  #prompt-editor::selection {
    background-color: var(--prompt-selection-bg, #4285F4);
    color: rgba(13, 13, 15, 0.85);
  }

  /* Action Bar */
  .prompt-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px 10px 10px;
  }

  .prompt-action-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .prompt-icon-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    width: 34px; height: 34px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; font-size: 16px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease,
                opacity 0.25s ease, max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                padding 0.3s ease, margin 0.3s ease, box-shadow 0.25s ease, border-width 0.25s ease;
    position: relative;
  }
  .prompt-icon-btn svg { width: 16px; height: 16px; }
  .prompt-icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
  }

  .prompt-send-btn {
    background: var(--accent-primary);
    color: var(--accent-primary-text);
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    min-width: 34px; max-width: 34px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; font-size: 16px;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.25), inset 0 1px 2px rgba(255,255,255,0.15);
    transition: background 0.2s ease, transform 0.1s ease,
                opacity 0.25s ease, max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                padding 0.3s ease, margin 0.3s ease, border-width 0.25s ease;
  }
  .prompt-send-btn svg { width: 16px; height: 16px; }
  .prompt-send-btn:hover { background: #E0E0E0; }
  .prompt-send-btn:active { transform: scale(0.95); }

  /* ── Prompt Mic tooltip ── */
  #prompt-mic-btn { position: relative; }
  #prompt-mic-btn::before {
    content: 'Voice input';
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%; transform: translateX(-50%) translateY(4px);
    background: rgba(30,30,34,0.95); color: var(--text-primary);
    font-size: 11px; font-weight: 500;
    padding: 4px 8px; border-radius: var(--r);
    white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-family: var(--font-sans); z-index: 30;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  #prompt-mic-btn:hover::before { opacity: 1; transform: translateX(-50%) translateY(0); }
  #prompt-mic-btn.recording-stop::before, #prompt-mic-btn.recording-paused::before { display: none; }

  /* Collapsed state for buttons during recording */
  .prompt-rec-collapsed {
    opacity: 0 !important;
    max-width: 0 !important; width: 0 !important; min-width: 0 !important;
    padding: 0 !important; margin: 0 !important; border-width: 0 !important;
    overflow: hidden !important; pointer-events: none !important;
  }

  /* Recording widget */
  .prompt-recording-widget {
    display: flex; align-items: center; gap: 8px;
    max-width: 0; opacity: 0; overflow: hidden;
    margin-left: -4px; margin-right: -4px;
    transition: max-width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.3s ease, margin 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    white-space: nowrap;
  }
  .prompt-recording-widget.active {
    max-width: 240px; opacity: 1;
    margin-left: 0; margin-right: 0;
  }

  .prompt-rec-timer {
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px; font-weight: 500;
    color: var(--text-secondary);
    min-width: 30px; text-align: right;
    letter-spacing: 0.3px; font-variant-numeric: tabular-nums;
  }

  .prompt-rec-waveform-wrap {
    display: flex; align-items: center; justify-content: center;
    gap: 2px; height: 24px; min-width: 80px;
  }

  .prompt-waveform-bar {
    width: 2.5px; min-height: 2.5px;
    border-radius: 1.25px;
    background: #f4a6a0;
    height: 2.5px;
    transition: height 0.06s ease-out;
    opacity: 0.85;
  }

  /* Mic button → Stop button (recording) */
  #prompt-mic-btn.recording-stop {
    background: #d93025; color: #ffffff;
    border: 1px solid #e8453a;
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.18);
  }
  #prompt-mic-btn.recording-stop:hover { background: #c5291e; }

  .prompt-stop-square {
    width: 12px; height: 12px;
    background: #ffffff; border-radius: 2px;
  }

  .prompt-play-solid {
    width: 0; height: 0;
    border-style: solid;
    border-width: 6px 0 6px 11px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 2px;
  }

  /* Mic button → Resume button (paused) */
  #prompt-mic-btn.recording-paused {
    background: #d93025; color: #ffffff;
    border: 1px solid #e8453a;
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.18);
  }
  #prompt-mic-btn.recording-paused:hover { background: #c5291e; }

  /* Spring collapse animation */
  @keyframes promptSpringCollapse {
    0%   { transform: scale(1); }
    30%  { transform: scale(0.88); }
    60%  { transform: scale(1.06); }
    80%  { transform: scale(0.97); }
    100% { transform: scale(1); }
  }
  #prompt-mic-btn.spring-back { animation: promptSpringCollapse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

  @keyframes promptMicRoll {
    from { transform: rotate(0deg); } to { transform: rotate(360deg); }
  }
  #prompt-mic-btn.mic-rolling { animation: promptMicRoll 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

  /* ── Prompt Attachments Tray ── */
  .prompt-attachments-tray {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 0 14px;
    max-height: 0;
    transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1), padding 0.3s ease;
  }
  .prompt-attachments-tray.active {
    padding: 10px 14px 0px 10px;
    max-height: 200px;
  }

  .prompt-file-pill {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 4px 10px 4px 8px;
    font-size: 11px; font-family: var(--font-sans);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, background 0.2s ease;
    transform-origin: left center;
    cursor: default;
  }
  .prompt-file-pill:hover {
    background: rgba(255,255,255,0.1);
  }
  .prompt-file-pill .prompt-pill-icon {
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    color: #9fb2ff;
  }
  .prompt-file-pill .prompt-pill-icon svg,
  .prompt-pill-close svg { width: 12px; height: 12px; }
  .prompt-pill-close {
    position: absolute; top: -3px; right: -3px;
    width: 16px; height: 16px;
    background: #333333; border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #ffffff; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    cursor: default;
  }
  .prompt-file-pill:hover .prompt-pill-close {
    opacity: 1; pointer-events: auto; transform: translateY(-1px);
  }

  /* ── PASTE AREA (Tab 2) ── */
  .paste-area-wrapper {
    border: 1px solid #151515;
    border-radius: 0 var(--r) var(--r) var(--r);
    background: var(--bg-input);
    padding: 12px;
    display: flex; flex-direction: column; gap: 12px;
    position: relative;
    z-index: 5;
    transition: border-color 0.2s;
  }
  
  #paste-input {
    width: 100%; height: 180px;
    background: transparent; border: none; color: var(--text-primary);
    font-family: var(--font-mono); font-size: 13px; line-height: 1.5;
    resize: none; outline: none;
  }
  #paste-input::placeholder { color: var(--text-muted); }

  .paste-actions {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 8px; border-top: 1px solid #0d0d0d;
  }
  .paste-actions .hint {
    color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 6px;
  }
  .paste-actions .hint kbd {
    background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: var(--font-sans);
  }

  .paste-render-btn {
    background: var(--accent-primary); color: var(--accent-primary-text);
    border: none; border-radius: 50%;
    width: 34px; height: 34px; min-width: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.25), inset 0 1px 2px rgba(255,255,255,0.15);
  }
  .paste-render-btn svg { width: 16px; height: 16px; }
  .paste-render-btn:hover { background: #E0E0E0; transform: scale(1.05); }
  .paste-render-btn:active { transform: scale(0.95); }

  /* ── Upload File Card (Tab 2) ── */
  .upload-file-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
    background: rgba(255,255,255,0.03);
    border: 1px dashed #181818;
    border-radius: var(--r);
    cursor: pointer;
    transition: all 0.2s;
  }
  .upload-file-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.2);
  }
  .upload-file-card-icon {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06);
    border-radius: var(--r);
    color: var(--text-secondary);
    flex-shrink: 0;
  }
  .upload-file-card-icon svg { width: 20px; height: 20px; }
  .upload-file-card-text {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
  }
  .upload-file-card-title {
    font-size: 13px; font-weight: 500; color: var(--text-primary);
  }
  .upload-file-card-sub {
    font-size: 12px; color: var(--text-muted);
  }
  .upload-file-card-btn {
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer; transition: all 0.2s;
  }
  .upload-file-card-btn svg { width: 16px; height: 16px; }
  .upload-file-card-btn:hover {
    background: rgba(255,255,255,0.12); color: var(--text-primary);
    border-color: rgba(255,255,255,0.2);
  }

  /* Legacy upload-btn kept for API modal etc. */
  .upload-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    background: var(--accent-primary); color: var(--accent-primary-text); border: none;
    border-radius: 8px;
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
  }
  .upload-btn:hover { background: #E0E0E0; transform: translateY(-1px); }
  .upload-btn.secondary {
    background: rgba(255,255,255,0.05); color: var(--text-primary); border: 1px solid var(--border-color);
  }
  .upload-btn.secondary:hover { background: rgba(255,255,255,0.1); }

  .divider { display: flex; align-items: center; text-align: center; color: var(--text-muted); font-size: 12px; font-weight: 500; }
  .divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
  .divider span { padding: 0 12px; }

  #file-input { display: none; }

  /* ── EDITOR LAYOUT ── */
  #editor-screen { 
    display: none; height: 100vh; flex-direction: row; 
    /* padding: 4px 4px 4px 4px; */
    padding-bottom: 8px;
  }
  #editor-screen.active { display: flex; }

  /* ── SIDEBAR ── */
  #sidebar {
    width: var(--sidebar-width); min-width: var(--sidebar-width); max-width: var(--sidebar-width);
    height: 100.55%; background: var(--bg-sidebar);
    display: flex; flex-direction: column; z-index: 10;
    transition: min-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
    overflow: visible; opacity: 1;
    position: relative;
    padding: 4px 0 0 0;
  }
  #sidebar.hidden {
    min-width: 0; max-width: 0; opacity: 0; border-right: none;
    overflow: hidden;
  }

  .sidebar-header {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    height: 48px; padding: 0 16px;
    flex-shrink: 0;
    z-index: 30;
    background: transparent;
  }
  .sidebar-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase;
    color: var(--text-primary);
  }
  .sidebar-actions { display: flex; gap: 4px; }
  .sidebar-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--r); color: var(--text-secondary);
    cursor: pointer; font-size: 12px; transition: all 0.2s;
  }
  .sidebar-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

  /* Chat */
  .chat-area {
    position: absolute; inset: 0;
    overflow-y: auto; padding: 56px 12px 140px 12px;
    display: flex; flex-direction: column; gap: 16px;
  }
  .chat-welcome {
    text-align: center; color: var(--text-muted); font-size: 13px;
    padding: 8px 14px; line-height: 1.6;
    position: absolute; bottom: 120px; left: 0; right: 0;
    pointer-events: none;
    animation: msgIn 0.4s ease-out;
    transition: opacity 0.3s ease;
  }
  .chat-welcome.hidden { opacity: 0; pointer-events: none; }
  .chat-msg {
    padding: 6px 10px; border-radius: var(--r);
    font-size: 13px; line-height: 1.55;
    max-width: 100%; word-wrap: break-word;
    animation: msgIn 0.25s ease-out;
    align-self: flex-start;
  }
  @keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .chat-msg.user {
    background: rgba(255,255,255,0.09); 
    /* border: 1px solid rgba(255,255,255,0.05); */
    color: var(--text-primary);
  }
  .chat-msg.assistant {
    background: transparent; border: none; padding: 2px;
    align-self: flex-start; color: var(--text-primary);
  }
  .chat-msg.system {
    background: transparent; border: none; padding: 0;
    color: var(--text-muted); font-size: 12px; text-align: center; align-self: center; margin-left:-8px;
  }
  .chat-msg pre {
    background: var(--bg-tertiary); padding: 8px 10px; border-radius: 6px;
    margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px;
    overflow-x: auto; white-space: pre-wrap; word-break: break-all;
    border: 1px solid rgba(255,255,255,0.1);
  }

  /* ── MARKDOWN IN CHAT ── */
  .md-rendered { line-height: 1.55; }
  .md-rendered p { margin: 0 0 8px; }
  .md-rendered p:last-child { margin-bottom: 0; }
  .md-rendered h1, .md-rendered h2, .md-rendered h3, .md-rendered h4 {
    color: var(--text-primary); font-weight: 600; margin: 10px 0 4px;
  }
  .md-rendered h1 { font-size: 16px; }
  .md-rendered h2 { font-size: 14.5px; }
  .md-rendered h3 { font-size: 13.5px; }
  .md-rendered h4 { font-size: 13px; }
  .md-rendered strong { color: var(--text-primary); font-weight: 600; }
  .md-rendered em { font-style: italic; }
  .md-rendered code {
    background: var(--bg-tertiary); padding: 1px 5px; border-radius: 4px;
    font-family: var(--font-mono); font-size: 11.5px;
    border: 1px solid rgba(255,255,255,0.08);
  }
  .md-rendered pre {
    background: var(--bg-tertiary); padding: 8px 10px; border-radius: 6px;
    margin: 8px 0; font-family: var(--font-mono); font-size: 11.5px;
    overflow-x: auto; white-space: pre-wrap; word-break: break-all;
    border: 1px solid rgba(255,255,255,0.1);
  }
  .md-rendered pre code {
    background: none; padding: 0; border: none; border-radius: 0;
  }
  .md-rendered ul, .md-rendered ol {
    margin: 6px 0; padding-left: 18px;
  }
  .md-rendered li { margin: 2px 0; }
  .md-rendered br { line-height: 1.3; }

  /* ── HEX COLOR SWATCH ── */
  .hex-swatch {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
    background: var(--swatch-color, transparent);
    border: 1px solid rgba(255,255,255,0.15);
    vertical-align: middle;
    margin-right: 3px;
    position: relative;
    top: -1px;
  }

  /* ── THINKING INDICATOR ── */
  .thinking-indicator {
    display: flex; align-items: center; gap: 10px;
  }
  .thinking-spring {
    width: 20px; height: 20px; flex-shrink: 0;
  }
  .thinking-spring path {
    fill: none; stroke: var(--text-muted);
    stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 200; stroke-dashoffset: 200;
    animation: thinkingDraw 2.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  }
  @keyframes thinkingDraw {
    0%   { stroke-dashoffset: 200; opacity: 0.3; }
    50%  { stroke-dashoffset: 0;   opacity: 1;   }
    100% { stroke-dashoffset: -200; opacity: 0.3; }
  }
  .thinking-label {
    font-size: 13px; font-weight: 400;
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--text-muted) 30%, var(--bg-secondary) 50%, var(--text-muted) 70%, var(--text-muted) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: thinkingShimmer 5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  }
  @keyframes thinkingShimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
  }

  .checkpoint-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0; align-self: stretch;
    animation: msgIn 0.3s ease-out;
  }
  .checkpoint-divider {
    flex: 1; height: 1px;
    background: linear-gradient(to var(--fade-dir, right), transparent, rgba(255,255,255,0.2));
  }
  .checkpoint-divider.right { --fade-dir: left; }
  .checkpoint-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; cursor: pointer;
    font-size: 11px; font-weight: 500; color: var(--text-secondary);
    transition: all 0.2s; flex-shrink: 0; white-space: nowrap;
  }
  .checkpoint-badge:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
  .checkpoint-badge.active { background: rgba(255,255,255,0.15); color: var(--text-primary); border-color: rgba(255,255,255,0.3); }
  .checkpoint-badge.cp-ai { background: rgba(255, 166, 87, 0.12); border-color: rgba(255, 166, 87, 0.35); color: #f0c4a0; }
  .checkpoint-badge.cp-ai:hover { background: rgba(255, 166, 87, 0.22); color: #f7d8c0; }
  .checkpoint-badge.cp-rejected { opacity: 0.45; }
  .checkpoint-badge.cp-rejected:hover { opacity: 0.7; }
  .checkpoint-badge.cp-restore { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.35); color: #93bbfc; }
  .checkpoint-badge.cp-restore:hover { background: rgba(59, 130, 246, 0.22); color: #b8d4fd; }
  .checkpoint-badge i { font-size: 10px; }
  .checkpoint-badge .cp-label { display: inline-block; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .checkpoint-badge .cp-time { font-size: 10px; opacity: 0.7; }
  .checkpoint-restore-btn {
    width: 24px; height: 24px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%; color: var(--text-secondary);
    cursor: pointer; font-size: 10px; transition: all 0.2s;
  }
  .checkpoint-restore-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); border-color: rgba(255,255,255,0.25); }
  .checkpoint-restore-btn.cp-ai-restore { background: rgba(255, 166, 87, 0.08); border-color: rgba(255, 166, 87, 0.3); color: #f0c4a0; }
  .checkpoint-restore-btn.cp-ai-restore:hover { background: rgba(255, 166, 87, 0.2); color: #f7d8c0; border-color: rgba(255, 166, 87, 0.5); }

  /* Collapsed checkpoint section */
  .cp-collapsed-section {
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .cp-summary-pill { cursor: pointer; }
  .cp-collapsed-toggle {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; cursor: pointer;
    font-size: 11px; font-weight: 500; color: var(--text-secondary);
    transition: all 0.2s; flex-shrink: 0; white-space: nowrap;
  }
  .cp-collapsed-toggle:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
  .cp-chevron {
    font-size: 9px; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .cp-collapsed-section.expanded .cp-chevron { transform: rotate(180deg); }
  .cp-expandable {
    max-height: 0; overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .cp-expandable .checkpoint-pill {
    opacity: 0; transform: translateY(-6px);
    animation: none;
  }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill {
    opacity: 1; transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(1) { transition-delay: 0.04s; }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(2) { transition-delay: 0.08s; }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(3) { transition-delay: 0.12s; }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(4) { transition-delay: 0.16s; }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(5) { transition-delay: 0.2s; }
  .cp-collapsed-section.expanded .cp-expandable .checkpoint-pill:nth-child(n+6) { transition-delay: 0.24s; }

  /* Variant-style Chat Input */
  .chat-input-area { 
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 8px; flex-shrink: 0; overflow: visible; z-index: 30; 
  }
  .chat-input-wrapper {
    background: var(--bg-input);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    padding: 8px 8px;
    display: flex; flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 114%;
    margin-left: -2%;
    position: relative;
    top: 8px;
  }
  .chat-input-wrapper:focus-within {
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  }

  /* Chat attachments tray (reuses prompt-file-pill styles) */
  .chat-attachments-tray {
    display: flex; gap: 6px; flex-wrap: wrap;
    max-height: 0; overflow: hidden;
    margin-bottom: 0;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), padding 0.3s ease, margin-bottom 0.3s ease;
    padding: 0;
  }
  .chat-attachments-tray.active {
    padding: 6px 2px 4px 2px;
    max-height: 120px;
    margin-bottom: 8px;
  }
  /* Chat editor container — contenteditable with custom caret */
  .chat-editor-container {
    position: relative;
    cursor: text;
    margin-bottom: 8px;
  }
  .chat-input {
    background: transparent; border: none; outline: none;
    color: var(--text-primary); font-family: var(--font-sans); font-size: 13.5px; line-height: 1.5;
    min-height: 22px; max-height: 150px; overflow-y: auto;
    padding: 0; width: 100%;
    caret-color: transparent;
  }
  .chat-input:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block;
  }
  .chat-input::selection {
    background-color: var(--chat-selection-bg, #4285F4);
    color: rgba(13, 13, 15, 0.85);
  }
  #chat-custom-caret {
    position: absolute;
    width: 2px;
    pointer-events: none;
    display: none;
    z-index: 10;
    transition: left 0.05s linear, top 0.05s linear;
  }
  /* Chat caret trail */
  .chat-caret-trail {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease-out;
  }
  
  .chat-input-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    height: 28px; min-height: 28px; max-height: 28px;
  }
  .toolbar-left { display: flex; gap: 6px; align-items: center; }
  .toolbar-right { display: flex; gap: 6px; align-items: center; flex-direction: row-reverse; }
  .icon-btn {
    background: transparent; border: none; color: var(--text-secondary);
    width: 26px; height: 26px; border-radius: 4px; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; font-size: 13px;
  }
  .icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
  
  /* Chat voice recording widget (sidebar) */
  .chat-recording-widget {
    display: flex; align-items: center; gap: 6px;
    max-width: 0; opacity: 0; overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.3s ease;
    white-space: nowrap;
    /* Prevent layout shift: use position so widget doesn't push neighbours */
    flex-shrink: 0;
  }
  .chat-recording-widget.active {
    max-width: 120px; opacity: 1;
  }
  /* Compact waveform for sidebar — half width of default (80px → 40px) */
  .chat-waveform-compact {
    min-width: 40px !important;
  }
  #chat-mic-btn { position: relative; }
  #chat-mic-btn.recording-stop {
    background: #d93025; color: #ffffff;
    border-radius: 50%;
  }
  #chat-mic-btn.recording-stop:hover { background: #c5291e; }
  #chat-mic-btn.recording-paused {
    background: #d93025; color: #ffffff;
    border-radius: 50%;
  }
  #chat-mic-btn.recording-paused:hover { background: #c5291e; }
  .chat-stop-square {
    width: 10px; height: 10px;
    background: #ffffff; border-radius: 2px;
  }
  .chat-play-solid {
    width: 0; height: 0;
    border-style: solid;
    border-width: 5px 0 5px 9px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 1px;
  }

  .model-selector {
    display: flex; align-items: center; gap: 6px; padding: 4px 4px;
    background: transparent; border-radius: 4px; cursor: pointer;
    color: var(--text-secondary); font-size: 12px; font-weight: 500;
    transition: all 0.2s; border: 1px solid transparent;
  }
  .model-selector:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); border-color: transparent; }
  .model-selector i.fa-sparkles { color: var(--text-primary); font-size: 11px; }
  .model-dropdown {
    position: absolute; bottom: calc(100% + 4px); left: 0;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 100; min-width: 240px; overflow: hidden;
    padding: 4px 0;
  }
  .model-dropdown.hidden { display: none; }
  .model-option {
    padding: 8px 12px; display: flex; align-items: center; gap: 8px; 
    cursor: pointer; color: var(--text-secondary); font-size: 13px;
    transition: background 0.2s, color 0.2s;
    position: relative;
  }
  .model-option:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
  .model-option img { opacity: 0.7; transition: opacity 0.2s; }
  .model-option:hover img { opacity: 1; }
  .model-option.active {
    background: rgba(64, 128, 255, 0.1);
    color: var(--text-primary);
  }
  .model-option.active img { opacity: 1; }
  .model-option .model-check {
    margin-left: auto;
    font-size: 11px;
    color: #4080ff;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .model-option.active .model-check {
    opacity: 1;
  }
  /* Pop Mode disabled entry */
  .model-option.disabled {
    cursor: not-allowed;
    opacity: 0.45;
  }
  .model-option.disabled:hover {
    background: transparent;
    color: var(--text-secondary);
  }
  .model-option .coming-soon-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
  }
  
  .chat-send-btn {
    width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-primary); color: var(--accent-primary-text);
    border-radius: 50px; border: none;
    cursor: pointer; font-size: 13px; transition: all 0.2s;
  }
  .chat-send-btn:hover { background: #E0E0E0; transform: scale(1.05); }
  @keyframes sendThunk {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-3px) rotate(-2deg); }
    30%  { transform: translateX(3px) rotate(2deg); }
    45%  { transform: translateX(-2px) rotate(-1deg); }
    60%  { transform: translateX(2px) rotate(1deg); }
    75%  { transform: translateX(-1px); }
    100% { transform: translateX(0); }
  }
  .chat-send-btn.thunk,
  .prompt-send-btn.thunk {
    animation: sendThunk 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  }

  /* ── SKETCH CANVAS ── */
  .sketch-canvas-wrap {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.3s ease,
                margin 0.3s ease;
    margin: 0;
    border-radius: 8px;
  }
  .sketch-canvas-wrap.active {
    max-height: 400px;
    opacity: 1;
    margin: 8px 14px 4px 14px;
  }
  #chat-sketch-wrap.active {
    margin: 8px 0 4px 0;
  }
  /* Inner wrapper for canvas + floating close */
  .sketch-canvas-inner {
    position: relative;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
  }
  .sketch-close-btn {
    position: absolute;
    top: 6px; right: 6px;
    z-index: 5;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
  }
  .sketch-close-btn:hover {
    background: rgba(0,0,0,0.7);
    color: var(--text-primary);
  }
  .sketch-canvas {
    display: block;
    width: 100%;
    height: 200px;
    cursor: crosshair;
    background-color: #0d0d0d;
    background-image: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 16px 16px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  /* Sidebar sketch canvas — more compact */
  #chat-sketch-canvas { height: 160px; }
  .sketch-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-top: none;
    border-radius: 0 0 8px 8px;
  }
  .sketch-tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .sketch-tool-btn {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
  }
  .sketch-tool-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
  }
  .sketch-tool-btn.active {
    background: rgba(64, 128, 255, 0.15);
    border-color: rgba(64, 128, 255, 0.3);
    color: #6ea8fe;
  }
  .sketch-color-picker {
    width: 22px; height: 22px;
    padding: 0; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
  }
  .sketch-color-picker::-webkit-color-swatch-wrapper { padding: 1px; }
  .sketch-color-picker::-webkit-color-swatch { border-radius: 2px; border: none; }
  .sketch-size-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
  }
  .sketch-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
  }
  .sketch-paste-hint {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .sketch-paste-hint kbd {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-sans);
    font-size: 10px;
  }

  /* Sketch reference thumbnail in chat messages */
  .chat-sketch-ref {
    margin-top: 8px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    max-width: 240px;
  }
  .chat-sketch-ref img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 5px;
  }

  /* ── MAIN AREA (Tabs + Container) ── */
  #main-area {
    flex: 1; display: flex; height: 100%; min-width: 0;
    position: relative; z-index: 1;
    margin: 4px 4px 4px 0;
  }

  /* ── HANGING TABS ── */
  .side-tabs {
    display: flex; flex-direction: column;
    margin-right: -1px; /* Overlaps container border */
    overflow: hidden; /* Allow cluster slide-out animation */
    position: relative;
    z-index: 2;
  }
  .side-tab {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-pane);
    border: 1px solid #1A1A1A;
    border-right: none;
    border-radius: var(--r) 0 0 var(--r);
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 4px;
    transition: color 0.2s;
  }
  .side-tab:hover { color: #4080ff; }
  .side-tab.active {
    color: #4080ff;
  }
  .tab-divider {
    height: 1px; background: transparent;
    margin: 8px 8px 12px 8px;
  }
  body.preview-active .side-tab {
    background: var(--preview-bg, var(--bg-tertiary)) !important;
    color: var(--preview-fg, var(--text-secondary)) !important;
    border-color: #1A1A1A !important;
    border-right: none !important;
  }
  body.preview-active .side-tab:hover {
    color: #4080ff !important;
  }
  body.preview-active .side-tab.active {
    color: #4080ff !important;
  }

  /* ── MAIN CONTAINER ── */
  #main-container {
    position: relative;
    z-index: 1;
    flex: 1; height: 100%;
    background: var(--bg-pane);
    border: 1px solid #1A1A1A;
    border-radius: 0 var(--r) var(--r) var(--r);
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  body.preview-active #main-container {
    position: relative;
    z-index: 1;
    border: 1px solid #1A1A1A;
  }

  /* ── PANES ── */
  #panes-container { flex: 1; display: flex; height: 100%; overflow: hidden; }

  /* ── Disintegration / reassembly effect on sidebar toggle ── */
  #panes-container.disintegrating {
    animation: pane-disintegrate 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
    pointer-events: none;
  }
  #panes-container.reassembling {
    animation: pane-reassemble 0.32s cubic-bezier(0, 0, 0.2, 1) forwards;
    pointer-events: none;
  }
  @keyframes pane-disintegrate {
    0%   { filter: none; opacity: 1; transform: scale(1); }
    35%  { filter: brightness(1.25) blur(0.5px); opacity: 0.85; }
    100% { filter: brightness(1.8) blur(3px) saturate(0.2); opacity: 0; transform: scale(1.012); }
  }
  @keyframes pane-reassemble {
    0%   { filter: brightness(1.8) blur(3px) saturate(0.2); opacity: 0; transform: scale(0.988); }
    60%  { filter: brightness(1.15) blur(0.5px); opacity: 0.85; }
    100% { filter: none; opacity: 1; transform: scale(1); }
  }

  .disintegrate-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 80;
    overflow: visible;
  }
  .disintegrate-particle {
    position: absolute;
    will-change: transform, opacity;
    pointer-events: none;
    border-radius: 1px;
  }
  
  .editor-pane {
    display: flex; flex-direction: column;
    min-width: 0; min-height: 0;
    height: 100%; overflow: hidden;
    flex: 1 1 0%;
  }
  .pane-header {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--pane-header-height); padding: 0 16px; background: var(--bg-pane);
    border-bottom: 1px solid var(--border-color); flex-shrink: 0; user-select: none;
  }
  .pane-header-left { display: flex; align-items: center; gap: 8px; }
  .pane-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; font-size: 11px; font-weight: 600; font-family: var(--font-mono);
    background: rgba(255,255,255,0.05); color: var(--text-secondary);
  }
  .pane-title { font-size: 12px; font-weight: 500; color: var(--text-primary); }

  .pane-body { flex: 1; overflow: auto; position: relative; }
  .pane-body .CodeMirror {
    height: 100%; font-family: var(--font-mono) !important;
    font-size: 12.5px; line-height: 1.6; background: transparent;
  }

  .resize-handle {
    width: 1px; min-width: 1px; cursor: col-resize; background: var(--border-color);
    flex-shrink: 0; position: relative; transition: background 0.15s; z-index: 5;
  }
  .resize-handle::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -6px; right: -6px;
    background: transparent; cursor: col-resize; pointer-events: auto;
    transition: background 0.15s;
  }
  .resize-handle:hover::before, .resize-handle.active::before { background: rgba(255,255,255,0.05); }
  .resize-handle:hover, .resize-handle.active { background: var(--text-secondary); }

  /* Responsive stacking for wide edge panes */
  #panes-container.stack-right,
  #panes-container.stack-left { display: grid; height: 100%; width: 100%; }
  #panes-container.stack-right { grid-template-columns: 1.6fr 1px 1fr; grid-template-rows: 1fr 1px 1fr; }
  #panes-container.stack-left { grid-template-columns: 1fr 1px 1.6fr; grid-template-rows: 1fr 1px 1fr; }

  #panes-container.stack-right #pane-html { grid-row: 1 / -1; grid-column: 1; }
  #panes-container.stack-right .resize-handle[data-left="pane-html"] { grid-row: 1 / -1; grid-column: 2; }
  #panes-container.stack-right #pane-css { grid-row: 1; grid-column: 3; }
  #panes-container.stack-right .resize-handle[data-left="pane-css"] { grid-row: 2; grid-column: 3; }
  #panes-container.stack-right #pane-js { grid-row: 3; grid-column: 3; }

  #panes-container.stack-left #pane-html { grid-row: 1; grid-column: 1; }
  #panes-container.stack-left .resize-handle[data-left="pane-html"] { grid-row: 2; grid-column: 1; }
  #panes-container.stack-left #pane-css { grid-row: 3; grid-column: 1; }
  #panes-container.stack-left .resize-handle[data-left="pane-css"] { grid-row: 1 / -1; grid-column: 2; }
  #panes-container.stack-left #pane-js { grid-row: 1 / -1; grid-column: 3; }

  #panes-container.stack-right .editor-pane,
  #panes-container.stack-left .editor-pane {
    height: auto; width: auto; min-width: 0; min-height: 0;
    overflow: hidden; flex: unset;
  }

  #panes-container.stack-right .resize-handle[data-left="pane-css"],
  #panes-container.stack-left .resize-handle[data-left="pane-html"] {
    width: auto; min-width: unset; height: 1px; min-height: 1px; cursor: row-resize;
  }
  #panes-container.stack-right .resize-handle[data-left="pane-css"]::before,
  #panes-container.stack-left .resize-handle[data-left="pane-html"]::before {
    left: 0; right: 0; top: -6px; bottom: -6px; cursor: row-resize;
  }

  /* ── LIVE PREVIEW ── */
  #preview-container { flex: 1; display: none; background: var(--preview-bg, var(--bg-pane)); height: 100%; width: 100%; position: relative; z-index: 0; overflow: hidden; border-top-right-radius: var(--r); border-top: 1px solid #1A1A1A; margin-top: -2px; }
  #preview-container.active { display: flex; flex-direction: column; }
  #preview-iframe { width: 100%; flex: 1; border: none; background: #FFFFFF; display: block; min-height: 0; opacity: 1; transition: opacity 0s; border-top-right-radius: var(--r); }
  #preview-iframe.loading { opacity: 0; }

  /* ── DIFF HIGHLIGHTS ── */
  .diff-indicator-gutter { width: 3px !important; min-width: 3px !important; padding: 0 !important; border: none !important; background: transparent !important; }
  .diff-ind-add { background: var(--diff-added-color) !important; width: 3px; min-height: 1.6em; }
  .diff-ind-remove { background: var(--diff-removed-color) !important; width: 3px; min-height: 1.6em; }
  .diff-ind-cp-added { background: #2ea043 !important; width: 3px; min-height: 1.6em; }
  .diff-ind-cp-removed { background: #f85149 !important; width: 3px; min-height: 1.6em; }

  .cm-diff-added { background: var(--diff-added-bg) !important; }
  .cm-diff-removed { background: var(--diff-removed-bg) !important; }

  /* Diff gutter (+/- markers) */
  .diff-gutter { width: 20px !important; background: transparent !important; border: none !important; }
  .diff-gutter-marker { font-family: var(--font-mono); font-size: 13px; font-weight: 700; width: 20px; text-align: center; line-height: 1.6; cursor: default; user-select: none; }
  .diff-gutter-add { color: var(--diff-added-color) !important; }
  .diff-gutter-remove { color: var(--diff-removed-color) !important; }

  .cm-cp-added { background: rgba(46, 160, 67, 0.25) !important; }
  .cm-cp-removed { background: rgba(248, 81, 73, 0.25) !important; }

  /* ── FOLD TOOLTIP (Glassmorphic) ── */
  .fold-tooltip {
    position: fixed; z-index: 10000;
    max-width: 380px; min-width: 200px;
    background: rgba(15, 15, 15, 0.75); backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r); padding: 12px 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    font-size: 12.5px; color: var(--text-primary); line-height: 1.5;
    pointer-events: auto;
    animation: tooltipIn 0.15s ease-out;
  }
  @keyframes tooltipIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .fold-tooltip .tooltip-loading { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
  .fold-tooltip .spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--border-accent); border-top-color: var(--accent-primary);
    border-radius: 50%; animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .fold-tooltip .tooltip-raw-code {
    font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
    white-space: pre-wrap; margin: 0; padding: 0; word-break: break-all;
  }
  .fold-tooltip .tooltip-api-prompt {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid transparent;
    border-image: linear-gradient(to right, transparent, rgba(255,255,255,0.08) 15%, rgba(255,255,255,0.08) 85%, transparent) 1;
    font-size: 11px; color: var(--text-secondary);
    display: flex; align-items: flex-start; gap: 6px;
  }
  .fold-tooltip .tooltip-api-prompt i {
    margin-top: 2px; /* align icon to first line of text */
    flex-shrink: 0;
  }

  /* ── TOAST (Glassmorphic) ── */
  .diff-toast {
    position: absolute; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px; padding: 14px 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    z-index: 2100;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 13px;
  }
  .diff-toast.visible { transform: translateX(-50%) translateY(0); }
  .diff-toast .toast-text { color: var(--text-secondary); }
  .diff-toast .toast-text strong { color: var(--text-primary); }
  .toast-btn {
    padding: 7px 16px; border: none; border-radius: 2px;
    font-family: var(--font-sans); font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
  }
  .toast-accept { background: var(--accent-primary); color: var(--accent-primary-text); }
  .toast-accept:hover { background: #E0E0E0; }
  .toast-reject {
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary);
  }
  .toast-reject:hover { background: rgba(255, 255, 255, 0.05); }

  /* ── MODAL (Glassmorphic) ── */
  .modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    z-index: 5000; display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
  }
  .modal-overlay.hidden { display: none; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  .modal-box {
    background: rgba(15, 15, 15, 0.7); backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px; width: 420px; padding: 32px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 24px 48px rgba(0,0,0,0.8);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }
  .modal-box h3 {
    font-size: 16px; font-weight: 500; margin-bottom: 6px;
    display: flex; align-items: center; gap: 10px; color: var(--text-primary);
  }
  .modal-box h3 i { color: var(--text-secondary); }
  .modal-box p { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
  .modal-input {
    width: 100%; padding: 10px 14px;
    background: rgba(0,0,0,0.5); border: 1px solid var(--border-color);
    border-radius: 4px; color: var(--text-primary);
    margin-top:8px;
    font-family: var(--font-mono); font-size: 13px;
    outline: none; margin-bottom: 18px; transition: border-color 0.2s;
  }
  .modal-input:focus { border-color: rgba(255,255,255,0.3); }
  .modal-input::placeholder { color: var(--text-muted); }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
  .modal-btn-primary {
    padding: 9px 22px; background: var(--accent-primary); color: var(--accent-primary-text); border: none;
    border-radius: 4px; font-family: var(--font-sans); font-size: 13px;
    font-weight: 500; cursor: pointer; transition: all 0.2s;
  }
  .modal-btn-primary:hover { background: #E0E0E0; }
  .modal-btn-secondary {
    padding: 9px 22px; background: transparent; color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: 4px;
    font-family: var(--font-sans); font-size: 13px; cursor: pointer; transition: all 0.2s;
  }
  .modal-btn-secondary:hover { background: rgba(255,255,255,0.05); }

  /* ── ELLIPSIS DROPDOWN (Glassmorphic) ── */
  .header-menu-wrap {
    position: fixed; top: 4px; right: 12px; z-index: 500;
    height: var(--pane-header-height);
    display: none; align-items: center; gap: 4px;
  }
  #editor-screen.active ~ .header-menu-wrap { display: flex; }
  .header-menu-wrap.preview-hidden { display: none !important; }
  .header-menu-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    border-radius: 6px; color: var(--text-secondary);
    cursor: pointer; font-size: 14px; transition: all 0.2s;
  }
  .header-menu-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
  .header-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    min-width: 200px; margin-top: 4px;
    background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    padding: 4px 0;
  }
  .header-dropdown.open { display: block; }
  .header-dropdown button {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: none; border: none;
    color: var(--text-secondary); font-family: var(--font-sans); font-size: 12px;
    cursor: pointer; transition: all 0.15s; text-align: left;
  }
  .header-dropdown button:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
  .header-dropdown button.danger { color: #f85149; }
  .header-dropdown button.danger:hover { background: rgba(248, 81, 73, 0.1); }
  .dropdown-divider {
    height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0;
  }
  .dropdown-label {
    padding: 6px 14px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); pointer-events: none;
  }
  .view-check {
    margin-left: auto; font-size: 10px; visibility: hidden;
  }
  .view-check.active { visibility: visible; }

  /* ── FIND POPOVER ── */
  .find-popover {
    display: none; position: absolute; top: 100%; right: 32px;
    width: 360px; margin-top: 4px;
    background: rgba(15, 15, 15, 0.9); backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    padding: 0 0 12px 0;
    z-index: 600;
    overflow: hidden;
  }
  .find-popover.open { display: block; }
  .find-mode-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--border-color);
  }
  .find-mode-tab {
    flex: 1; padding: 10px 12px; border: none; background: var(--bg-pane);
    color: var(--text-secondary); font-family: var(--font-sans); font-size: 11px;
    font-weight: 500; cursor: pointer; border-radius: 0; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    border-right: 1px solid var(--border-color);
  }
  .find-mode-tab:last-child { border-right: none; }
  .find-mode-tab.active {
    background: rgba(255,255,255,0.05); color: var(--text-primary);
  }
  .find-mode-tab:hover:not(.active) { color: var(--text-primary); background: rgba(255,255,255,0.03); }
  .find-input-row {
    display: flex; gap: 2px; align-items: center;
    padding: 8px 12px;
  }
  .find-input {
    flex: 1; padding: 6px 4px;
    background: transparent; border: none;
    color: var(--text-primary);
    font-family: var(--font-mono); font-size: 12px;
    outline: none;
  }
  .find-input::placeholder { color: var(--text-muted); }
  .find-nav-btn {
    width: 24px; height: 24px; flex-shrink: 0;
    display: none; align-items: center; justify-content: center;
    background: transparent; border: none;
    border-radius: 4px; color: var(--text-secondary);
    cursor: pointer; font-size: 11px; transition: all 0.2s;
  }
  .find-nav-btn.visible { display: flex; }
  .find-nav-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
  .find-results-info {
    margin-top: 10px; font-size: 11px; color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
    padding: 0 12px;
  }
  .find-results-info .match-count { color: var(--text-primary); font-weight: 500; }
  .find-results-list {
    margin-top: 8px; max-height: 200px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
    padding: 0 8px;
  }
  .find-result-item {
    padding: 6px 10px; border-radius: 6px; cursor: pointer;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
    transition: all 0.15s; display: flex; align-items: center; gap: 8px;
    background: transparent; border: none; width: 100%; text-align: left;
  }
  .find-result-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
  .find-result-item.active { background: rgba(255, 105, 180, 0.15); color: var(--text-primary); }
  .find-result-pane {
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 2px 5px; border-radius: 3px;
    background: rgba(255,255,255,0.08); color: var(--text-muted); flex-shrink: 0;
  }
  .find-result-line { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

  .logo-icon-container { width: 22px; height: 22px; overflow: hidden; cursor: pointer; position: relative; border-radius: 4px; display: inline-block; top: 2px; }
  .ai-logo-stage { width: 240px; height: 240px; transform: scale(0.08333333); transform-origin: top left; position: absolute; top: 0; left: 0; }
  .ai-logo-rect { position: absolute; transition: left 300ms ease-in-out, top 300ms ease-in-out, width 300ms ease-in-out, height 300ms ease-in-out, border-radius 300ms ease-in-out, background-color 300ms ease-in-out, transform 300ms ease-in-out; transform-origin: center center; z-index: 1; }
  .ai-logo-eye { position: absolute; width: 61.83px; height: 61.83px; border-radius: 50%; background: white; overflow: hidden; z-index: 2; }
  .ai-logo-rightEye { left: 115.83px; top: 72.58px; z-index: 5; }
  .ai-logo-leftEye { left: 62px; top: 72.58px; z-index: 3; animation: aiLeftEyeZ 1800ms linear infinite; animation-play-state: paused; }
  .ai-logo-stage.eyes-active .ai-logo-leftEye { animation-play-state: running; }
  @keyframes aiLeftEyeZ { 0%, 39% { z-index: 3; } 40%, 60% { z-index: 7; } 61%, 100% { z-index: 3; } }
  .ai-logo-pupil { position: absolute; width: 35px; height: 35px; border-radius: 50%; background: black; left: calc(50% - 17.5px); top: calc(50% - 17.5px); transform: translate(-18px, 0.6px); animation: aiPupilSpin 1800ms ease-in-out infinite; animation-play-state: paused; animation-fill-mode: both; }
  .ai-logo-stage.eyes-active .ai-logo-pupil { animation-play-state: running; }
  @keyframes aiPupilSpin { 0% { transform: translate(-18px, 0.6px); } 25% { transform: translate(0.6px, -18px); } 50% { transform: translate(18px, -0.6px); } 75% { transform: translate(0.6px, 18px); } 100% { transform: translate(-18px, 0.6px); } }

  /* ── CODEMIRROR OVERRIDES (Paraiso-dark Theme adjustments) ── */
  .CodeMirror { background: transparent !important; }
  .cm-s-paraiso-dark.CodeMirror { background: var(--bg-pane) !important; }
  .cm-s-paraiso-dark .CodeMirror-gutters { background: var(--bg-pane) !important; border-right: 1px solid var(--border-color) !important; }
  .CodeMirror-linenumber { color: var(--text-muted) !important; font-size: 11px !important; }
  .CodeMirror-foldgutter { width: 14px !important; }
  .CodeMirror-foldgutter-open,
  .CodeMirror-foldgutter-folded { cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .CodeMirror-foldgutter-open::after {
    content: ''; display: inline-block; width: 12px; height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  }
  .CodeMirror-foldgutter-folded::after {
    content: ''; display: inline-block; width: 12px; height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23EDEDED' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  }
  .CodeMirror-foldmarker {
    color: var(--text-primary) !important; text-shadow: none !important;
    font-family: var(--font-mono) !important; font-size: 11px !important;
    cursor: pointer; background: rgba(255,255,255,0.1);
    padding: 0 4px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.2);
  }
  .CodeMirror-activeline-background { background: rgba(255,255,255,0.03) !important; }
  .cm-hover-line { background: rgba(255,255,255,0.05) !important; position: relative; }
  .cm-hover-line::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: rgba(255,255,255,0.3); }
  .cm-hover-block { background: rgba(255,255,255,0.02) !important; position: relative; }
  .cm-hover-block::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.1); }

  /* Diff highlights override hover */
  .cm-diff-added.cm-hover-line, .cm-diff-added.cm-hover-block { background: var(--diff-added-bg) !important; }
  .cm-diff-removed.cm-hover-line, .cm-diff-removed.cm-hover-block { background: var(--diff-removed-bg) !important; }
  .cm-cp-added.cm-hover-line, .cm-cp-added.cm-hover-block { background: rgba(46, 160, 67, 0.25) !important; }
  .cm-cp-removed.cm-hover-line, .cm-cp-removed.cm-hover-block { background: rgba(248, 81, 73, 0.25) !important; }
  .cm-diff-added.cm-hover-line::before, .cm-diff-removed.cm-hover-line::before,
  .cm-cp-added.cm-hover-line::before, .cm-cp-removed.cm-hover-line::before { display: none; }

  /* Hot pink selection */
  .CodeMirror-selected { background: var(--selection-bg) !important; }
  .CodeMirror-focused .CodeMirror-selected { background: var(--selection-bg) !important; }
  .CodeMirror-selectedtext { color: var(--selection-text) !important; }
  .CodeMirror .CodeMirror-selected span { color: var(--selection-text) !important; }
  .CodeMirror-focused .CodeMirror-selected span { color: var(--selection-text) !important; }
  .cm-s-paraiso-dark div.CodeMirror-selected { background: var(--selection-bg) !important; }
  .cm-s-paraiso-dark.CodeMirror-focused div.CodeMirror-selected { background: var(--selection-bg) !important; }

  /* Search-match highlight */
  .cm-search-match { background: var(--search-match-bg) !important; outline: 1px solid var(--search-match-border); border-radius: 2px; }
  
  .pane-body .CodeMirror-scroll {
    background: transparent;
  }

  /* Diff banner in pane header */
  .diff-banner {
    display: none; align-items: center; gap: 8px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--r);
    font-size: 11px; color: var(--text-primary);
  }
  .diff-banner.visible { display: flex; }
  .diff-banner button {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 11px; padding: 2px 4px; border-radius: var(--r); transition: all 0.15s;
  }
  .diff-banner button:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }

  /* ── CODE LOADING OVERLAY ── */
  .code-loading-overlay {
    position: absolute; inset: 0;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 0 var(--r) var(--r) var(--r);
  }
  .code-loading-overlay.active { display: flex; }
  .code-loading-overlay .loading-spinner {
    display: flex; align-items: center; gap: 10px;
    color: var(--text-secondary); font-size: 13px;
  }
  .code-loading-overlay .spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border-accent);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

  /* ── MESSAGE TRUNCATION ── */
  .msg-content {
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .msg-content.truncated { max-height: var(--truncated-height, 100px); }
  .msg-content.expanded { max-height: var(--full-height, 5000px); }
  .msg-expand-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none;
    color: var(--text-muted); font-size: 11px;
    cursor: pointer; padding: 4px 0;
    font-family: var(--font-sans);
    transition: color 0.2s;
  }
  .msg-expand-btn:hover { color: var(--text-primary); }
  .msg-expand-btn i { font-size: 10px; transition: transform 0.3s ease; }
  .msg-expand-btn.expanded i { transform: rotate(180deg); }

  /* ── UNIFIED PANE MODE ── */
  .editor-pane.pane-hidden { display: none !important; }
  .resize-handle.handle-hidden { display: none !important; }
  #panes-container.unified-layout { display: flex !important; grid-template-columns: none !important; grid-template-rows: none !important; }
  #panes-container.unified-layout #pane-html { flex: 1 1 100% !important; width: 100% !important; }

  /* hidden must come AFTER unified-layout so it wins when both classes are present */
  #panes-container.hidden { display: none !important; }

  /* ── CONSOLE PANEL ── */
  #console-panel {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    z-index: 10;
  }
  #console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 30px;
    min-height: 30px;
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
  }
  #console-toggle {
    background: none; border: none; color: var(--text-secondary);
    font-family: var(--font-sans); font-size: 11px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    padding: 0;
  }
  #console-toggle:hover { color: var(--text-primary); }
  #console-toggle .console-chevron {
    font-size: 9px; transition: transform 0.2s ease; margin-left: 2px;
  }
  #console-panel.collapsed #console-toggle .console-chevron { transform: rotate(180deg); }
  #console-count {
    font-size: 10px; background: rgba(255,255,255,0.08); color: var(--text-muted);
    padding: 2px 5px; border-radius: 8px; min-width: 16px; text-align: center;
    display: none;
  }
  #console-count.visible { display: inline-block; }
  #console-clear {
    background: none; border: none; color: var(--text-muted);
    font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 3px;
  }
  #console-clear:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
  #console-body {
    height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    transition: height 0.2s ease;
  }
  #console-panel.collapsed #console-body { height: 0; padding: 0; overflow: hidden; }
  #console-logs {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    font-size: 11.5px;
    line-height: 1.55;
  }
  .console-line {
    padding: 1px 10px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    display: flex;
    gap: 8px;
    align-items: baseline;
    border-bottom: 1px solid rgba(255,255,255,0.025);
  }
  .console-line.log { color: var(--text-secondary); }
  .console-line.info { color: #58a6ff; }
  .console-line.warn { color: #d29922; background: rgba(210,153,34,0.06); }
  .console-line.error { color: #f85149; background: rgba(248,81,73,0.08); }
  .console-line .cl-badge {
    font-size: 9px; font-weight: 600; opacity: 0.5;
    text-transform: uppercase; flex-shrink: 0; min-width: 28px;
  }
  .console-line .cl-text { flex: 1; min-width: 0; }

  @keyframes consoleFlash {
    0% { background-color: rgba(255,255,255,0.06); }
    100% { background-color: transparent; }
  }
  #console-panel.console-flash #console-header {
    animation: consoleFlash 0.6s ease-out;
  }

  /* ── CUSTOM CONFIRM POPOVER ── */
  .confirm-overlay {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: flex-start; justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    opacity: 0; pointer-events: none;
    transition: background 0.35s ease, backdrop-filter 0.35s ease, opacity 0.25s ease;
  }
  .confirm-overlay.visible {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    opacity: 1; pointer-events: auto;
  }
  .confirm-popover {
    margin-top: 80px;
    background: rgba(22, 22, 24, 0.88);
    backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 12px;
    min-width: 320px; max-width: 400px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.04) inset;
    transform: translateY(32px) scale(0.97);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    will-change: transform, opacity;
  }
  .confirm-overlay.visible .confirm-popover {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  .confirm-overlay.dismissing .confirm-popover {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 1, 1), opacity 0.2s ease;
  }
  .confirm-overlay.dismissing {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    opacity: 0;
    transition: background 0.25s ease, backdrop-filter 0.25s ease, opacity 0.25s ease;
  }
  .confirm-message {
    font-size: 14px; line-height: 1.55;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 22px;
    font-weight: 500;
  }
  .confirm-actions {
    display: flex; gap: 10px; justify-content: center;
  }
  .confirm-btn {
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    padding: 9px 22px; border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer; transition: all 0.18s ease;
    position: relative; overflow: hidden;
    -webkit-user-select: none; user-select: none;
  }
  .confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
  }
  .confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
  }
  .confirm-btn-ok {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
  }
  .confirm-btn-ok:hover {
    background: rgba(255, 255, 255, 0.16);
  }
  .confirm-btn-danger {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
  }
  .confirm-btn-danger:hover {
    background: rgba(220, 38, 38, 0.35);
  }

  /* Hold-to-confirm progress bar */
  .confirm-btn-hold {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
    position: relative; overflow: hidden;
    -webkit-user-select: none; user-select: none;
    touch-action: none;
  }
  .confirm-btn-hold .hold-fill {
    position: absolute; inset: 0; width: 0%;
    background: rgba(220, 38, 38, 0.85);
    transition: width 0s linear;
    pointer-events: none;
  }
  .confirm-btn-hold .hold-fill.filling {
    width: 100%;
    transition: width 1.2s cubic-bezier(0.25, 0, 0.5, 1);
  }
  .confirm-btn-hold .hold-fill.spring-back {
    width: 0% !important;
    transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .confirm-btn-hold .hold-label {
    position: relative; z-index: 1;
    color: #fff;
  }

  /* Progressive Blur Top */
  .progressive-blur-top {
    position: absolute; z-index: 25; top: 0; left: 0; right: 0; height: 65px; pointer-events: none;
  }
  .progressive-blur-top > div, .progressive-blur-top::before, .progressive-blur-top::after {
    position: absolute; inset: 0;
  }
  .progressive-blur-top::before {
    content: ""; z-index: 1; backdrop-filter: blur(0.5px); -webkit-backdrop-filter: blur(0.5px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 0%, black 12.5%, black 25%, rgba(0,0,0,0) 37.5%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 0%, black 12.5%, black 25%, rgba(0,0,0,0) 37.5%);
  }
  .progressive-blur-top > div:nth-of-type(1) {
    z-index: 2; backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 12.5%, black 25%, black 37.5%, rgba(0,0,0,0) 50%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 12.5%, black 25%, black 37.5%, rgba(0,0,0,0) 50%);
  }
  .progressive-blur-top > div:nth-of-type(2) {
    z-index: 3; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 25%, black 37.5%, black 50%, rgba(0,0,0,0) 62.5%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 25%, black 37.5%, black 50%, rgba(0,0,0,0) 62.5%);
  }
  .progressive-blur-top > div:nth-of-type(3) {
    z-index: 4; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 37.5%, black 50%, black 62.5%, rgba(0,0,0,0) 75%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 37.5%, black 50%, black 62.5%, rgba(0,0,0,0) 75%);
  }
  .progressive-blur-top > div:nth-of-type(4) {
    z-index: 5; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 50%, black 62.5%, black 75%, rgba(0,0,0,0) 87.5%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 50%, black 62.5%, black 75%, rgba(0,0,0,0) 87.5%);
  }
  .progressive-blur-top > div:nth-of-type(5) {
    z-index: 6; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 62.5%, black 75%, black 87.5%, rgba(0,0,0,0) 100%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 62.5%, black 75%, black 87.5%, rgba(0,0,0,0) 100%);
  }
  .progressive-blur-top > div:nth-of-type(6) {
    z-index: 7; backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 75%, black 87.5%, black 100%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 75%, black 87.5%, black 100%);
  }
  .progressive-blur-top::after {
    content: ""; z-index: 8; backdrop-filter: blur(64px); -webkit-backdrop-filter: blur(64px);
    mask: linear-gradient(to top, rgba(0,0,0,0) 87.5%, black 100%);
    -webkit-mask: linear-gradient(to top, rgba(0,0,0,0) 87.5%, black 100%);
  }

  /* Progressive Blur Bottom */
  .progressive-blur-bottom {
    position: absolute; z-index: -1; top: 2px; bottom: 0; left: 0; right: 0; pointer-events: none;
  }
  .progressive-blur-bottom > div, .progressive-blur-bottom::before, .progressive-blur-bottom::after {
    position: absolute; inset: 0;
  }
  .progressive-blur-bottom::before {
    content: ""; z-index: 1; backdrop-filter: blur(0.5px); -webkit-backdrop-filter: blur(0.5px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 0%, black 12.5%, black 25%, rgba(0,0,0,0) 37.5%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 0%, black 12.5%, black 25%, rgba(0,0,0,0) 37.5%);
  }
  .progressive-blur-bottom > div:nth-of-type(1) {
    z-index: 2; backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 12.5%, black 25%, black 37.5%, rgba(0,0,0,0) 50%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 12.5%, black 25%, black 37.5%, rgba(0,0,0,0) 50%);
  }
  .progressive-blur-bottom > div:nth-of-type(2) {
    z-index: 3; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 25%, black 37.5%, black 50%, rgba(0,0,0,0) 62.5%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 25%, black 37.5%, black 50%, rgba(0,0,0,0) 62.5%);
  }
  .progressive-blur-bottom > div:nth-of-type(3) {
    z-index: 4; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 37.5%, black 50%, black 62.5%, rgba(0,0,0,0) 75%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 37.5%, black 50%, black 62.5%, rgba(0,0,0,0) 75%);
  }
  .progressive-blur-bottom > div:nth-of-type(4) {
    z-index: 5; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 50%, black 62.5%, black 75%, rgba(0,0,0,0) 87.5%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 50%, black 62.5%, black 75%, rgba(0,0,0,0) 87.5%);
  }
  .progressive-blur-bottom > div:nth-of-type(5) {
    z-index: 6; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 62.5%, black 75%, black 87.5%, rgba(0,0,0,0) 100%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 62.5%, black 75%, black 87.5%, rgba(0,0,0,0) 100%);
  }
  .progressive-blur-bottom > div:nth-of-type(6) {
    z-index: 7; backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 75%, black 87.5%, black 100%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 75%, black 87.5%, black 100%);
  }
  .progressive-blur-bottom::after {
    content: ""; z-index: 8; backdrop-filter: blur(64px); -webkit-backdrop-filter: blur(64px);
    mask: linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, black 100%);
    -webkit-mask: linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, black 100%);
  }

