/* ============================================================
   ALBERT AGENT V2 - PREMIUM DARK THEME
   ============================================================ */
   @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

   :root {
     /* Core Colors */
     --bg: #050507;
     --bg-gradient: linear-gradient(135deg, #050507 0%, #0c0e14 100%);
     
     /* Dark Glass Panels */
     --panel: rgba(18, 18, 24, 0.65);
     --panel-solid: #15161c;
     --panel-inset: rgba(30, 31, 40, 0.6);
     --panel-hover: rgba(40, 42, 54, 0.8);
     
     /* Borders */
     --border: rgba(255, 255, 255, 0.08);
     --border-strong: rgba(255, 255, 255, 0.15);
     --border-focus: rgba(94, 137, 255, 0.5);
     
     /* Text Colors */
     --text: #f0f0f5;
     --text-muted: #9ba0aa;
     --text-dim: #646a78;
     
     /* Accents */
     --accent-primary: #007ac2; /* Albert Blue */
     --accent-primary-hover: #00609a;
     --accent-glow: rgba(0, 122, 194, 0.4);
     --accent-purple: #007ac2; /* Kept variable name but changed to Albert Blue */
     --accent-purple-glow: rgba(255, 218, 0, 0.2); /* Albert Yellow for secondary glow */
     --accent-yellow: #ffda00;
     --accent-green: #6caf2a;
     
     /* Status */
     --success: #10b981;
     --success-soft: rgba(16, 185, 129, 0.15);
     --warning: #f59e0b;
     --warning-soft: rgba(245, 158, 11, 0.15);
     --danger: #ef4444;
     --danger-soft: rgba(239, 68, 68, 0.15);
     
     /* Effects */
     --blur: blur(16px);
     --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
     --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
     --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
     
     /* Layout */
     --radius-sm: 8px;
     --radius-md: 12px;
     --radius-lg: 16px;
     --font-body: 'Outfit', sans-serif;
     --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
   }
   
   /* ---------------- Reset & Base ---------------- */
   * { 
     box-sizing: border-box; 
     margin: 0; 
     padding: 0;
   }
   
   html, body {
     height: 100%;
     width: 100%;
     overflow: hidden;
     background: var(--bg);
   }
   
   body {
     font-family: var(--font-body);
     color: var(--text);
     font-size: 15px;
     line-height: 1.6;
     display: flex;
     flex-direction: column;
     -webkit-font-smoothing: antialiased;
     background: var(--bg-gradient);
     position: relative;
   }
   
   /* Custom Scrollbar */
   ::-webkit-scrollbar { width: 6px; height: 6px; }
   ::-webkit-scrollbar-track { background: transparent; }
   ::-webkit-scrollbar-thumb { 
     background: rgba(255,255,255,0.1); 
     border-radius: 10px; 
   }
   ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
   
   /* Ambient Glow Effects Overlay */
   .ambient-glow {
     position: absolute;
     width: 600px;
     height: 600px;
     background: var(--accent-glow);
     filter: blur(120px);
     border-radius: 50%;
     top: -200px;
     left: -100px;
     z-index: 0;
     opacity: 0.6;
     pointer-events: none;
   }
   .ambient-glow.glow-2 {
     background: var(--accent-purple-glow);
     top: auto;
     bottom: -200px;
     right: -100px;
     left: auto;
   }
   
   /* ---------------- Typography & Utilities ---------------- */
   .muted { color: var(--text-muted); font-weight: 400; font-size: 13px; }
   
   /* ---------------- Topbar ---------------- */
   .topbar {
     position: relative;
     z-index: 10;
     display: flex;
     justify-content: space-between;
     align-items: center;
     padding: 12px 24px;
     background: rgba(10, 10, 14, 0.4);
     backdrop-filter: var(--blur);
     border-bottom: 1px solid var(--border);
     flex-shrink: 0;
     height: 60px;
   }
   
   .brand {
     display: flex;
     align-items: center;
     gap: 12px;
   }
   
   .brand-icon {
     width: 32px;
     height: 32px;
     background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
     border-radius: var(--radius-sm);
     display: flex;
     align-items: center;
     justify-content: center;
     color: white;
     box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
   }
   
   .brand-text {
     display: flex;
     flex-direction: column;
     line-height: 1.2;
   }
   .brand-text span:first-child {
     font-weight: 700;
     font-size: 16px;
     letter-spacing: 0.5px;
     background: linear-gradient(to right, #fff, #a5b4fc);
     -webkit-background-clip: text;
     -webkit-text-fill-color: transparent;
   }
   
   .topbar-right {
     display: flex;
     align-items: center;
     gap: 16px;
   }
   
   .status {
     font-size: 12px;
     font-weight: 500;
     display: flex;
     align-items: center;
     gap: 6px;
     padding: 4px 10px;
     border-radius: 20px;
     background: rgba(255,255,255,0.05);
   }
   .status::before {
     content: '';
     display: block;
     width: 8px;
     height: 8px;
     border-radius: 50%;
   }
   .status.ok { color: var(--success); background: var(--success-soft); border: 1px solid rgba(16,185,129,0.2); }
   .status.ok::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
   .status.error { color: var(--danger); background: var(--danger-soft); border: 1px solid rgba(239,68,68,0.2);}
   .status.error::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
   
   /* Buttons */
   .btn-ghost, .btn-icon, .btn-primary {
     display: inline-flex;
     align-items: center;
     justify-content: center;
     gap: 6px;
     font-family: var(--font-body);
     border-radius: var(--radius-sm);
     cursor: pointer;
     transition: var(--transition);
     font-weight: 500;
     border: none;
   }
   
   .btn-ghost {
     background: transparent;
     color: var(--text-muted);
     padding: 6px 12px;
     font-size: 13px;
     border: 1px solid transparent;
   }
   .btn-ghost:hover:not(:disabled) {
     color: var(--text);
     background: rgba(255,255,255,0.05);
     border-color: var(--border);
   }
   
   .btn-primary {
     background: var(--accent-primary);
     color: white;
     padding: 8px 16px;
     font-size: 13px;
     box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
   }
   .btn-primary:hover:not(:disabled) {
     background: var(--accent-primary-hover);
     box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
     transform: translateY(-1px);
   }
   .btn-primary:disabled, .btn-ghost:disabled {
     opacity: 0.5;
     cursor: not-allowed;
   }
   
   /* ---------------- Layout & Panels ---------------- */
   .layout {
     position: relative;
     z-index: 10;
     flex: 1;
     display: grid;
     grid-template-columns: 2.5fr 4fr 380px;
     gap: 16px;
     padding: 16px;
     overflow: hidden;
     min-height: 0;
   }
   
   .panel {
     background: var(--panel);
     backdrop-filter: var(--blur);
     border: 1px solid var(--border);
     border-radius: var(--radius-md);
     box-shadow: var(--shadow-sm);
     display: flex;
     flex-direction: column;
     overflow: hidden;
     min-height: 0;
     transition: border-color var(--transition);
   }
   
   .panel-header {
     padding: 14px 20px;
     border-bottom: 1px solid var(--border);
     display: flex;
     justify-content: space-between;
     align-items: center;
     background: rgba(255, 255, 255, 0.02);
   }
   
   .panel-title {
     font-size: 14px;
     font-weight: 600;
     text-transform: uppercase;
     letter-spacing: 1px;
     color: var(--text-muted);
     display: flex;
     align-items: center;
     gap: 8px;
   }
   
   /* ---------------- Chat Panel ---------------- */
   .chat-panel { 
     min-width: 0; 
   }
   
   .chat-log {
     flex: 1;
     overflow-y: auto;
     padding: 20px;
     display: flex;
     flex-direction: column;
     gap: 24px;
     scroll-behavior: smooth;
   }
   
   .bubble {
     display: flex;
     gap: 12px;
     max-width: 92%;
     animation: fadeIn 0.3s ease-out;
   }
   
   @keyframes fadeIn {
     from { opacity: 0; transform: translateY(10px); }
     to { opacity: 1; transform: translateY(0); }
   }
   
   .bubble.user {
     align-self: flex-end;
     flex-direction: row-reverse;
   }
   
   .bubble-text {
     padding: 12px 16px;
     border-radius: var(--radius-md);
     font-size: 15px;
     line-height: 1.5;
     word-wrap: break-word;
   }
   
   .bubble.user .bubble-text {
     background: var(--accent-primary);
     color: white;
     border-bottom-right-radius: 4px;
     box-shadow: 0 4px 12px rgba(59,130,246,0.2);
   }
   
   .bubble.agent .bubble-text {
     background: var(--panel-inset);
     border: 1px solid var(--border);
     color: var(--text);
     border-top-left-radius: 4px;
   }
   
   .bubble-avatar {
     width: 32px;
     height: 32px;
     border-radius: 50%;
     background: rgba(255,255,255,0.05);
     border: 1px solid var(--border);
     display: flex;
     align-items: center;
     justify-content: center;
     flex-shrink: 0;
     color: var(--accent-primary);
   }
   .bubble.user .bubble-avatar { display: none; }
   
   .bubble.welcome .bubble-avatar { color: var(--accent-purple); }
   .bubble.welcome .bubble-text {
     background: transparent;
     border: 1px solid var(--border-strong);
     box-shadow: inset 0 0 20px rgba(255,255,255,0.02);
   }
   
   .bubble-text p + p { margin-top: 10px; }
   
   .bubble.streaming::after {
     content: "";
     display: inline-block;
     width: 6px;
     height: 16px;
     background: var(--accent-primary);
     margin-left: 4px;
     animation: blink 1s step-end infinite;
     vertical-align: bottom;
   }
   @keyframes blink { 50% { opacity: 0; } }
   
   .typing-indicator {
     display: flex;
     gap: 4px;
     padding: 4px;
     align-items: center;
     min-height: 24px;
   }
   .typing-indicator .dot {
     width: 6px;
     height: 6px;
     background: var(--accent-primary);
     border-radius: 50%;
     animation: typing-dot 1.4s infinite ease-in-out both;
   }
   .typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
   .typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
   @keyframes typing-dot {
     0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
     40% { transform: scale(1); opacity: 1; }
   }
   
   .suggestions {
     margin-top: 16px;
     display: flex;
     flex-wrap: wrap;
     gap: 8px;
   }
   
   .chip {
     background: rgba(255, 255, 255, 0.05);
     border: 1px solid var(--border);
     border-radius: 20px;
     padding: 6px 14px;
     font-size: 13px;
     cursor: pointer;
     color: var(--text);
     transition: var(--transition);
     font-family: inherit;
   }
   .chip:hover {
     background: rgba(59, 130, 246, 0.1);
     border-color: var(--accent-primary);
     color: #fff;
     box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
     transform: translateY(-1px);
   }
   
   /* ---------------- Tool trace (live) ---------------- */
   .tool-trace {
     align-self: flex-start;
     margin-left: 44px;
     max-width: 85%;
     padding: 10px 14px;
     background: var(--panel-solid);
     border-radius: var(--radius-sm);
     border-left: 3px solid var(--border-strong);
     font-size: 12px;
     color: var(--text-muted);
     transition: var(--transition);
     display: flex;
     flex-direction: column;
     gap: 6px;
     font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
   }
   
   .tool-trace.running {
     border-left-color: var(--accent-purple);
     box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
   }
   .tool-trace.done {
     border-left-color: var(--success);
   }
   
   .tool-line {
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 12px;
   }
   
   .tool-name {
     color: var(--text);
     font-weight: 600;
   }
   
   .tool-status {
     font-size: 10px;
     padding: 2px 6px;
     border-radius: 4px;
     font-weight: 700;
     text-transform: uppercase;
     letter-spacing: 1px;
     font-family: var(--font-body);
   }
   .tool-trace.running .tool-status {
     background: rgba(139, 92, 246, 0.2);
     color: #c4b5fd;
   }
   .tool-trace.done .tool-status {
     background: var(--success-soft);
     color: var(--success);
   }
   
   .tool-input { color: #8b949e; word-break: break-all; }
   .tool-result {
     color: var(--text-dim);
     padding-top: 6px;
     border-top: 1px dashed var(--border);
     font-family: var(--font-body);
     line-height: 1.5;
   }
   
   /* Spinner */
   .tool-trace.running .tool-status::before {
     content: "";
     display: inline-block;
     width: 6px;
     height: 6px;
     background: currentColor;
     border-radius: 50%;
     margin-right: 6px;
     animation: pulse 1s infinite;
     vertical-align: middle;
   }
   
   /* Input Area */
   .chat-input-wrapper {
     padding: 16px 20px;
     border-top: 1px solid var(--border);
     background: rgba(255, 255, 255, 0.02);
   }
   
   .input-container {
     display: flex;
     align-items: center;
     gap: 12px;
     background: var(--panel-solid);
     border: 1px solid var(--border-strong);
     border-radius: var(--radius-lg);
     padding: 8px 16px;
     transition: var(--transition);
   }
   .input-container:focus-within {
     border-color: var(--accent-primary);
     box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
   }
   
   .input-container textarea {
     flex: 1;
     background: transparent;
     border: none;
     color: var(--text);
     font-family: inherit;
     font-size: 15px;
     resize: none;
     outline: none;
     padding: 8px 0;
     max-height: 120px;
   }
   .input-container textarea::placeholder { color: var(--text-dim); }
   
   .btn-send {
     background: var(--bg);
     color: var(--text);
     border: 1px solid var(--border);
     width: 36px;
     height: 36px;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     cursor: pointer;
     transition: var(--transition);
   }
   .btn-send svg { width: 18px; height: 18px; }
   .btn-send:hover:not(:disabled) {
     background: var(--accent-primary);
     border-color: var(--accent-primary);
     color: white;
     transform: scale(1.05);
   }
   
   /* ---------------- Workspace ---------------- */
   .workspace-panel { min-width: 0; }
   
   .badge {
     background: rgba(255,255,255,0.1);
     padding: 2px 8px;
     border-radius: 12px;
     font-size: 11px;
     color: var(--text);
   }
   
   .workspace {
     flex: 1;
     overflow-y: auto;
     padding: 24px;
   }
   
   .workspace-empty {
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
     height: 100%;
     text-align: center;
     color: var(--text-dim);
   }
   .empty-icon {
     font-size: 48px;
     margin-bottom: 16px;
     opacity: 0.5;
   }
   .workspace-empty h3 { color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
   .workspace-empty p { max-width: 300px; font-size: 14px; }
   
   /* Forms in Workspace */
   .ws-field { margin-bottom: 24px; }
   .ws-field-label {
     font-size: 11px;
     font-weight: 700;
     color: var(--accent-purple);
     letter-spacing: 1.5px;
     text-transform: uppercase;
     margin-bottom: 8px;
   }
   .ws-field-value { font-size: 15px; color: var(--text-muted); }
   
   .ws-theme {
     font-size: 24px;
     font-weight: 600;
     color: var(--text);
     line-height: 1.3;
   }
   
   .ws-idea {
     font-style: italic;
     color: var(--text);
     background: rgba(255,255,255,0.03);
     border-left: 3px solid var(--accent-primary);
     padding: 12px 16px;
     border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
   }
   
   .ws-products { display: flex; flex-direction: column; gap: 12px; }
   .ws-product {
     padding: 16px;
     background: rgba(255,255,255,0.02);
     border-radius: var(--radius-md);
     border: 1px solid var(--border);
     display: flex;
     gap: 16px;
     transition: var(--transition);
   }
   .ws-product:hover { background: rgba(255,255,255,0.04); border-color: var(--border-strong); }
   
   .ws-product-num {
     font-size: 20px;
     font-weight: 700;
     color: var(--accent-primary);
     opacity: 0.5;
   }
   
   .ws-product-name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
   .ws-product-rationale { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
   .ws-product-pillar {
     display: inline-block;
     background: rgba(0, 122, 194, 0.15);
     color: var(--accent-primary);
     padding: 2px 8px;
     border-radius: 12px;
     font-size: 11px;
     font-weight: 600;
     letter-spacing: 0.5px;
   }
   
   .ws-arguments { display: flex; flex-direction: column; gap: 8px; }
   .ws-argument {
     padding-left: 20px;
     position: relative;
     font-size: 14px;
     color: var(--text-muted);
     line-height: 1.5;
   }
   .ws-argument::before {
     content: '→';
     position: absolute;
     left: 0;
     color: var(--accent-purple);
   }
   
   /* ---------------- Sidebar ---------------- */
   .sidebar-panel { overflow-y: auto; padding: 0; }
   
   .sidebar-section {
     padding: 20px;
     border-bottom: 1px solid var(--border);
   }
   .sidebar-section:last-child { border-bottom: none; }
   
   .section-header {
     margin-bottom: 16px;
     display: flex;
     justify-content: space-between;
     align-items: center;
   }
   
   .btn-icon {
     background: rgba(255,255,255,0.05);
     border: 1px solid var(--border);
     color: var(--text);
     width: 24px;
     height: 24px;
     border-radius: var(--radius-sm);
     font-size: 16px;
     display: flex;
     align-items: center;
     justify-content: center;
     cursor: pointer;
   }
   .btn-icon:hover { background: var(--accent-primary); border-color: var(--accent-primary); }
   
   .list { display: flex; flex-direction: column; gap: 8px; }
   
   .list-item {
     padding: 10px 12px;
     background: rgba(255,255,255,0.02);
     border: 1px solid var(--border);
     border-radius: var(--radius-sm);
     display: flex;
     justify-content: space-between;
     align-items: flex-start;
     gap: 8px;
     transition: var(--transition);
   }
   .list-item:hover {
     background: rgba(255,255,255,0.05);
     border-color: var(--border-strong);
   }
   
   .list-item-content { flex: 1; min-width: 0; cursor: default; }
   [data-camp-id] { cursor: pointer; }
   
   .list-item-title {
     font-weight: 500;
     font-size: 13px;
     margin-bottom: 4px;
     word-wrap: break-word;
     color: var(--text);
   }
   .list-item-meta {
     color: var(--text-dim);
     font-size: 12px;
     line-height: 1.4;
   }
   
   /* Tags */
   .rule-type-tag {
     display: inline-block;
     font-size: 10px;
     padding: 2px 6px;
     border-radius: 4px;
     font-weight: 700;
     text-transform: uppercase;
     letter-spacing: 0.5px;
     margin-right: 6px;
     vertical-align: text-bottom;
   }
   .rule-type-tag.prefer { background: rgba(16, 185, 129, 0.15); color: #34d399; }
   .rule-type-tag.target { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
   .rule-type-tag.exclude { background: rgba(239, 68, 68, 0.15); color: #f87171; }
   
   .btn-archive, .btn-delete {
     background: transparent;
     border: none;
     color: var(--text-muted);
     cursor: pointer;
     font-size: 12px;
     width: 20px;
     height: 20px;
     display: flex;
     align-items: center;
     justify-content: center;
     border-radius: 4px;
     opacity: 0;
     transition: var(--transition);
   }
   .list-item:hover .btn-archive, .list-item:hover .btn-delete { opacity: 1; }
   .btn-archive:hover { color: var(--accent-primary); background: rgba(0, 122, 194, 0.1); }
   .btn-delete:hover { color: var(--danger); background: var(--danger-soft); }
   
   
   .camp-perf {
     font-size: 11px;
     margin-top: 6px;
     padding: 4px 8px;
     border-radius: 4px;
     background: rgba(255,255,255,0.03);
   }
   .camp-perf.success { color: var(--accent-primary); border-left: 2px solid var(--accent-primary); }
   .camp-perf.fail { color: #f87171; border-left: 2px solid var(--danger); }

   /* ---------------- Archive Section ---------------- */
   .sidebar-archive {
     background: rgba(255,255,255,0.01);
   }

   .archive-header {
     cursor: pointer;
     user-select: none;
     transition: var(--transition);
   }
   .archive-header:hover { opacity: 0.85; }

   .archive-chevron {
     font-size: 12px;
     color: var(--text-dim);
     transition: transform 0.2s ease;
     display: inline-block;
   }

   .archive-count {
     display: inline-flex;
     align-items: center;
     justify-content: center;
     background: rgba(255,255,255,0.07);
     color: var(--text-dim);
     font-size: 10px;
     font-weight: 600;
     border-radius: 10px;
     padding: 1px 7px;
     letter-spacing: 0.3px;
     vertical-align: middle;
   }

   /* Collapsed state: list is hidden */
   .archive-collapsed {
     display: none;
   }
   /* Expanded state: list is visible */
   .archive-expanded {
     display: flex;
     flex-direction: column;
     gap: 6px;
     margin-top: 12px;
     max-height: 400px;
     overflow-y: auto;
   }

   /* Archive list items look slightly dimmer */
   .archive-item .list-item-title {
     color: var(--text-muted);
     font-size: 12px;
   }
   .archive-item .list-item-meta {
     font-size: 11px;
   }
   .archive-item {
     padding: 7px 10px;
     background: rgba(255,255,255,0.01);
   }
   .archive-item:hover {
     background: rgba(255,255,255,0.03);
   }


   /* ---------------- Responsive ---------------- */
   @media (max-width: 1200px) {
     .layout { grid-template-columns: 1fr 300px; }
     .workspace-panel { display: none; }
   }
   @media (max-width: 768px) {
     .layout { grid-template-columns: 1fr; }
     .sidebar-panel { display: none; }
     .chat-panel { margin-bottom: 0; }
   }

   /* Light Theme Variables */
   body.light-mode {
     --bg: #f8fafc;
     --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
     --panel: rgba(255, 255, 255, 0.85);
     --panel-solid: #ffffff;
     --panel-inset: rgba(241, 245, 249, 0.8);
     --panel-hover: rgba(255, 255, 255, 1);
     --border: rgba(0, 0, 0, 0.08);
     --border-strong: rgba(0, 0, 0, 0.15);
     --border-focus: rgba(59, 130, 246, 0.5);
     --text: #0f172a;
     --text-muted: #475569;
     --text-dim: #64748b;
     --accent-glow: rgba(0, 122, 194, 0.15);
     --accent-purple-glow: rgba(255, 218, 0, 0.15);
   }

   /* Light Theme Specific Adjustments */
   body.light-mode .topbar { background: rgba(255, 255, 255, 0.95); }
   body.light-mode .btn-ghost:hover:not(:disabled) { background: rgba(0,0,0,0.05); }
   body.light-mode .btn-icon { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: var(--text); }
   body.light-mode .btn-icon:hover { background: var(--accent-primary); border-color: var(--accent-primary); color: white; }
   body.light-mode .chip { background: rgba(0,0,0,0.03); color: var(--text); }
   body.light-mode .bubble-avatar { background: rgba(0,0,0,0.05); }
   body.light-mode .ws-idea { background: rgba(0,0,0,0.03); }
   body.light-mode .ws-product { background: rgba(0,0,0,0.02); }
   body.light-mode .list-item { background: rgba(0,0,0,0.02); }
   body.light-mode .list-item:hover { background: rgba(0,0,0,0.05); }
   body.light-mode .badge { background: rgba(0,0,0,0.05); }
   body.light-mode .bubble.welcome .bubble-text { background: var(--panel-solid); box-shadow: none; }
   body.light-mode .chat-input-wrapper { background: rgba(0,0,0,0.02); }
   body.light-mode .brand-icon { box-shadow: none; }

   /* ---------------- Modals ---------------- */
   .modal-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.6);
     backdrop-filter: blur(4px);
     z-index: 1000;
     display: flex;
     align-items: center;
     justify-content: center;
     opacity: 1;
     transition: opacity 0.2s;
   }
   .modal-overlay.hidden {
     opacity: 0;
     pointer-events: none;
   }
   .modal-container {
     background: var(--panel-solid);
     border: 1px solid var(--border-strong);
     border-radius: var(--radius-md);
     padding: 24px;
     width: 90%;
     max-width: 400px;
     box-shadow: var(--shadow-lg);
     transform: scale(1);
     transition: transform 0.2s;
   }
   .modal-overlay.hidden .modal-container { transform: scale(0.95); }
   .modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
   .modal-body { margin-bottom: 24px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
   .modal-footer { display: flex; justify-content: flex-end; gap: 12px; }
   
   .modal-btn {
     padding: 8px 16px;
     border-radius: var(--radius-sm);
     font-size: 14px;
     font-weight: 500;
     cursor: pointer;
     transition: var(--transition);
     border: 1px solid transparent;
   }
   .modal-btn-cancel { background: rgba(255,255,255,0.05); color: var(--text); border-color: var(--border); }
   .modal-btn-cancel:hover { background: rgba(255,255,255,0.1); }
   .modal-btn-confirm { background: var(--accent-primary); color: white; }
   .modal-btn-confirm:hover { background: var(--accent-primary-hover); }
   .modal-btn-danger { background: var(--danger); color: white; }
   .modal-btn-danger:hover { background: #dc2626; }
   
   body.light-mode .modal-container { background: #fff; border-color: rgba(0,0,0,0.1); }
   body.light-mode .modal-btn-cancel { background: rgba(0,0,0,0.05); color: var(--text); border-color: rgba(0,0,0,0.1); }
   body.light-mode .modal-btn-cancel:hover { background: rgba(0,0,0,0.1); }
   
   /* Rule Form Modal */
   .rule-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
   .rule-type-btn {
     background: rgba(255,255,255,0.02);
     border: 1px solid var(--border);
     padding: 10px;
     border-radius: var(--radius-sm);
     cursor: pointer;
     text-align: left;
     transition: var(--transition);
     color: var(--text);
     display: flex;
     flex-direction: column;
     gap: 6px;
   }
   body.light-mode .rule-type-btn { background: rgba(0,0,0,0.02); }
   .rule-type-btn:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.05); }
   .rule-type-btn.selected { border-color: var(--accent-primary); background: rgba(0, 122, 194, 0.1); }
   
   .rule-input {
     width: 100%;
     background: var(--panel);
     border: 1px solid var(--border);
     color: var(--text);
     padding: 10px;
     border-radius: var(--radius-sm);
     margin-bottom: 12px;
     font-family: inherit;
   }
   body.light-mode .rule-input { background: #fff; border-color: rgba(0,0,0,0.1); }
   .rule-input:focus { outline: none; border-color: var(--accent-primary); }

   /* ---------------- Login Page ---------------- */
   .login-body {
     display: flex;
     align-items: center;
     justify-content: center;
     min-height: 100vh;
   }
   .login-container {
     width: 100%;
     max-width: 400px;
     padding: 20px;
     z-index: 10;
   }
   .login-card {
     padding: 40px;
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-lg);
     background: var(--panel);
     border: 1px solid var(--border-strong);
   }
   .login-header {
     text-align: center;
     margin-bottom: 32px;
   }
   .input-group {
     margin-bottom: 20px;
     text-align: left;
   }
   .input-group label {
     display: block;
     font-size: 13px;
     color: var(--text-muted);
     margin-bottom: 8px;
     font-weight: 500;
   }
   .input-group input {
     width: 100%;
     background: var(--panel-solid);
     border: 1px solid var(--border);
     color: var(--text);
     padding: 12px 16px;
     border-radius: var(--radius-sm);
     font-family: var(--font-body);
     font-size: 15px;
     transition: var(--transition);
   }
   .input-group input:focus {
     border-color: var(--accent-primary);
     outline: none;
     box-shadow: 0 0 0 3px rgba(0, 122, 194, 0.2);
   }
   .login-error {
     background: var(--danger-soft);
     color: var(--danger);
     padding: 12px;
     border-radius: var(--radius-sm);
     font-size: 13px;
     margin-bottom: 20px;
     text-align: center;
     border: 1px solid rgba(239, 68, 68, 0.2);
   }
   .hidden {
     display: none !important;
   }
   body.light-mode .input-group input { background: #fff; border-color: rgba(0,0,0,0.1); }

   /* ---------------- Agent Status Overlay ---------------- */
   .agent-status-overlay {
     position: absolute;
     top: 15%;
     left: 50%;
     transform: translateX(-50%);
     z-index: 1000;
     pointer-events: none;
     transition: opacity 0.3s ease, transform 0.3s ease;
     opacity: 1;
   }
   .agent-status-overlay.status-hidden {
     opacity: 0;
     transform: translate(-50%, -20px);
   }
   .agent-status-box {
     background: rgba(18, 18, 24, 0.85);
     backdrop-filter: blur(20px);
     border: 1px solid var(--accent-primary);
     padding: 12px 24px;
     border-radius: 30px;
     box-shadow: 0 10px 30px rgba(0, 122, 194, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
     display: flex;
     align-items: center;
     gap: 12px;
     color: #ffffff;
     font-weight: 500;
     font-size: 14px;
     letter-spacing: 0.5px;
   }
   .agent-spinner {
     width: 16px;
     height: 16px;
     border: 2px solid rgba(255, 255, 255, 0.1);
     border-top-color: var(--accent-primary);
     border-radius: 50%;
     animation: spin 1s linear infinite;
   }
   .agent-spinner.done {
     animation: none;
     border-color: transparent;
     position: relative;
   }
   .agent-spinner.done::after {
     content: "✓";
     position: absolute;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     color: var(--success);
     font-size: 16px;
     font-weight: 700;
   }
   @keyframes spin {
     to { transform: rotate(360deg); }
   }
