    /* ==========================================================================
       CSS RESET & DESIGN SYSTEM VARIABLES (LIGHT THEME DEFAULT)
       ========================================================================== */
    :root, [data-theme="light"] {
      /* Flwflw Semantic Tokens */
      --brand: #f59e0b;
      --brand-strong: #d97706;
      --brand-soft: #fef3c7;
      --brand-rgb: 245, 158, 11;

      --accent-ai: #8b5cf6;
      --accent-info: #38bdf8;
      --accent-success: #10b981;
      --accent-warning: #f59e0b;
      --accent-danger: #ef4444;

      --surface-canvas: #f6f7f9;
      --surface-panel: #ffffff;
      --surface-raised: #fafafa;
      --surface-hover: #f4f4f5;
      --divider: #e4e4e7;

      --radius-sm: 6px;
      --radius-md: 9px;
      --radius-lg: 13px;
      --radius-xl: 18px;
      --radius-full: 9999px;

      /* Legacy Webcode Aliases */
      --bg-main: var(--surface-canvas);
      --bg-panel: var(--surface-panel);
      --bg-panel-header: var(--surface-hover);
      --bg-card: var(--surface-raised);
      --bg-card-hover: var(--surface-hover);
      --bg-input: var(--surface-panel);
      --bg-border: var(--divider);
      --border-subtle: var(--divider);

      --accent-primary: var(--brand);
      --accent-primary-hover: var(--brand-strong);
      --accent-secondary: var(--accent-ai);
      --accent-secondary-hover: #7c3aed;
      --accent-success-hover: #059669;
      --accent-warning-bg: var(--brand-soft);
      --accent-danger-bg: #fef2f2;

      --text-main: #18181b;
      --text-muted: #52525b;
      --text-subtle: #a1a1aa;
      --text-link: var(--brand-strong);

      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

      --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

      --transition-fast: 0.15s ease;
      --transition-normal: 0.25s ease;

      --left-width: 320px;
      --right-width: 40%;
    }

    [data-theme="dark"] {
      /* Flwflw Dark Semantic Tokens */
      --surface-canvas: #09090b;
      --surface-panel: #18181b;
      --surface-raised: #27272a;
      --surface-hover: #3f3f46;
      --divider: #3f3f46;
      
      --brand-soft: rgba(245, 158, 11, 0.15);
      --accent-danger-bg: rgba(239, 68, 68, 0.15);

      /* Legacy Webcode Aliases */
      --bg-main: var(--surface-canvas);
      --bg-panel: var(--surface-panel);
      --bg-panel-header: var(--surface-raised);
      --bg-card: var(--surface-raised);
      --bg-card-hover: var(--surface-hover);
      --bg-input: var(--surface-canvas);
      --bg-border: var(--divider);
      --border-subtle: var(--divider);

      --accent-primary: var(--brand);
      --accent-primary-hover: #fbbf24;
      --accent-secondary: var(--accent-ai);
      --accent-secondary-hover: #a78bfa;
      --accent-success-hover: #34d399;

      --text-main: #fafafa;
      --text-muted: #a1a1aa;
      --text-subtle: #71717a;
      --text-link: var(--brand);

      --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    }

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

    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
      font-family: var(--font-sans);
      background-color: var(--bg-main);
      color: var(--text-main);
      font-size: 13px;
      line-height: 1.5;
      transition: background-color var(--transition-fast), color var(--transition-fast);
    }

    /* SVG Icon Helpers */
    .icon {
      width: 16px;
      height: 16px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      stroke-width: 2;
      stroke: currentColor;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      vertical-align: middle;
      flex-shrink: 0;
      pointer-events: none;
    }
    .icon-sm { width: 14px; height: 14px; }
    .icon-lg { width: 20px; height: 20px; }

    /* Button Styles */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 500;
      border-radius: var(--radius-md);
      border: 1px solid var(--bg-border);
      background-color: var(--bg-panel);
      color: var(--text-main);
      cursor: pointer;
      transition: all var(--transition-fast);
      user-select: none;
      white-space: nowrap;
      box-shadow: var(--shadow-sm);
    }
    .btn:hover:not(:disabled) {
      background-color: var(--bg-card-hover);
      border-color: var(--text-subtle);
    }
    .btn:active:not(:disabled) {
      transform: translateY(1px);
    }
    .btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .btn-primary {
      background-color: var(--accent-primary);
      border-color: var(--accent-primary);
      color: #fff;
    }
    .btn-primary:hover:not(:disabled) {
      background-color: var(--accent-primary-hover);
      border-color: var(--accent-primary-hover);
      color: #fff;
    }
    .btn-success {
      background-color: var(--accent-success);
      border-color: var(--accent-success);
      color: #fff;
    }
    .btn-success:hover:not(:disabled) {
      background-color: var(--accent-success-hover);
      color: #fff;
    }
    .btn-danger {
      background-color: var(--accent-danger-bg);
      border-color: var(--accent-danger);
      color: var(--accent-danger);
    }
    .btn-danger:hover:not(:disabled) {
      background-color: var(--accent-danger);
      color: #fff;
    }
    .btn-ghost {
      background: transparent;
      border-color: transparent;
      box-shadow: none;
      color: var(--text-muted);
    }
    .btn-ghost:hover:not(:disabled) {
      background-color: var(--bg-card-hover);
      color: var(--text-main);
    }
    .btn-icon {
      padding: 6px;
      border-radius: var(--radius-md);
    }

    /* Badges & Indicators */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 6px;
      font-size: 11px;
      font-weight: 500;
      border-radius: var(--radius-full);
      background-color: var(--bg-card);
      color: var(--text-muted);
      border: 1px solid var(--bg-border);
    }
    .badge-primary { background: rgba(9, 105, 218, 0.12); color: var(--accent-primary); border-color: rgba(9, 105, 218, 0.3); }
    .badge-success { background: rgba(26, 127, 55, 0.12); color: var(--accent-success); border-color: rgba(26, 127, 55, 0.3); }
    .badge-warning { background: var(--accent-warning-bg); color: var(--accent-warning); border-color: rgba(154, 103, 0, 0.3); }
    .badge-danger { background: var(--accent-danger-bg); color: var(--accent-danger); border-color: rgba(207, 34, 46, 0.3); }
    .badge-interrupted { background: rgba(154, 103, 0, 0.16); color: var(--accent-warning); border: 1px dashed rgba(154, 103, 0, 0.55); font-weight: 600; }

    /* Animated Progress and Status Primitives */
    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background-color: var(--text-subtle);
      display: inline-block;
    }
    .status-dot.active { background-color: var(--accent-primary); box-shadow: 0 0 8px var(--accent-primary); animation: pulse 1.5s infinite; }
    .status-dot.success { background-color: var(--accent-success); }
    .status-dot.warning { background-color: var(--accent-warning); }
    .status-dot.error { background-color: var(--accent-danger); }

    @keyframes pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.5; transform: scale(1.2); }
    }

    /* Thinking / Reasoning Banner Pill in Chat */
    .thinking-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: var(--radius-full);
      background-color: rgba(130, 80, 223, 0.12);
      border: 1px solid rgba(130, 80, 223, 0.3);
      color: var(--accent-secondary);
      font-size: 11px;
      font-weight: 500;
      margin-bottom: 6px;
      animation: pulse 1.8s infinite;
    }

    /* ==========================================================================
       APP SHELL & LAYOUT
       ========================================================================== */
    #app-container {
      display: flex;
      flex-direction: column;
      width: 100vw;
      height: 100vh;
      background-color: var(--surface-canvas);
      overflow: hidden;
    }

    #top-nav {
      height: 48px;
      min-height: 48px;
      background-color: var(--surface-panel);
      border-bottom: 1px solid var(--divider);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      z-index: 100;
      box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    }

    .nav-group {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .nav-brand {
      display: flex;
      align-items: center;
      gap: 9px;
      user-select: none;
      cursor: pointer;
      text-decoration: none;
    }
    
    .nav-brand .logo-icon {
      width: 22px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .nav-brand .brand-title {
      font-family: 'Yellowtail', cursive;
      font-size: 1.45rem;
      line-height: 1;
      color: var(--brand);
      letter-spacing: normal;
      font-weight: 400;
      padding: 1px 2px 2px 0;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      display: inline-block;
    }

    .nav-brand:hover .brand-title {
      transform: scale(1.05) rotate(-1deg);
    }

    /* Main Workspace Split Layout */
    #workspace-container {
      flex: 1;
      display: grid;
      grid-template-columns: var(--left-width) 4px 1fr 4px var(--right-width);
      height: calc(100vh - 44px - 26px);
      overflow: hidden;
      position: relative;
    }

    /* Splitter Handles */
    .gutter {
      background-color: var(--bg-border);
      cursor: col-resize;
      transition: background-color var(--transition-fast);
      position: relative;
      z-index: 10;
    }
    .gutter:hover, .gutter.dragging {
      background-color: var(--accent-primary);
    }

    /* Left Column: Chat, Projects & Prompts */
    #left-panel {
      display: flex;
      flex-direction: column;
      background-color: var(--bg-panel);
      overflow: hidden;
      height: 100%;
    }

    /* Middle Column: File Tree & Editor */
    #middle-panel {
      display: flex;
      flex-direction: column;
      background-color: var(--bg-panel);
      overflow: hidden;
      height: 100%;
    }

    /* Right Column (40%): Live Preview & Activity Stream / Inspector */
    #right-panel {
      display: flex;
      flex-direction: column;
      background-color: var(--bg-panel);
      overflow: hidden;
      height: 100%;
      border-left: 1px solid var(--border-subtle);
    }

    /* Panel Headers */
    .panel-header {
      height: 36px;
      min-height: 36px;
      background-color: var(--bg-panel-header);
      border-bottom: 1px solid var(--bg-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      user-select: none;
    }
    .panel-title {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .panel-tabs {
      display: flex;
      gap: 2px;
      height: 100%;
      align-items: flex-end;
    }
    .panel-tab {
      padding: 6px 12px;
      font-size: 12px;
      color: var(--text-muted);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: all var(--transition-fast);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .panel-tab:hover {
      color: var(--text-main);
      background-color: var(--bg-card-hover);
    }
    .panel-tab.active {
      color: var(--accent-primary);
      font-weight: 600;
      border-bottom-color: var(--accent-primary);
      background-color: var(--bg-panel);
    }

    /* Bottom Status Bar */
    #status-bar {
      height: 26px;
      min-height: 26px;
      background-color: var(--bg-panel-header);
      border-top: 1px solid var(--bg-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      font-size: 11px;
      color: var(--text-muted);
    }
    .status-item {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* ==========================================================================
       LEFT COLUMN: CHAT & PROMPT INTERFACE
       ========================================================================== */
    .chat-container {
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .chat-msg {
      display: flex;
      flex-direction: column;
      gap: 4px;
      max-width: 100%;
      min-width: 0;
      animation: fadeIn 0.2s ease;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .chat-msg.user {
      align-self: flex-end;
      width: 90%;
    }
    .chat-msg.assistant {
      align-self: flex-start;
      width: 100%;
    }
    .chat-bubble {
      padding: 10px 12px;
      border-radius: var(--radius-md);
      font-size: 12.5px;
      line-height: 1.5;
      word-break: break-word;
      min-width: 0;
      overflow-x: auto;
    }
    .chat-msg.user .chat-bubble {
      background-color: var(--brand-soft);
      color: var(--text-main);
      border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
      border-bottom-right-radius: 2px;
      box-shadow: var(--shadow-sm);
    }
    .chat-msg.assistant .chat-bubble {
      background-color: var(--surface-raised);
      border: 1px solid var(--divider);
      border-bottom-left-radius: 2px;
      box-shadow: var(--shadow-md);
    }
    .chat-sender {
      font-size: 10.5px;
      font-weight: 600;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .chat-bubble pre {
      background: var(--bg-input);
      padding: 8px 10px;
      border-radius: var(--radius-sm);
      overflow-x: auto;
      margin: 6px 0;
      border: 1px solid var(--bg-border);
      font-family: var(--font-mono);
      font-size: 11.5px;
    }
    .chat-bubble code {
      font-family: var(--font-mono);
      font-size: 11.5px;
      background: var(--bg-card-hover);
      padding: 2px 4px;
      border-radius: 3px;
    }
    .chat-bubble p {
      margin-bottom: 6px;
    }
    .chat-bubble p:last-child {
      margin-bottom: 0;
    }

    /* Chat Input Area */
    .chat-input-wrapper {
      padding: 10px;
      background-color: var(--bg-panel-header);
      border-top: 1px solid var(--bg-border);
    }
    .chat-input-box {
      display: flex;
      flex-direction: column;
      background-color: var(--bg-input);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      transition: border-color var(--transition-fast);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }
    .chat-input-box:focus-within {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 1px var(--accent-primary);
    }
    #chat-prompt-input {
      width: 100%;
      min-height: 54px;
      max-height: 400px;
      padding: 8px 10px;
      background: transparent;
      border: none;
      outline: none;
      color: var(--text-main);
      font-family: var(--font-sans);
      font-size: 12.5px;
      resize: vertical;
    }
    .chat-input-controls {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 4px 8px;
      border-top: 1px solid var(--border-subtle);
      background-color: var(--bg-panel-header);
    }

    /* Background Keep-Alive Toggle & Indicator */
    .btn-bg-keepalive {
      border: 1px solid var(--bg-border);
      background-color: var(--bg-card);
      color: var(--text-muted);
      transition: all var(--transition-fast);
      font-size: 10.5px;
      padding: 2px 8px;
      border-radius: 4px;
      user-select: none;
      cursor: pointer;
    }
    .btn-bg-keepalive:hover {
      background-color: var(--bg-hover);
      color: var(--text-main);
    }
    .btn-bg-keepalive.active {
      border-color: rgba(16, 185, 129, 0.4);
      background-color: rgba(16, 185, 129, 0.08);
      color: #10b981;
      font-weight: 500;
    }
    .bg-indicator-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background-color: var(--text-muted);
      display: inline-block;
      transition: background-color var(--transition-fast);
      flex-shrink: 0;
    }
    .btn-bg-keepalive.active .bg-indicator-dot {
      background-color: #10b981;
      box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
    }
    .btn-bg-keepalive.active.running .bg-indicator-dot {
      animation: bgPulseDot 1.4s infinite ease-in-out;
    }
    @keyframes bgPulseDot {
      0% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.4); opacity: 0.5; }
      100% { transform: scale(1); opacity: 1; }
    }

    /* ==========================================================================
       MIDDLE COLUMN: FILE TREE & EDITOR
       ========================================================================== */
    .editor-layout {
      display: flex;
      height: 100%;
      overflow: hidden;
    }

    /* File Sidebar & Gutter Splitter */
    .file-sidebar {
      width: 180px;
      min-width: 120px;
      max-width: 800px;
      background-color: var(--bg-panel);
      display: flex;
      flex-direction: column;
      height: 100%;
      flex-shrink: 0;
    }
    .gutter.gutter-sidebar {
      width: 4px;
      cursor: col-resize;
      background-color: var(--bg-border);
      transition: background-color var(--transition-fast);
      flex-shrink: 0;
      z-index: 5;
    }
    .gutter.gutter-sidebar:hover,
    .gutter.gutter-sidebar.dragging {
      background-color: var(--accent-primary);
    }
    .file-tree-container {
      flex: 1;
      overflow-y: auto;
      padding: 4px 0;
    }
    .tree-node {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      font-size: 12px;
      color: var(--text-muted);
      cursor: pointer;
      user-select: none;
      transition: all var(--transition-fast);
    }
    .tree-node:hover {
      background-color: var(--bg-card-hover);
      color: var(--text-main);
    }
    .tree-node.active {
      background-color: rgba(9, 105, 218, 0.10);
      color: var(--accent-primary);
      font-weight: 600;
      border-left: 2px solid var(--accent-primary);
    }
    .tree-node-actions {
      margin-left: auto;
      display: none;
      gap: 2px;
    }
    .tree-node:hover .tree-node-actions,
    .tree-node:focus-within .tree-node-actions,
    .tree-node.selected .tree-node-actions {
      display: flex;
    }
    .tree-node:focus {
      outline: 1px solid var(--accent-primary);
      outline-offset: -1px;
    }
    .tree-node.selected:not(.active) {
      background-color: var(--bg-card-hover);
      color: var(--text-main);
    }
    .tree-node[aria-disabled="true"] {
      cursor: default;
    }
    .tree-node.dragging {
      opacity: 0.45;
    }
    .tree-node.drop-target {
      background-color: rgba(9, 105, 218, 0.14);
      color: var(--accent-primary);
      outline: 1px solid var(--accent-primary);
      outline-offset: -1px;
    }
    .file-tree-container.drop-target-root {
      background-color: rgba(9, 105, 218, 0.06);
      outline: 1px dashed var(--accent-primary);
      outline-offset: -3px;
    }
    .tree-action-btn {
      width: 19px;
      height: 19px;
      padding: 2px;
      border: 0;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .tree-action-btn:hover,
    .tree-action-btn:focus {
      background-color: var(--bg-border);
      color: var(--text-main);
      outline: none;
    }
    .tree-action-btn.danger:hover,
    .tree-action-btn.danger:focus {
      background-color: var(--accent-danger-bg);
      color: var(--accent-danger);
    }
    .tree-edit-wrap {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .tree-name-input {
      width: 100%;
      min-width: 0;
      height: 23px;
      padding: 2px 5px;
      border: 1px solid var(--accent-primary);
      border-radius: var(--radius-sm);
      background: var(--bg-input);
      color: var(--text-main);
      font: inherit;
      outline: none;
      box-shadow: 0 0 0 1px rgba(9, 105, 218, 0.15);
    }
    .tree-name-input[aria-invalid="true"] {
      border-color: var(--accent-danger);
      box-shadow: 0 0 0 1px var(--accent-danger-bg);
    }
    .tree-edit-error {
      color: var(--accent-danger);
      font-size: 10px;
      line-height: 1.25;
      white-space: normal;
    }
    .tree-node.folder {
      color: var(--text-main);
      font-weight: 500;
    }
    .tree-node-label {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .tree-chevron {
      width: 12px;
      flex: 0 0 12px;
      color: var(--text-subtle);
      text-align: center;
      font-size: 10px;
    }

    /* Editor Main Container */
    .editor-main {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      height: 100%;
      background-color: var(--bg-panel);
      overflow: hidden;
    }
    .editor-tabs-bar {
      height: 34px;
      background-color: var(--bg-panel-header);
      border-bottom: 1px solid var(--bg-border);
      display: flex;
      align-items: center;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .editor-tabs-bar::-webkit-scrollbar { display: none; }
    .editor-tab {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 0 12px;
      height: 100%;
      background-color: var(--bg-panel-header);
      border-right: 1px solid var(--bg-border);
      font-size: 12px;
      color: var(--text-muted);
      cursor: pointer;
      white-space: nowrap;
      user-select: none;
    }
    .editor-tab:hover {
      background-color: var(--bg-card-hover);
    }
    .editor-tab.active {
      background-color: var(--bg-panel);
      color: var(--accent-primary);
      font-weight: 600;
      border-top: 2px solid var(--accent-primary);
    }
    .editor-tab .close-tab {
      border-radius: 50%;
      padding: 2px;
      opacity: 0.6;
    }
    .editor-tab .close-tab:hover {
      opacity: 1;
      background-color: var(--bg-border);
    }

    /* Code Editor Surface */
    .editor-surface {
      flex: 1;
      position: relative;
      overflow: hidden;
      display: flex;
    }
    #monaco-editor-container {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      z-index: 2;
    }
    .line-numbers {
      width: 40px;
      background-color: var(--bg-panel-header);
      border-right: 1px solid var(--bg-border);
      color: var(--text-subtle);
      font-family: var(--font-mono);
      font-size: 12px;
      line-height: 20px;
      text-align: right;
      padding: 10px 6px;
      user-select: none;
      overflow: hidden;
    }
    #code-editor-textarea {
      flex: 1;
      background-color: var(--bg-panel);
      color: var(--text-main);
      border: none;
      outline: none;
      font-family: var(--font-mono);
      font-size: 12px;
      line-height: 20px;
      padding: 10px 12px;
      resize: none;
      tab-size: 2;
      white-space: pre;
      overflow: auto;
    }

    /* Editor Bottom Status Bar */
    .editor-status-bar {
      height: 24px;
      background-color: var(--bg-panel-header);
      border-top: 1px solid var(--bg-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      font-family: var(--font-sans);
      font-size: 11px;
      color: var(--text-muted);
      user-select: none;
      flex-shrink: 0;
      z-index: 3;
    }
    .editor-status-group {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .editor-status-item {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 1px 4px;
      border-radius: var(--radius-sm);
    }
    .editor-status-btn {
      cursor: pointer;
      background: transparent;
      border: 1px solid transparent;
      color: var(--text-muted);
      font-size: 10.5px;
      font-family: inherit;
      font-weight: 500;
      transition: all var(--transition-fast);
    }
    .editor-status-btn:hover {
      background-color: var(--bg-card-hover);
      border-color: var(--bg-border);
      color: var(--text-main);
    }

    /* File Sidebar Collapsed State */
    .file-sidebar.collapsed {
      display: none !important;
    }

    /* Quick Open Modal Styles */
    #modal-quick-open .modal-box {
      max-width: 540px;
      padding: 0;
      overflow: hidden;
      border-radius: var(--radius-lg);
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      box-shadow: var(--shadow-lg);
      margin-top: 60px;
    }
    .quick-open-search-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--bg-border);
      background: var(--bg-card);
    }
    .quick-open-input {
      flex: 1;
      background: transparent;
      border: none;
      outline: none;
      font-family: var(--font-sans);
      font-size: 13px;
      color: var(--text-main);
    }
    .quick-open-list {
      max-height: 320px;
      overflow-y: auto;
      padding: 6px 0;
    }
    .quick-open-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 14px;
      font-size: 12px;
      color: var(--text-main);
      cursor: pointer;
      transition: background var(--transition-fast);
    }
    .quick-open-item:hover, .quick-open-item.active {
      background-color: var(--bg-card-hover);
      color: var(--accent-primary);
    }
    .quick-open-item .file-path {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-muted);
    }
    .quick-open-empty {
      padding: 20px;
      text-align: center;
      color: var(--text-muted);
      font-size: 12px;
    }

    /* ==========================================================================
       HISTORY, BRANCH & VERSION MAP CONTROLS
       ========================================================================== */
    .history-toolbar {
      display: flex;
      align-items: center;
      gap: 3px;
      min-width: 0;
      padding-left: 4px;
      border-left: 1px solid var(--border-subtle);
    }
    .history-toolbar .btn {
      padding: 4px 6px;
      box-shadow: none;
    }
    #select-active-branch {
      width: 112px;
      min-width: 76px;
      height: 27px;
      padding: 3px 22px 3px 7px;
      font-size: 10.5px;
      box-shadow: none;
    }
    .branch-color-dot {
      width: 9px;
      height: 9px;
      display: inline-block;
      flex: 0 0 9px;
      border-radius: 50%;
    }

    /* Visual branch DAG and history modal */
    #modal-history .modal-box,
    .history-modal-box {
      width: 95vw !important;
      max-width: 1340px !important;
      height: 86vh !important;
      max-height: 860px !important;
      display: flex !important;
      flex-direction: column !important;
    }
    .history-modal-body {
      min-height: 0;
      padding: 12px 14px;
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) 320px !important;
      grid-template-rows: auto minmax(0, 1fr) !important;
      gap: 12px;
      overflow: hidden;
      flex: 1;
    }
    .history-graph-toolbar {
      grid-column: 1 / -1;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      min-width: 0;
      padding: 6px 10px;
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
    }
    .history-graph-toolbar .toolbar-spacer {
      flex: 1;
    }
    #select-history-branch {
      width: min(220px, 42vw);
      min-width: 130px;
    }
    .history-graph-panel,
    .history-inspector-panel {
      min-width: 0;
      min-height: 0;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      overflow: hidden;
    }
    .history-graph-panel {
      display: flex;
      flex-direction: column;
    }
    .history-graph-legend {
      min-height: 32px;
      padding: 5px 10px;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      color: var(--text-muted);
      font-size: 11px;
      background: var(--bg-panel-header);
      border-bottom: 1px solid var(--border-subtle);
    }
    .history-legend-item {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .history-legend-line {
      width: 19px;
      border-top: 2px solid var(--text-subtle);
    }
    .history-legend-line.redo {
      border-top-style: dashed;
      border-color: var(--accent-warning);
    }
    .history-legend-node {
      width: 10px;
      height: 10px;
      border: 2px solid var(--accent-primary);
      border-radius: 50%;
      background: var(--bg-panel);
    }
    .history-graph-viewport {
      position: relative;
      flex: 1;
      min-height: 300px;
      overflow: auto;
      overscroll-behavior: contain;
      cursor: grab;
      background-color: var(--bg-card);
      background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
      background-size: 24px 24px;
      scrollbar-gutter: stable;
    }
    .history-graph-viewport.panning {
      cursor: grabbing;
      user-select: none;
    }
    .history-graph-stage {
      position: relative;
      min-width: 100%;
      min-height: 100%;
      transform-origin: top left;
    }
    .history-graph-svg {
      position: absolute;
      inset: 0;
      overflow: visible;
      pointer-events: none;
    }
    .history-lane-line {
      opacity: 0.22;
      stroke-width: 3;
    }
    .history-connector {
      fill: none;
      stroke-width: 3;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .history-connector.redo {
      stroke: var(--accent-warning);
      stroke-dasharray: 7 6;
    }
    .history-commit-card {
      position: absolute;
      width: 196px;
      min-height: 74px;
      padding: 8px 10px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      text-align: left;
      color: var(--text-main);
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-left: 4px solid var(--lane-color, var(--accent-primary));
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-sm);
      cursor: pointer;
      transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
    }
    .history-commit-card:hover,
    .history-commit-card:focus-visible {
      z-index: 3;
      border-color: var(--lane-color, var(--accent-primary));
      box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.25), var(--shadow-md);
      outline: none;
      transform: translateY(-1px);
    }
    .history-commit-card.selected {
      z-index: 2;
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-md);
    }
    .history-commit-card.current {
      background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-panel));
    }
    .history-commit-card.redo {
      border-style: dashed;
      border-left-style: solid;
      background: color-mix(in srgb, var(--accent-warning) 8%, var(--bg-panel));
    }
    .history-commit-card.interrupted {
      border-style: dashed;
      border-left-style: solid;
      border-left-width: 4px;
      border-left-color: var(--accent-warning);
      background: color-mix(in srgb, var(--accent-warning) 10%, var(--bg-panel));
    }
    .history-commit-card.partial {
      border-left-color: var(--accent-warning);
      background: color-mix(in srgb, var(--accent-warning) 6%, var(--bg-panel));
    }
    .history-commit-title {
      overflow: hidden;
      font-size: 11.5px;
      font-weight: 650;
      line-height: 1.35;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .history-commit-summary,
    .history-commit-time {
      overflow: hidden;
      color: var(--text-muted);
      font-size: 10px;
      line-height: 1.3;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .history-commit-badges {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 3px;
      margin-top: 2px;
    }
    .history-commit-badges .badge {
      padding: 1px 5px;
      font-size: 8.5px;
    }
    .history-commit-card.rating-good {
      border-left: 4px solid #22c55e !important;
      box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.3), var(--shadow-sm);
    }
    .history-commit-card.rating-bad {
      border-left: 4px solid #ef4444 !important;
      box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3), var(--shadow-sm);
    }
    .history-commit-card.magnitude-major {
      border-top: 2px solid rgba(168, 85, 247, 0.55);
    }
    .history-commit-card.dimmed {
      opacity: 0.28;
      filter: grayscale(0.65);
    }
    .history-commit-rating-face {
      font-size: 13px;
      line-height: 1;
      padding: 1px 2px;
      border-radius: var(--radius-sm);
    }
    .badge-magnitude {
      font-weight: 600;
      letter-spacing: 0.2px;
    }
    .badge-magnitude.major {
      background: rgba(168, 85, 247, 0.18);
      color: #c084fc;
      border: 1px solid rgba(168, 85, 247, 0.35);
    }
    .badge-magnitude.minor {
      background: rgba(148, 163, 184, 0.14);
      color: var(--text-muted);
      border: 1px solid var(--border-subtle);
    }
    .badge-magnitude.moderate {
      background: rgba(59, 130, 246, 0.15);
      color: #60a5fa;
      border: 1px solid rgba(59, 130, 246, 0.35);
    }
    .badge-magnitude.baseline {
      background: rgba(34, 197, 94, 0.15);
      color: #4ade80;
      border: 1px solid rgba(34, 197, 94, 0.35);
    }
    .history-topbar-rating button.active-rate-good {
      background: rgba(34, 197, 94, 0.25) !important;
      border: 1px solid var(--accent-success) !important;
    }
    .history-topbar-rating button.active-rate-bad {
      background: rgba(239, 68, 68, 0.25) !important;
      border: 1px solid var(--accent-danger) !important;
    }
    .history-lane-label {
      position: absolute;
      left: 8px;
      width: 88px;
      overflow: hidden;
      padding: 2px 6px;
      color: var(--text-main);
      font-size: 9.5px;
      font-weight: 650;
      text-overflow: ellipsis;
      white-space: nowrap;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-left: 4px solid var(--lane-color);
      border-radius: var(--radius-full);
      pointer-events: none;
    }
    .history-inspector-panel {
      display: flex;
      flex-direction: column;
    }
    .history-inspector-header {
      padding: 10px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      background: var(--bg-panel-header);
      border-bottom: 1px solid var(--border-subtle);
    }
    .history-inspector-content {
      flex: 1;
      overflow: auto;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .history-inspector-title {
      overflow-wrap: anywhere;
      font-size: 13px;
      font-weight: 700;
    }
    .history-inspector-meta {
      color: var(--text-muted);
      font-size: 10.5px;
      line-height: 1.5;
    }
    .history-change-list {
      max-height: 180px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      overflow: auto;
    }
    .history-change-row {
      padding: 5px 7px;
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      font-size: 11px;
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
    }
    .history-change-row code {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .history-inspector-actions {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .history-branches-compact {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .history-branch-compact {
      padding: 5px 8px;
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
    }
    .history-branch-compact .branch-name {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      font-size: 11px;
      font-weight: 600;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .history-state {
      position: absolute;
      inset: 0;
      z-index: 5;
      padding: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      color: var(--text-muted);
      background: color-mix(in srgb, var(--bg-card) 90%, transparent);
    }

    @media (max-width: 650px) {
      #modal-history .modal-box,
      .history-modal-box {
        width: 100% !important;
        height: 96vh !important;
        max-height: 96vh !important;
      }
      .history-modal-body {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto minmax(300px, 1fr) auto !important;
        overflow-y: auto;
      }
      .history-graph-toolbar {
        position: sticky;
        top: 0;
        z-index: 6;
      }
      .history-toolbar {
        padding-left: 2px;
      }
      #select-active-branch {
        width: 104px;
      }
    }

    /* Diff Review Bar */
    .diff-banner {
      background-color: rgba(9, 105, 218, 0.10);
      border-bottom: 1px solid rgba(9, 105, 218, 0.3);
      padding: 6px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12px;
    }

    /* ==========================================================================
       RIGHT COLUMN: AGENT ACTIVITY STREAM & DETAILED INSPECTOR (40%)
       ========================================================================== */
    .stream-inspector-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      height: 100%;
      background-color: var(--bg-panel);
      overflow: hidden;
    }
    .stream-content {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    
    /* Activity Stream Event Item */
    .activity-card {
      background-color: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 8px 10px;
      font-size: 11.5px;
      transition: all var(--transition-fast);
      display: flex;
      flex-direction: column;
      gap: 4px;
      cursor: pointer;
      box-shadow: var(--shadow-sm);
    }
    .activity-card:hover {
      border-color: var(--text-subtle);
    }
    .activity-card.critical {
      border-left: 3px solid var(--accent-danger);
      background-color: var(--accent-danger-bg);
    }
    .activity-card.planning {
      border-left: 3px solid var(--accent-secondary);
    }
    .activity-card.executing {
      border-left: 3px solid var(--accent-primary);
    }
    .activity-card.validating {
      border-left: 3px solid var(--accent-success);
    }
    .activity-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .activity-title {
      font-weight: 600;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .activity-time {
      font-size: 10px;
      color: var(--text-subtle);
    }
    .activity-body {
      color: var(--text-muted);
      line-height: 1.4;
      max-height: 40px;
      overflow: hidden;
      text-overflow: ellipsis;
      transition: max-height 0.3s ease;
    }
    .activity-card.expanded .activity-body {
      max-height: 300px;
      overflow-y: auto;
    }

    /* Inspector Task Graph View */
    .task-graph-view {
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .task-node {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-sm);
    }
    .task-node.pending { opacity: 0.6; }
    .task-node.in_progress { border-color: var(--accent-primary); box-shadow: 0 0 8px rgba(9, 105, 218, 0.2); }
    .task-node.completed { border-color: var(--accent-success); }

    /* ==========================================================================
       MODALS, NOTIFICATIONS & TOASTS
       ========================================================================== */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background-color: rgba(0, 0, 0, 0.4);
      backdrop-filter: blur(8px);
      z-index: 9999;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }
    .modal-backdrop.open { display: flex; }
    .modal-box {
      width: 100%;
      max-width: 580px;
      background: var(--surface-panel);
      border: 1px solid var(--divider);
      border-radius: var(--radius-xl);
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
      display: flex;
      flex-direction: column;
      max-height: 90vh;
      overflow: hidden;
      animation: modalSlide 0.25s ease;
    }
    @keyframes modalSlide {
      from { opacity: 0; transform: scale(0.96) translateY(-10px); }
      to { opacity: 1; transform: scale(1) translateY(0); }
    }
    .modal-header {
      padding: 16px 24px;
      border-bottom: 1px solid var(--divider);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface-raised);
    }
    .modal-title {
      font-size: 16px;
      font-weight: 700;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 10px;
      letter-spacing: -0.01em;
    }
    .modal-body {
      padding: 20px 24px;
      background: var(--surface-canvas);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .modal-footer {
      padding: 14px 24px;
      border-top: 1px solid var(--divider);
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      background: var(--surface-raised);
    }
    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .form-label {
      font-size: 12px;
      font-weight: 500;
      color: var(--text-main);
    }
    .form-hint {
      font-size: 11px;
      color: var(--text-muted);
    }
    .form-input, .form-select {
      background-color: var(--bg-input);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 8px 10px;
      color: var(--text-main);
      font-size: 12.5px;
      outline: none;
      transition: border-color var(--transition-fast);
      box-shadow: var(--shadow-sm);
    }
    .form-input:focus, .form-select:focus {
      border-color: var(--accent-primary);
    }

    /* Toast Notification Layer */
    #toast-container {
      position: fixed;
      bottom: 34px;
      right: 16px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      z-index: 2000;
      pointer-events: none;
    }
    .toast-item {
      pointer-events: auto;
      min-width: 260px;
      max-width: 380px;
      background-color: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 10px 14px;
      box-shadow: var(--shadow-md);
      display: flex;
      align-items: flex-start;
      gap: 10px;
      animation: toastIn 0.25s ease;
      font-size: 12px;
    }
    @keyframes toastIn {
      from { opacity: 0; transform: translateX(20px); }
      to { opacity: 1; transform: translateX(0); }
    }
    .toast-item.success { border-left: 3px solid var(--accent-success); }
    .toast-item.error { border-left: 3px solid var(--accent-danger); }
    .toast-item.warning { border-left: 3px solid var(--accent-warning); }
    .toast-item.info { border-left: 3px solid var(--accent-primary); }
    .toast-msg { flex: 1; color: var(--text-main); }
    .toast-close { cursor: pointer; color: var(--text-subtle); padding: 2px; }
    .toast-close:hover { color: var(--text-main); }

    /* Alert Banners */
    .alert-banner {
      padding: 8px 12px;
      border-radius: var(--radius-md);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      font-size: 12px;
      margin-bottom: 8px;
    }
    .alert-warning {
      background-color: var(--accent-warning-bg);
      border: 1px solid rgba(210, 153, 34, 0.4);
      color: var(--accent-warning);
    }

    /* Scrollbars */
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

    /* ==========================================================================
       PLAN APPROVAL & ADVANCED AGENT UI COMPONENTS
       ========================================================================== */
    .plan-card-container {
      background: var(--bg-card);
      border: 1px solid var(--accent-primary);
      border-radius: var(--radius-lg);
      padding: 14px;
      margin: 8px 0;
      box-shadow: var(--shadow-md);
      display: flex;
      flex-direction: column;
      gap: 10px;
      animation: fadeIn 0.25s ease;
    }
    .plan-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--bg-border);
      padding-bottom: 8px;
    }
    .plan-card-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .plan-card-summary {
      font-size: 12px;
      color: var(--text-main);
      line-height: 1.45;
    }
    .plan-card-approach {
      font-size: 11px;
      color: var(--text-muted);
      background: var(--bg-panel);
      padding: 8px 10px;
      border-radius: var(--radius-sm);
      border-left: 3px solid var(--accent-secondary);
      line-height: 1.4;
    }
    .plan-tasks-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 4px 0;
    }
    .plan-task-item {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 8px 10px;
      font-size: 11.5px;
      display: flex;
      align-items: flex-start;
      gap: 8px;
      transition: all var(--transition-fast);
    }
    .plan-task-item:hover {
      border-color: var(--text-subtle);
    }
    .plan-task-item.active {
      border-color: var(--accent-primary);
      box-shadow: 0 0 6px rgba(9, 105, 218, 0.2);
    }
    .plan-task-item.completed {
      border-color: var(--accent-success);
    }
    .action-badge {
      font-size: 9.5px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: var(--radius-sm);
      text-transform: uppercase;
      letter-spacing: 0.3px;
      flex-shrink: 0;
    }
    .action-badge.create { background: rgba(26, 127, 55, 0.15); color: var(--accent-success); border: 1px solid rgba(26, 127, 55, 0.3); }
    .action-badge.modify { background: rgba(9, 105, 218, 0.15); color: var(--accent-primary); border: 1px solid rgba(9, 105, 218, 0.3); }
    .action-badge.rewrite { background: rgba(154, 103, 0, 0.15); color: var(--accent-warning); border: 1px solid rgba(154, 103, 0, 0.3); }
    .plan-actions-bar {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--bg-border);
    }
    .plan-revision-container {
      display: none;
      flex-direction: column;
      gap: 6px;
      margin-top: 6px;
      padding-top: 8px;
      border-top: 1px dashed var(--bg-border);
    }
    .plan-revision-input {
      width: 100%;
      min-height: 50px;
      padding: 6px 8px;
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-sm);
      background: var(--bg-input);
      color: var(--text-main);
      font-family: var(--font-sans);
      font-size: 11.5px;
      resize: vertical;
      outline: none;
    }
    .plan-revision-input:focus {
      border-color: var(--accent-primary);
    }
    .review-feedback-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: var(--radius-full);
      font-size: 10px;
      font-weight: 600;
    }
    .review-feedback-pill.approved {
      background: rgba(26, 127, 55, 0.15);
      color: var(--accent-success);
      border: 1px solid rgba(26, 127, 55, 0.3);
    }
    .review-feedback-pill.rejected {
      background: rgba(207, 34, 46, 0.15);
      color: var(--accent-danger);
      border: 1px solid rgba(207, 34, 46, 0.3);
    }

    /* Compact Execution Progress & Summary Cards in Chat */
    .exec-progress-box {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin: 4px 0;
    }
    .exec-progress-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .exec-progress-status {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      font-weight: 600;
      color: var(--text-main);
    }
    .exec-spinner {
      width: 14px;
      height: 14px;
      border: 2px solid rgba(9, 105, 218, 0.2);
      border-top-color: var(--accent-primary);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      flex-shrink: 0;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    .exec-progress-bar-bg {
      width: 100%;
      height: 4px;
      background: var(--bg-canvas);
      border-radius: 2px;
      overflow: hidden;
    }
    .exec-progress-bar-fill {
      height: 100%;
      background: var(--accent-primary);
      border-radius: 2px;
      transition: width 0.3s ease;
    }
    .exec-progress-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 11px;
      color: var(--text-muted);
    }
    .exec-summary-box {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-md);
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 4px 0;
    }
    .exec-summary-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--accent-success);
    }
    .exec-summary-files-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 4px;
    }
    .exec-summary-file-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 11.5px;
      padding: 4px 8px;
      background: var(--bg-canvas);
      border-radius: var(--radius-sm);
      border: 1px solid var(--bg-border);
    }
    .token-stat-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: var(--bg-card);
      padding: 2px 6px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--bg-border);
    }



    /* In-Memory Bash Test Runner Styles */
    .test-step-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 8px 10px;
      font-size: 11.5px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      transition: all 0.15s ease;
    }
    .test-step-card.passed {
      border-left: 3px solid var(--accent-success);
    }
    .test-step-card.failed {
      border-left: 3px solid var(--accent-danger);
      background: rgba(239, 68, 68, 0.03);
    }
    .test-step-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .test-step-cmd {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-main);
      word-break: break-all;
    }
    .test-step-output {
      font-family: var(--font-mono);
      font-size: 10.5px;
      color: var(--text-muted);
      background: var(--bg-canvas);
      border: 1px solid var(--border-subtle);
      border-radius: 4px;
      padding: 6px 8px;
      white-space: pre-wrap;
      word-break: break-all;
      max-height: 140px;
      overflow-y: auto;
    }

    #status-bar {
      height: 24px;
      min-height: 24px;
      padding: 0 8px;
      font-size: 10px;
    }

    #status-bar .status-item:last-child span:last-child {
      display: none;
    }

    @media (max-width: 1100px) {
      :root {
        --left-width: 240px;
        --right-width: 30%;
      }

      #badge-active-model {
        display: none !important;
      }

      #btn-project-list {
        max-width: 145px;
      }

      .file-sidebar {
        width: 136px;
        min-width: 120px;
      }
    }

    @media (max-width: 820px) {
      html, body {
        overflow: auto;
      }

      #app-container {
        min-height: 100vh;
        height: auto;
        overflow: visible;
      }



      #btn-project-list {
        max-width: 170px;
      }

      #workspace-container {
        height: auto;
        min-height: calc(100vh - 72px);
        display: flex;
        flex-direction: column;
        overflow: visible;
      }

      #left-panel,
      #middle-panel,
      #right-panel {
        width: 100%;
        height: 54vh;
        min-height: 320px;
      }

      #middle-panel {
        order: 1;
        height: 62vh;
      }

      #left-panel {
        order: 2;
      }

      #right-panel {
        order: 3;
        height: 42vh;
        border-left: 0;
        border-top: 1px solid var(--border-subtle);
      }

      .gutter {
        display: none;
      }

      .file-sidebar {
        width: 30%;
        min-width: 118px;
      }

      #status-bar {
        position: sticky;
        bottom: 0;
      }
    }

    @media (max-width: 520px) {
      .nav-brand span {
        display: none;
      }

      #btn-launch-tab span {
        display: none;
      }

      #btn-launch-tab {
        padding: 5px;
      }

      #left-panel,
      #middle-panel,
      #right-panel {
        min-height: 280px;
      }

      .file-sidebar {
        width: 112px;
        min-width: 100px;
      }

      .panel-tab {
        padding: 5px 6px;
        font-size: 10px;
      }

      .status-item:last-child {
        gap: 8px !important;
      }
    }

    /* ==========================================================================
       SETTINGS MODAL — Redesigned Tabbed Sidebar Layout
       ========================================================================== */
    .settings-modal-box {
      width: 92%;
      max-width: 880px;
      height: 86vh;
      max-height: 760px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .settings-modal-header {
      flex-shrink: 0;
      padding: 18px 22px;
      border-bottom: 1px solid var(--bg-border);
      background: var(--bg-main);
    }

    .settings-modal-titleblock {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
    }

    .settings-modal-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: linear-gradient(135deg, var(--accent-primary), color-mix(in srgb, var(--accent-primary) 60%, var(--accent-secondary)));
      color: #ffffff;
      flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .settings-modal-icon .icon {
      width: 18px;
      height: 18px;
    }

    .settings-modal-title-main {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-main);
      line-height: 1.25;
      letter-spacing: -0.01em;
    }

    .settings-modal-subtitle {
      font-size: 11.5px;
      color: var(--text-muted);
      margin-top: 2px;
      line-height: 1.3;
    }

    .settings-modal-body {
      flex: 1;
      min-height: 0;
      display: grid;
      grid-template-columns: 220px 1fr;
      gap: 0;
      padding: 0;
      background: var(--bg-main);
      overflow: hidden;
    }

    /* ----- Sidebar nav ----- */
    .settings-sidebar {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 14px 12px;
      background: var(--bg-card);
      border-right: 1px solid var(--bg-border);
      overflow-y: auto;
    }

    .settings-nav-item {
      display: grid;
      grid-template-columns: 20px 1fr;
      grid-template-rows: auto auto;
      column-gap: 10px;
      align-items: center;
      padding: 10px 12px;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 8px;
      cursor: pointer;
      text-align: left;
      font-family: inherit;
      color: var(--text-muted);
      transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    }

    .settings-nav-item:hover {
      background: var(--bg-panel);
      color: var(--text-main);
    }

    .settings-nav-item.active {
      background: linear-gradient(135deg, color-mix(in srgb, var(--accent-primary) 14%, transparent), color-mix(in srgb, var(--accent-secondary) 8%, transparent));
      color: var(--accent-primary);
      border-color: color-mix(in srgb, var(--accent-primary) 30%, transparent);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    }

    .settings-nav-icon {
      grid-row: 1 / span 2;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      color: inherit;
    }

    .settings-nav-icon .icon {
      width: 16px;
      height: 16px;
      stroke-width: 1.8;
    }

    .settings-nav-label {
      font-size: 13px;
      font-weight: 600;
      line-height: 1.2;
      letter-spacing: -0.005em;
    }

    .settings-nav-tag {
      font-size: 10px;
      font-weight: 500;
      color: var(--text-subtle);
      line-height: 1.2;
      margin-top: 1px;
    }

    .settings-nav-item.active .settings-nav-tag {
      color: color-mix(in srgb, var(--accent-primary) 70%, var(--text-muted));
    }

    /* ----- Content panels ----- */
    .settings-content {
      overflow-y: auto;
      padding: 22px 28px 26px;
      scroll-behavior: smooth;
    }

    .settings-panel {
      display: none;
      animation: settings-panel-fade 0.25s ease;
    }

    .settings-panel.active {
      display: block;
    }

    @keyframes settings-panel-fade {
      from {
        opacity: 0;
        transform: translateY(4px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .settings-panel-header {
      margin-bottom: 18px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--bg-border);
    }

    .settings-panel-title {
      margin: 0 0 4px;
      font-size: 17px;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.015em;
    }

    .settings-panel-description {
      margin: 0;
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.5;
      max-width: 56ch;
    }

    .settings-section {
      margin-bottom: 20px;
    }

    .settings-section:last-child {
      margin-bottom: 0;
    }

    .settings-section-label {
      font-size: 10.5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .settings-section-label-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }

    .settings-section-label-row .settings-section-label {
      margin-bottom: 0;
    }

    .settings-temperature-pill {
      font-size: 11px;
      font-weight: 600;
      color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
      padding: 3px 8px;
      border-radius: 12px;
      border: 1px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
    }

    .settings-help {
      margin: 6px 0 0;
      font-size: 11.5px;
      color: var(--text-muted);
      line-height: 1.5;
    }

    .settings-callout {
      margin-top: 8px;
      display: flex;
      gap: 8px;
      padding: 9px 12px;
      background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
      border: 1px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
      border-radius: 8px;
      font-size: 11.5px;
      color: var(--text-main);
      line-height: 1.5;
    }

    .settings-callout-icon {
      flex-shrink: 0;
    }

    .settings-subsection {
      margin-top: 10px;
    }

    .settings-subsection-label {
      display: block;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .settings-hidden-select {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
      left: -9999px;
    }

    /* ----- Provider cards ----- */
    .settings-provider-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }

    .settings-provider-card {
      position: relative;
      display: block;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
      touch-action: manipulation;
    }

    .settings-provider-card input[type="radio"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 1px;
      height: 1px;
    }

    .settings-provider-card-inner {
      display: grid;
      grid-template-columns: 32px 1fr 16px;
      align-items: center;
      column-gap: 10px;
      padding: 12px 14px;
      background: var(--bg-card);
      border: 1.5px solid var(--bg-border);
      border-radius: 10px;
      transition: all 0.18s ease;
      position: relative;
      pointer-events: none;
    }

    .settings-provider-card:hover .settings-provider-card-inner {
      border-color: color-mix(in srgb, var(--accent-primary) 40%, var(--bg-border));
      background: color-mix(in srgb, var(--accent-primary) 4%, var(--bg-card));
    }

    .settings-provider-card input[type="radio"]:checked + .settings-provider-card-inner {
      border-color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-card));
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 12%, transparent);
    }

    .settings-provider-card input[type="radio"]:checked + .settings-provider-card-inner .settings-provider-check {
      opacity: 1;
      transform: scale(1);
    }

    .settings-provider-icon {
      grid-row: 1 / span 2;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      font-weight: 700;
      font-size: 11px;
      letter-spacing: 0.02em;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    .settings-provider-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.2;
    }

    .settings-provider-detail {
      font-size: 10.5px;
      color: var(--text-muted);
      line-height: 1.3;
      margin-top: 2px;
    }

    .settings-provider-check {
      grid-row: 1 / span 2;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      color: var(--accent-primary);
      opacity: 0;
      transform: scale(0.6);
      transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .settings-provider-check .icon {
      width: 16px;
      height: 16px;
      stroke-width: 2.5;
    }

    /* ----- API key row ----- */
    .settings-api-key-row {
      display: flex;
      gap: 6px;
      align-items: stretch;
    }

    .settings-input-with-icon {
      flex: 1;
      position: relative;
      display: flex;
      align-items: center;
    }

    .settings-input-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      display: inline-flex;
      color: var(--text-muted);
      pointer-events: none;
    }

    .settings-input-icon .icon {
      width: 14px;
      height: 14px;
      stroke-width: 1.8;
    }

    .settings-input-with-icon .form-input {
      padding-left: 34px;
      width: 100%;
    }

    /* ----- Segmented control ----- */
    .settings-segmented {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0;
      padding: 4px;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: 10px;
      position: relative;
    }

    .settings-segmented-option {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: transparent;
      border: none;
      border-radius: 7px;
      cursor: pointer;
      font-family: inherit;
      color: var(--text-muted);
      transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
      text-align: left;
    }

    .settings-segmented-option:hover {
      color: var(--text-main);
    }

    .settings-segmented-option.active {
      background: var(--bg-card);
      color: var(--accent-primary);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .settings-segmented-emoji {
      font-size: 18px;
      line-height: 1;
    }

    .settings-segmented-text {
      display: flex;
      flex-direction: column;
      gap: 1px;
    }

    .settings-segmented-title {
      font-size: 12.5px;
      font-weight: 600;
      line-height: 1.2;
    }

    .settings-segmented-sub {
      font-size: 10.5px;
      color: inherit;
      opacity: 0.75;
      line-height: 1.3;
    }

    /* ----- Cards ----- */
    .settings-card {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: 12px;
      padding: 16px;
    }

    .settings-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 6px;
    }

    .settings-card-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13.5px;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.01em;
    }

    .settings-card-pill {
      font-size: 10px;
      font-weight: 600;
      color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
      padding: 2px 7px;
      border-radius: 4px;
      border: 1px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .settings-card-description {
      margin: 0 0 14px;
      font-size: 11.5px;
      color: var(--text-muted);
      line-height: 1.5;
    }

    .settings-divider {
      height: 1px;
      background: var(--bg-border);
      margin: 14px 0;
    }

    /* ----- Role & hinter grids ----- */
    .settings-role-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 10px;
    }

    .settings-role-card {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: 8px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: border-color 0.18s ease;
    }

    .settings-role-card:hover {
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
    }

    .settings-role-card-header {
      display: flex;
      align-items: flex-start;
      gap: 8px;
    }

    .settings-role-emoji {
      font-size: 16px;
      line-height: 1.2;
      flex-shrink: 0;
    }

    .settings-role-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.25;
    }

    .settings-role-description {
      font-size: 10.5px;
      color: var(--text-muted);
      line-height: 1.3;
      margin-top: 1px;
    }

    .settings-role-controls {
      display: grid;
      grid-template-columns: 1fr 70px;
      gap: 6px;
    }

    .settings-role-custom {
      margin-top: 0;
    }

    .settings-hinter-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 10px;
    }

    .settings-hinter-card {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: 8px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: border-color 0.18s ease;
    }

    .settings-hinter-card:hover {
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
    }

    .settings-hinter-card-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px;
    }

    .settings-hinter-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.3;
    }

    .settings-hinter-description {
      font-size: 10.5px;
      color: var(--text-muted);
      line-height: 1.3;
      margin-top: 1px;
    }

    .settings-hinter-badge {
      font-size: 9px;
      font-weight: 700;
      color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid color-mix(in srgb, var(--accent-primary) 26%, transparent);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      flex-shrink: 0;
    }

    /* ----- Toggle / switch ----- */
    .settings-toggle-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .settings-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 14px;
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: 10px;
      cursor: pointer;
      transition: border-color 0.15s ease, background-color 0.15s ease;
    }

    .settings-toggle:hover {
      border-color: color-mix(in srgb, var(--accent-primary) 30%, var(--bg-border));
    }

    .settings-toggle-main {
      flex: 1;
      min-width: 0;
    }

    .settings-toggle-title {
      display: block;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--text-main);
      line-height: 1.3;
    }

    .settings-toggle-description {
      display: block;
      margin-top: 4px;
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.45;
    }

    .settings-toggle-tag {
      display: inline-block;
      margin-top: 6px;
      font-size: 9.5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--accent-secondary);
      background: color-mix(in srgb, var(--accent-secondary) 14%, transparent);
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid color-mix(in srgb, var(--accent-secondary) 24%, transparent);
    }

    .settings-toggle-tag-warning {
      color: var(--accent-warning, #f59e0b);
      background: color-mix(in srgb, var(--accent-warning, #f59e0b) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-warning, #f59e0b) 28%, transparent);
    }

    /* Hide the native checkbox; styled by switch track */
    .settings-switch {
      position: relative;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      width: 38px;
      height: 22px;
    }

    .settings-switch input[type="checkbox"] {
      position: absolute;
      opacity: 0;
      width: 100%;
      height: 100%;
      margin: 0;
      cursor: pointer;
      z-index: 2;
    }

    .settings-switch-track {
      position: relative;
      display: block;
      width: 38px;
      height: 22px;
      background: var(--bg-border);
      border-radius: 999px;
      transition: background-color 0.2s ease;
    }

    .settings-switch-thumb {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 16px;
      height: 16px;
      background: #ffffff;
      border-radius: 50%;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
      transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .settings-switch input[type="checkbox"]:checked + .settings-switch-track {
      background: var(--accent-primary);
    }

    .settings-switch input[type="checkbox"]:checked + .settings-switch-track .settings-switch-thumb {
      transform: translateX(16px);
    }

    .settings-switch input[type="checkbox"]:focus-visible + .settings-switch-track {
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 30%, transparent);
    }

    /* ----- Two-column grid (reasoning + tokens) ----- */
    .settings-grid-2col {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
      margin-bottom: 20px;
    }

    /* ----- Slider ----- */
    .settings-slider-row {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 10px;
    }

    .settings-slider-label {
      font-size: 10.5px;
      color: var(--text-muted);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .settings-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 6px;
      background: var(--bg-border);
      border-radius: 3px;
      outline: none;
      margin: 0;
      cursor: pointer;
    }

    .settings-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      background: var(--accent-primary);
      border: 2px solid #ffffff;
      border-radius: 50%;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
      transition: transform 0.15s ease;
    }

    .settings-slider::-webkit-slider-thumb:hover {
      transform: scale(1.1);
    }

    .settings-slider::-moz-range-thumb {
      width: 16px;
      height: 16px;
      background: var(--accent-primary);
      border: 2px solid #ffffff;
      border-radius: 50%;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    /* ----- Modal footer ----- */
    .settings-modal-footer {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 14px 22px;
      border-top: 1px solid var(--bg-border);
      background: var(--bg-main);
    }

    .settings-footer-status {
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.4;
      flex: 1;
      min-width: 0;
    }

    .settings-footer-actions {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    .settings-footer-actions .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .settings-footer-actions .btn .icon {
      width: 14px;
      height: 14px;
      stroke-width: 1.8;
    }

    /* ----- Responsive ----- */
    @media (max-width: 720px) {
      .settings-modal-box {
        width: 96%;
        height: 92vh;
        max-height: none;
      }

      .settings-modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
      }

      .settings-sidebar {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 10px;
        border-right: none;
        border-bottom: 1px solid var(--bg-border);
      }

      .settings-nav-item {
        min-width: 140px;
        flex-shrink: 0;
      }

      .settings-provider-grid {
        grid-template-columns: 1fr;
      }

      .settings-grid-2col {
        grid-template-columns: 1fr;
      }

      .settings-role-grid,
      .settings-hinter-grid {
        grid-template-columns: 1fr;
      }

      .settings-content {
        padding: 16px 18px 20px;
      }

      .settings-modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
      }

      .settings-footer-actions {
        justify-content: flex-end;
      }
    }

    /* ==========================================================================
       GLOBAL DESIGN SYSTEM — Unified Polish for All UI Surfaces
       Applied to every modal, panel, button, badge, form control, and card.
       Idempotent with existing rules; uses existing CSS variables for theming.
       ========================================================================== */

    /* ----- Button polish ----- */
    .btn {
      border-radius: var(--radius-sm, 6px);
      transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
      font-weight: 500;
      gap: 6px;
    }
    .btn:hover:not(:disabled) {
      transform: translateY(-1px);
    }
    .btn:active:not(:disabled) {
      transform: translateY(0);
    }
    .btn:focus-visible {
      outline: none;
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 28%, transparent);
    }
    .btn-primary {
      background: linear-gradient(135deg, var(--accent-primary), color-mix(in srgb, var(--accent-primary) 80%, var(--accent-secondary)));
      border: 1px solid transparent;
      color: #ffffff;
      box-shadow: 0 1px 3px color-mix(in srgb, var(--accent-primary) 22%, transparent);
    }
    .btn-primary:hover:not(:disabled) {
      box-shadow: 0 2px 8px color-mix(in srgb, var(--accent-primary) 32%, transparent);
    }
    .btn-success {
      background: linear-gradient(135deg, var(--accent-success, #16a34a), color-mix(in srgb, var(--accent-success, #16a34a) 80%, var(--accent-primary)));
      color: #ffffff;
      border: 1px solid transparent;
      box-shadow: 0 1px 3px color-mix(in srgb, var(--accent-success, #16a34a) 22%, transparent);
    }
    .btn-danger {
      background: linear-gradient(135deg, var(--accent-danger, #dc2626), color-mix(in srgb, var(--accent-danger, #dc2626) 80%, #b91c1c));
      color: #ffffff;
      border: 1px solid transparent;
    }
    .btn-ghost {
      background: transparent;
      border: 1px solid var(--bg-border);
      color: var(--text-muted);
    }
    .btn-ghost:hover:not(:disabled) {
      background: var(--bg-panel);
      color: var(--text-main);
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
    }
    .btn-secondary {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      color: var(--text-main);
    }
    .btn-secondary:hover:not(:disabled) {
      background: var(--bg-panel);
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
    }
    .btn-icon {
      padding: 6px;
      width: 30px;
      height: 30px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--radius-sm, 6px);
    }
    .btn-icon:hover:not(:disabled) {
      background: var(--bg-panel);
      color: var(--accent-primary);
    }
    .btn-sm {
      padding: 4px 10px;
      font-size: 11px;
      height: 26px;
    }

    /* ----- Badge polish ----- */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.02em;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      color: var(--text-muted);
      line-height: 1.5;
    }
    .badge-primary {
      background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-primary) 28%, transparent);
      color: var(--accent-primary);
    }
    .badge-success {
      background: color-mix(in srgb, var(--accent-success, #16a34a) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-success, #16a34a) 28%, transparent);
      color: var(--accent-success, #16a34a);
    }
    .badge-danger {
      background: color-mix(in srgb, var(--accent-danger, #dc2626) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-danger, #dc2626) 28%, transparent);
      color: var(--accent-danger, #dc2626);
    }
    .badge-warning {
      background: color-mix(in srgb, var(--accent-warning, #f59e0b) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-warning, #f59e0b) 28%, transparent);
      color: var(--accent-warning, #f59e0b);
    }
    .badge-ghost {
      background: var(--bg-panel);
      color: var(--text-muted);
    }

    /* ----- Form controls polish ----- */
    .form-input,
    .form-select {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-sm, 6px);
      color: var(--text-main);
      padding: 7px 10px;
      font-size: 12px;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .form-input:hover:not(:disabled),
    .form-select:hover:not(:disabled) {
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
    }
    .form-input:focus,
    .form-select:focus {
      outline: none;
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 22%, transparent);
    }
    .form-label {
      color: var(--text-main);
      font-weight: 600;
      font-size: 11.5px;
      letter-spacing: 0.01em;
    }
    .form-hint {
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.5;
    }
    .form-group {
      display: flex;
      flex-direction: column;
      gap: 5px;
      margin-bottom: 12px;
    }


    #badge-active-model {
      background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-card));
      border: 1px solid color-mix(in srgb, var(--accent-primary) 28%, var(--bg-border));
      color: var(--accent-primary);
      font-size: 11px;
      padding: 4px 10px;
      border-radius: 999px;
      transition: background-color 0.15s ease, border-color 0.15s ease;
    }
    #badge-active-model:hover {
      background: color-mix(in srgb, var(--accent-primary) 18%, var(--bg-card));
      border-color: var(--accent-primary);
    }
    .history-toolbar {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 3px 6px;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: var(--radius-sm, 6px);
    }
    .history-toolbar select.form-select {
      padding: 3px 8px;
      font-size: 11px;
      background: transparent;
      border: none;
      min-width: 120px;
    }
    .history-topbar-rating button {
      padding: 2px 4px;
      font-size: 12px;
      border-radius: 4px;
    }

    /* ----- Status bar polish ----- */
    #status-bar {
      background: var(--bg-card);
      border-top: 1px solid var(--bg-border);
      padding: 6px 14px;
      font-size: 11px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }
    .status-item {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
      background: var(--accent-success, #16a34a);
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-success, #16a34a) 20%, transparent);
    }



    /* ----- Panel header polish (left/middle/right panels) ----- */
    .panel-header {
      background: var(--bg-card);
      border-bottom: 1px solid var(--bg-border);
      padding: 8px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-height: 38px;
    }
    .panel-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--text-main);
      letter-spacing: -0.005em;
    }
    .panel-title .icon {
      color: var(--accent-primary);
    }

    /* ----- Panel tabs polish ----- */
    .panel-tabs {
      display: flex;
      align-items: center;
      gap: 4px;
      flex: 1;
      overflow-x: auto;
      scrollbar-width: thin;
    }
    .panel-tab {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      font-size: 11.5px;
      font-weight: 500;
      color: var(--text-muted);
      background: transparent;
      border: 1px solid transparent;
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: background-color 0.15s ease, color 0.15s ease;
      white-space: nowrap;
      position: relative;
    }
    .panel-tab:hover {
      background: var(--surface-hover);
      color: var(--text-main);
    }
    .panel-tab.active {
      background: color-mix(in srgb, var(--brand) 12%, var(--surface-raised));
      color: var(--brand-strong);
      font-weight: 600;
    }
    .panel-tab.active::after {
      content: '';
      position: absolute;
      left: 12px;
      right: 12px;
      bottom: -7px;
      height: 2px;
      background: var(--brand);
      border-radius: 2px;
    }
    /* Semantic specific tabs */
    .panel-tab[data-tab="agent-inspector"].active {
      background: color-mix(in srgb, var(--accent-ai) 12%, var(--surface-raised));
      color: var(--accent-ai);
    }
    .panel-tab[data-tab="agent-inspector"].active::after {
      background: var(--accent-ai);
    }
    .panel-tab[data-tab="console-logs"].active {
      background: color-mix(in srgb, var(--accent-info) 12%, var(--surface-raised));
      color: var(--accent-info);
    }
    .panel-tab[data-tab="console-logs"].active::after {
      background: var(--accent-info);
    }
    .panel-tab[data-tab="test-runner"].active {
      background: color-mix(in srgb, var(--accent-success) 12%, var(--surface-raised));
      color: var(--accent-success);
    }
    .panel-tab[data-tab="test-runner"].active::after {
      background: var(--accent-success);
    }
    .panel-tab .icon {
      width: 13px;
      height: 13px;
    }

    /* ----- File tree polish ----- */
    .file-sidebar {
      background: var(--bg-card);
      border-right: 1px solid var(--bg-border);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .file-tree-container {
      overflow-y: auto;
      padding: 4px 0;
    }
    .tree-node,
    [class*="tree-node"] {
      padding: 4px 8px;
      font-size: 11.5px;
      border-radius: var(--radius-sm);
      transition: background-color 0.12s ease, border-left 0.12s ease;
      position: relative;
    }
    .tree-node:hover,
    [class*="tree-node"]:hover {
      background: var(--surface-hover);
    }
    .tree-node.selected,
    [class*="tree-node"].selected {
      background: var(--surface-hover);
      border-left: 2px solid var(--brand);
      padding-left: 6px;
    }
    .tree-node.active,
    [class*="tree-node"].active {
      background: color-mix(in srgb, var(--brand) 10%, var(--surface-raised));
      color: var(--text-main);
      font-weight: 600;
      border-left: 2px solid var(--brand-strong);
      padding-left: 6px;
    }
    .tree-node.folder {
      font-weight: 600;
    }
    .tree-node.dirty::before,
    [class*="tree-node"].dirty::before {
      content: '●';
      color: var(--accent-warning, #f59e0b);
      margin-right: 4px;
      font-size: 9px;
    }

    /* ----- Editor tabs polish ----- */
    .editor-tabs-bar {
      background: var(--surface-canvas);
      border-bottom: 1px solid var(--divider);
      padding: 0;
      display: flex;
      align-items: stretch;
      overflow-x: auto;
      scrollbar-width: thin;
    }
    .editor-tab,
    [class*="editor-tab"] {
      padding: 8px 16px;
      font-size: 11.5px;
      color: var(--text-subtle);
      background: transparent;
      border-right: 1px solid var(--divider);
      border-bottom: 2px solid transparent;
      transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
      cursor: pointer;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .editor-tab:hover,
    [class*="editor-tab"]:hover {
      background: var(--surface-hover);
      color: var(--text-main);
    }
    .editor-tab.active,
    [class*="editor-tab"].active {
      color: var(--brand-strong);
      border-bottom-color: var(--brand);
      background: var(--surface-panel);
      font-weight: 600;
    }
    .editor-tab.dirty .editor-tab-dot,
    [class*="editor-tab"].dirty .editor-tab-dot {
      background: var(--brand);
      box-shadow: 0 0 0 2px var(--brand-soft);
    }

    /* ----- Editor status bar polish ----- */
    .editor-status-bar {
      background: var(--bg-card);
      border-top: 1px solid var(--bg-border);
      padding: 4px 10px;
      font-size: 10.5px;
      color: var(--text-muted);
      gap: 12px;
    }
    .editor-status-item {
      padding: 2px 6px;
      border-radius: 4px;
      transition: background-color 0.12s ease;
    }
    .editor-status-btn:hover {
      background: var(--bg-panel);
      color: var(--accent-primary);
    }

    /* ----- Chat input polish ----- */
    .chat-container {
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      overflow: hidden;
    }
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 12px;
      background: var(--surface-canvas);
    }
    .chat-input-wrapper {
      padding: 12px;
      background: var(--bg-card);
      border-top: 1px solid var(--bg-border);
    }
    .chat-input-box {
      background: var(--surface-panel);
      border: 1px solid var(--divider);
      border-radius: var(--radius-lg);
      padding: 12px;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
      box-shadow: var(--shadow-sm);
    }
    .chat-input-box:focus-within {
      border-color: var(--brand);
      box-shadow: 0 0 0 3px var(--brand-soft);
    }
    .chat-input-box textarea {
      width: 100%;
      background: transparent;
      border: none;
      outline: none;
      resize: vertical;
      min-height: 48px;
      font-family: inherit;
      font-size: 12.5px;
      line-height: 1.5;
      color: var(--text-main);
      padding: 0;
    }
    .chat-input-box textarea::placeholder {
      color: var(--text-subtle);
    }
    .chat-input-controls {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 8px;
      gap: 8px;
    }

    /* ----- Segmented control (chat mode) polish ----- */
    .segmented-control {
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      border-radius: 8px;
      padding: 3px;
      gap: 2px;
    }
    .segmented-control button {
      padding: 4px 12px;
      font-size: 11px;
      border-radius: 5px;
      transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
      color: var(--text-muted);
    }
    .segmented-control button.btn-primary {
      background: var(--bg-card);
      color: var(--accent-primary);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
      font-weight: 600;
    }
    .segmented-control button.btn-ghost:hover {
      color: var(--text-main);
      background: var(--bg-panel);
    }

    /* ----- Stream content / activity cards polish ----- */
    .stream-content {
      background: var(--bg-main);
      padding: 12px;
      overflow-y: auto;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .activity-card,
    [class*="activity-card"] {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: 10px;
      padding: 10px 12px;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    }
    .activity-card:hover,
    [class*="activity-card"]:hover {
      border-color: color-mix(in srgb, var(--accent-primary) 28%, var(--bg-border));
      transform: translateY(-1px);
    }
    .activity-card.executing,
    .activity-card.testing,
    .activity-card.critical {
      border-left: 3px solid var(--accent-primary);
    }
    .activity-card.validating {
      border-left: 3px solid var(--accent-success, #16a34a);
    }
    .activity-card.warning {
      border-left: 3px solid var(--accent-warning, #f59e0b);
    }
    .activity-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 4px;
    }
    .activity-title {
      font-weight: 600;
      font-size: 12px;
      color: var(--text-main);
    }
    .activity-time {
      font-size: 10px;
      color: var(--text-subtle);
      font-family: var(--font-mono);
    }
    .activity-body {
      font-size: 11.5px;
      color: var(--text-muted);
      line-height: 1.5;
    }

    /* ----- Toast notifications polish ----- */
    #toast-container {
      position: fixed;
      z-index: 10000;
    }
    .toast,
    [class*="toast"]:not([class*="toast-container"]) {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-left: 3px solid var(--accent-primary);
      border-radius: 10px;
      padding: 10px 14px;
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
      backdrop-filter: blur(10px);
      color: var(--text-main);
      font-size: 12px;
      max-width: 360px;
    }
    .toast-success,
    [class*="toast-success"] {
      border-left-color: var(--accent-success, #16a34a);
    }
    .toast-warning,
    [class*="toast-warning"] {
      border-left-color: var(--accent-warning, #f59e0b);
    }
    .toast-error,
    [class*="toast-error"] {
      border-left-color: var(--accent-danger, #dc2626);
    }

    /* ----- Stream / inspector panel borders ----- */
    .stream-inspector-container {
      display: flex;
      flex-direction: column;
      height: 100%;
      background: var(--bg-card);
    }

    /* ----- History modal polish ----- */
    .history-modal-box {
      width: 95%;
      max-width: 1280px;
      height: 88vh;
      max-height: 820px;
    }
    .history-lane-label {
      font-weight: 600;
      font-size: 11px;
      color: var(--text-muted);
      letter-spacing: 0.02em;
    }
    .history-commit-card,
    [class*="history-commit-card"] {
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: 8px;
      padding: 8px 10px;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    }
    .history-commit-card:hover {
      border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-border));
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }
    .history-commit-card.current,
    [class*="history-commit-card"].current {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 22%, transparent);
    }
    .history-inspector-panel {
      background: var(--bg-card);
      border-left: 1px solid var(--bg-border);
      padding: 14px;
      overflow-y: auto;
    }
    .history-graph-toolbar {
      padding: 10px 14px;
      background: var(--bg-card);
      border-bottom: 1px solid var(--bg-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .history-legend-item {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 10.5px;
      color: var(--text-muted);
    }
    .history-legend-node {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--accent-primary);
      display: inline-block;
    }

    /* ----- Empty states polish ----- */
    [id*="-placeholder"],
    [id*="-empty"] {
      text-align: center;
      padding: 32px 16px;
      color: var(--text-muted);
      font-size: 12px;
      line-height: 1.5;
    }

    /* ----- Tag chips (used for tags on toggles, badges etc.) ----- */
    .chip,
    [class*="chip-"] {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 600;
      background: var(--bg-panel);
      border: 1px solid var(--bg-border);
      color: var(--text-muted);
    }

    /* ----- Gutter polish (split pane drag handles) ----- */
    .gutter {
      background: var(--bg-main);
      transition: background-color 0.15s ease;
    }
    .gutter:hover,
    .gutter.dragging {
      background: color-mix(in srgb, var(--accent-primary) 35%, var(--bg-main));
    }
    .gutter-sidebar {
      cursor: col-resize;
    }

    /* ----- Tab content panels ----- */
    .stream-content[style*="display: none"],
    .stream-content[style*="display:none"] {
      /* Hidden state preserved */
    }

    /* ----- Icon polish (slightly thicker strokes for clarity) ----- */
    .icon {
      stroke-width: 1.8;
    }
    .icon-sm {
      stroke-width: 2;
    }

    /* ----- Focus polish for keyboard navigation ----- */
    button:focus-visible,
    [tabindex]:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: none;
    }

    /* ----- Subtle transitions everywhere ----- */
    .panel-tab,
    .editor-tab,
    .panel-header,
    .chat-input-box,
    .form-input,
    .form-select,
    .btn,
    .activity-card,
    .history-commit-card {
      transition-duration: 0.15s;
      transition-timing-function: ease;
    }

    /* ----- Compact mode for small viewports ----- */
    @media (max-width: 1100px) {
      #top-nav .btn span:not(.icon):not(.badge) {
        display: none;
      }
      #top-nav .history-toolbar {
        display: none;
      }
    }
    @media (max-width: 820px) {
      #top-nav {
        padding: 6px 8px;
        gap: 6px;
      }
      #status-bar {
        font-size: 10.5px;
        padding: 4px 8px;
      }
      .panel-tab span:not(.badge):not(.icon) {
        display: none;
      }
    }

    /* ----- Live AI Model Picker Styles ----- */
    .model-picker-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      background: var(--bg-card);
      border: 1px solid var(--bg-border);
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s ease;
      gap: 12px;
    }
    .model-picker-card:hover {
      border-color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 8%, var(--bg-card));
      transform: translateY(-1px);
    }
    .model-picker-card.selected {
      border-color: var(--accent-primary);
      background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-card));
    }
    .model-filter-chip {
      padding: 3px 9px;
      border-radius: 12px;
      border: 1px solid var(--bg-border);
      background: var(--bg-card);
      color: var(--text-muted);
      cursor: pointer;
      font-size: 11px;
      font-weight: 500;
      transition: all 0.15s ease;
      white-space: nowrap;
    }
    .model-filter-chip:hover {
      border-color: var(--text-muted);
      color: var(--text-main);
    }
    .model-filter-chip.active {
      background: var(--accent-primary);
      color: #fff;
      border-color: var(--accent-primary);
    }

    /* ----- Pricing Grid for Modal ----- */
    .pricing-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
    .pricing-tier {
      background: var(--surface-panel);
      border: 1px solid var(--divider);
      border-radius: var(--radius-lg);
      padding: 14px;
      display: flex;
      flex-direction: column;
      transition: transform 0.2s, box-shadow 0.2s;
      position: relative;
      overflow: hidden;
    }
    .pricing-tier:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); border-color: var(--brand); }
    .pricing-tier h4 { margin: 0 0 6px 0; font-size: 13px; color: var(--text-main); letter-spacing: 0.03em; }
    .pricing-tier .price { font-size: 18px; font-weight: 800; color: var(--brand); margin-bottom: 2px; }
    .pricing-tier .subprice { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
    .pricing-tier ul { margin: 0; padding-left: 14px; font-size: 11px; color: var(--text-muted); flex-grow: 1; }
    .pricing-tier ul li { margin-bottom: 6px; line-height: 1.35; }
    .pricing-btn {
      margin-top: 12px;
      padding: 8px;
      border-radius: var(--radius-md);
      border: none;
      background: var(--brand);
      color: #fff;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.2s;
      font-size: 12px;
    }
    .pricing-btn:hover { opacity: 0.9; }
    @media (max-width: 600px) {
      .pricing-grid { grid-template-columns: 1fr; max-height: 46vh; overflow-y: auto; }
    }

    /* ==========================================================================
       RESUME PREVIOUS PROJECT FLOATING PILL (FLWCODE)
       ========================================================================== */
    #flwcode-resume-pill {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 9999;
      animation: flwcodePillSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
      pointer-events: auto;
    }

    @keyframes flwcodePillSlideUp {
      0% {
        opacity: 0;
        transform: translate(-50%, 20px) scale(0.95);
      }
      100% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
      }
    }

    .flwcode-resume-pill-content {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      background: rgba(22, 28, 42, 0.94);
      backdrop-filter: blur(16px) saturate(180%);
      -webkit-backdrop-filter: blur(16px) saturate(180%);
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
      padding: 6px 14px 6px 16px;
      border-radius: 9999px;
      color: var(--text-main, #f1f5f9);
      font-size: 13px;
      font-family: inherit;
      white-space: nowrap;
      transition: all 0.2s ease;
    }

    [data-theme="light"] .flwcode-resume-pill-content {
      background: rgba(255, 255, 255, 0.96);
      border: 1px solid rgba(0, 0, 0, 0.12);
      box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
      color: #0f172a;
    }

    .flwcode-resume-pill-icon {
      font-size: 14px;
      display: flex;
      align-items: center;
      color: var(--brand, #3b82f6);
    }

    .flwcode-resume-pill-text {
      max-width: 280px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--text-muted, #94a3b8);
    }

    .flwcode-resume-pill-text strong {
      color: var(--text-main, #f1f5f9);
      font-weight: 600;
    }

    [data-theme="light"] .flwcode-resume-pill-text strong {
      color: #0f172a;
    }

    .flwcode-resume-pill-btn {
      background: linear-gradient(135deg, #3b82f6, #2563eb);
      color: #ffffff;
      border: none;
      border-radius: 9999px;
      padding: 4px 14px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      letter-spacing: 0.01em;
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
      transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    }

    .flwcode-resume-pill-btn:hover {
      transform: translateY(-1px);
      filter: brightness(1.1);
      box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
    }

    .flwcode-resume-pill-btn:active {
      transform: translateY(0);
    }

    .flwcode-resume-pill-close {
      background: transparent;
      border: none;
      color: var(--text-muted, rgba(148, 163, 184, 0.8));
      font-size: 18px;
      line-height: 1;
      padding: 2px 4px;
      margin-left: -4px;
      cursor: pointer;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color 0.15s ease, background-color 0.15s ease;
    }

    .flwcode-resume-pill-close:hover {
      color: var(--text-main, #ffffff);
      background-color: rgba(255, 255, 255, 0.1);
    }

    [data-theme="light"] .flwcode-resume-pill-close:hover {
      color: #0f172a;
      background-color: rgba(0, 0, 0, 0.06);
    }

    @media (max-width: 600px) {
      #flwcode-resume-pill {
        bottom: 64px;
        width: calc(100% - 24px);
      }
      .flwcode-resume-pill-content {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
      }
      .flwcode-resume-pill-text {
        max-width: 160px;
      }
    }

    /* Hinter Council Toolbar Toggle & Chat Deliberation Card */
    .btn-council-toggle {
      transition: all 0.2s ease;
      cursor: pointer;
      user-select: none;
    }
    .btn-council-toggle:hover {
      border-color: var(--accent-primary) !important;
      background: rgba(9, 105, 218, 0.08) !important;
    }
    .btn-council-toggle.active {
      border-color: var(--accent-primary) !important;
      background: rgba(9, 105, 218, 0.12) !important;
      color: var(--accent-primary) !important;
      font-weight: 600;
    }
    .council-chat-details summary {
      outline: none;
      transition: color 0.15s ease;
    }
    .council-chat-details summary:hover {
      filter: brightness(1.15);
    }
    .council-chat-details[open] {
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }