*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#0d1017;--surface:#151921;--surface2:#1c2130;--surface3:#232a3b;
  --border:#2a3040;--border-light:#353d52;
  --text:#d0d4e0;--text-dim:#6b7394;--text-bright:#f0f2f8;
  --accent:#7c9aff;--accent-dim:#5a7ae6;--accent-glow:rgba(124,154,255,0.12);
  --user-bg:linear-gradient(135deg,#1a3a6a,#1e4080);--user-border:#2a5090;
  --agent-bg:linear-gradient(135deg,#161d2e,#1a2338);--agent-border:#263050;
  --error:#f06868;--error-bg:rgba(240,104,104,0.08);
  --success:#4eca60;--warning:#f0c040;
  --orange:#f09030;--purple:#a888f0;
  --radius:10px;--radius-lg:14px;
  --font:'Inter',system-ui,-apple-system,sans-serif;
  --mono:'JetBrains Mono','Fira Code',monospace;
  --shadow-sm:0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:0 4px 12px rgba(0,0,0,0.25);
}
html,body,#root{height:100%;font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;line-height:1.6}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* Layout */
.app{display:flex;flex-direction:column;height:100vh}
.header{display:flex;align-items:center;justify-content:space-between;padding:10px 24px;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}
.header-left{display:flex;align-items:center;gap:20px}
.header-left h1{font-size:15px;font-weight:600;color:var(--text-bright);letter-spacing:-0.2px}
.badge{font-size:10px;padding:3px 10px;border-radius:12px;background:linear-gradient(135deg,#e8a820,#d09018);color:#1a1400;font-weight:700;text-transform:uppercase;letter-spacing:0.5px;box-shadow:0 1px 4px rgba(208,144,24,0.3)}
.main{display:flex;flex:1;min-height:0}
.footer{padding:8px 24px;border-top:1px solid var(--border);background:var(--surface);font-size:11px;color:var(--text-dim);display:flex;justify-content:space-between;flex-shrink:0}

/* Tabs */
.tabs{display:flex;gap:1px;background:var(--surface2);border-radius:8px;padding:3px}
.tab{padding:5px 18px;border:none;background:none;color:var(--text-dim);font-family:var(--font);font-size:12px;font-weight:500;cursor:pointer;border-radius:6px;transition:all 0.2s ease}
.tab:hover{color:var(--text);background:var(--surface3)}
.tab.active{background:var(--accent);color:#fff;box-shadow:0 1px 4px rgba(124,154,255,0.3)}

/* Left panel */
.panel-left{width:280px;border-right:1px solid var(--border);background:var(--surface);overflow-y:auto;flex-shrink:0;padding:20px 16px}
.panel-left h2{font-size:10px;font-weight:700;color:var(--text-dim);text-transform:uppercase;letter-spacing:1px;margin-bottom:12px}
.info-group{margin-bottom:20px}
.info-row{display:flex;justify-content:space-between;align-items:baseline;padding:5px 0;border-bottom:1px solid rgba(42,48,64,0.5)}
.info-row:last-child{border-bottom:none}
.info-label{color:var(--text-dim);font-size:12px}
.info-value{color:var(--text-bright);font-size:12px;font-weight:500;text-align:right;max-width:160px;word-break:break-all}
.info-value.mono{font-family:var(--mono);font-size:11px}
.check{color:var(--success)}
.cross{color:var(--error)}
.skill-item{padding:8px 10px;background:var(--surface2);border-radius:var(--radius);margin-bottom:6px;border:1px solid var(--border);transition:border-color 0.15s}
.skill-item:hover{border-color:var(--border-light)}
.skill-name{font-weight:600;font-size:12px;color:var(--text-bright)}
.skill-desc{font-size:11px;color:var(--text-dim);margin-top:2px}
.mode-tag{display:inline-block;font-size:10px;padding:2px 8px;background:var(--surface3);border:1px solid var(--border);border-radius:4px;margin:2px;font-family:var(--mono);color:var(--text)}

/* Right panel */
.panel-right{flex:1;display:flex;flex-direction:column;min-width:0;background:var(--bg)}

/* Chat */
.chat-header{padding:12px 24px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;background:var(--surface)}
.chat-header h2{font-size:13px;font-weight:600;color:var(--text-bright)}
.chat-messages{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:16px}
.chat-input-area{padding:16px 24px;border-top:1px solid var(--border);display:flex;gap:10px;align-items:flex-end;background:var(--surface)}
.chat-input-area textarea{flex:1;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;color:var(--text);font-family:var(--font);font-size:14px;resize:none;outline:none;min-height:44px;max-height:120px;transition:border-color 0.2s,box-shadow 0.2s}
.chat-input-area textarea:focus{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-glow)}
.chat-input-area textarea::placeholder{color:var(--text-dim)}
.btn{padding:10px 20px;border:none;border-radius:var(--radius);font-family:var(--font);font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease}
.btn-primary{background:linear-gradient(135deg,var(--accent),var(--accent-dim));color:#fff;box-shadow:0 2px 8px rgba(124,154,255,0.25)}
.btn-primary:hover{box-shadow:0 4px 16px rgba(124,154,255,0.35);transform:translateY(-1px)}
.btn-primary:active{transform:translateY(0)}
.btn-primary:disabled{opacity:0.4;cursor:not-allowed;transform:none;box-shadow:none}
.btn-secondary{background:var(--surface2);color:var(--text);border:1px solid var(--border)}
.btn-secondary:hover{background:var(--surface3);border-color:var(--border-light)}
.btn-cancel{background:linear-gradient(135deg,var(--error),#c04040);color:#fff;box-shadow:0 2px 8px rgba(240,104,104,0.25);padding:10px 20px;border:none;border-radius:var(--radius);font-family:var(--font);font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease}
.btn-cancel:hover{box-shadow:0 4px 16px rgba(240,104,104,0.35);transform:translateY(-1px)}
.btn-cancel:active{transform:translateY(0)}

/* Messages */
.msg{padding:12px 16px;border-radius:var(--radius-lg);max-width:75%;word-wrap:break-word;white-space:pre-wrap;font-size:14px;box-shadow:var(--shadow-sm)}
.msg-user{background:var(--user-bg);align-self:flex-end;color:var(--text-bright);border:1px solid var(--user-border);border-bottom-right-radius:4px}
.msg-agent{background:var(--agent-bg);align-self:flex-start;border:1px solid var(--agent-border);border-bottom-left-radius:4px}
.msg-status{align-self:center;color:var(--text-dim);font-size:12px;font-style:italic;padding:4px 14px;background:var(--surface2);border-radius:20px;border:1px solid var(--border);box-shadow:none}
.msg-error{background:var(--error-bg);border:1px solid rgba(240,104,104,0.3);color:var(--error);align-self:center;padding:10px 16px;border-radius:var(--radius);font-size:13px;box-shadow:none}
.msg-label{font-size:10px;font-weight:700;color:var(--text-dim);margin-bottom:6px;text-transform:uppercase;letter-spacing:0.5px;display:flex;align-items:center;gap:8px}

/* State badges */
.state-badge{display:inline-flex;align-items:center;gap:4px;font-size:9px;padding:2px 8px;border-radius:10px;font-weight:700;text-transform:uppercase;letter-spacing:0.4px;vertical-align:middle}
.state-badge::before{content:'';width:5px;height:5px;border-radius:50%;display:inline-block}
.state-submitted{background:#2a2d3f;color:#7a7d9b}.state-submitted::before{background:#7a7d9b}
.state-working{background:#162a5a;color:#7c9aff;animation:badge-pulse 2s ease-in-out infinite}.state-working::before{background:#7c9aff}
.state-completed{background:#143020;color:var(--success)}.state-completed::before{background:var(--success)}
.state-failed{background:#301414;color:var(--error)}.state-failed::before{background:var(--error)}
.state-canceled{background:#302a14;color:var(--warning)}.state-canceled::before{background:var(--warning)}
.state-rejected{background:#302014;color:var(--orange)}.state-rejected::before{background:var(--orange)}
.state-input-required,.state-auth-required{background:#241430;color:var(--purple)}.state-input-required::before,.state-auth-required::before{background:var(--purple)}
@keyframes badge-pulse{0%,100%{opacity:1}50%{opacity:0.5}}

/* Loading */
.loading{display:flex;align-items:center;gap:8px;color:var(--text-dim);font-size:13px;align-self:flex-start;padding:8px 16px}
.dot-pulse{display:flex;gap:4px}
.dot-pulse span{width:6px;height:6px;background:var(--accent);border-radius:50%;animation:pulse 1.4s ease-in-out infinite;opacity:0.4}
.dot-pulse span:nth-child(2){animation-delay:0.2s}
.dot-pulse span:nth-child(3){animation-delay:0.4s}
@keyframes pulse{0%,80%,100%{opacity:0.3;transform:scale(0.8)}40%{opacity:1;transform:scale(1.1)}}

/* Error banner */
.error-banner{padding:20px;background:var(--error-bg);border:1px solid rgba(240,104,104,0.2);margin:20px;border-radius:var(--radius);text-align:center}
.error-banner p{color:var(--error);margin-bottom:10px}

/* Empty state */
.empty-state{flex:1;display:flex;align-items:center;justify-content:center;color:var(--text-dim);font-size:14px;padding:40px;opacity:0.7}

/* Tasks view */
.tasks-header{padding:12px 24px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;background:var(--surface)}
.tasks-header h2{font-size:13px;font-weight:600;color:var(--text-bright)}
.tasks-status{font-size:11px;color:var(--text-dim);display:flex;align-items:center;gap:6px}
.poll-dot{width:6px;height:6px;border-radius:50%;background:var(--success);display:inline-block;box-shadow:0 0 6px rgba(78,202,96,0.4)}
.poll-dot.stale{background:var(--warning);box-shadow:0 0 6px rgba(240,192,64,0.4)}
.poll-select{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:2px 6px;font-family:var(--font);font-size:11px;cursor:pointer;outline:none;transition:border-color 0.15s}
.poll-select:focus{border-color:var(--accent)}
.tasks-content{flex:1;overflow-y:auto}

.task-table{width:100%;border-collapse:collapse}
.task-table th{padding:8px 20px;text-align:left;font-size:10px;font-weight:700;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.8px;border-bottom:1px solid var(--border);background:var(--surface);position:sticky;top:0;z-index:1}
.task-table td{padding:10px 20px;border-bottom:1px solid rgba(42,48,64,0.5);font-size:13px;vertical-align:middle}
.task-row{cursor:pointer;transition:background 0.15s}
.task-row:hover{background:var(--surface2)}
.task-id{font-family:var(--mono);font-size:12px;color:var(--accent);font-weight:500}
.task-ctx{font-family:var(--mono);font-size:11px;color:var(--text-dim)}
.task-time{font-family:var(--mono);font-size:11px;color:var(--text-dim)}

/* Task detail */
.task-detail{background:var(--surface);border-bottom:2px solid var(--accent);border-left:3px solid var(--accent);padding:20px 24px}
.task-detail-section{margin-bottom:18px}
.task-detail-section:last-child{margin-bottom:0}
.task-detail-section h3{font-size:10px;font-weight:700;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.8px;margin-bottom:10px}
.task-detail-row{display:flex;gap:12px;margin-bottom:5px;font-size:13px}
.task-detail-label{color:var(--text-dim);min-width:70px;font-size:12px}
.task-detail-value{color:var(--text-bright);font-family:var(--mono);font-size:11px;word-break:break-all}
.history-entry{padding:10px 14px;margin-bottom:8px;border-radius:var(--radius);font-size:13px;white-space:pre-wrap;word-break:break-word;border:1px solid transparent}
.history-user{background:var(--user-bg);border-color:var(--user-border)}
.history-agent{background:var(--agent-bg);border-color:var(--agent-border)}
.history-role{font-size:10px;font-weight:700;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:4px}
.artifact-item{padding:10px 14px;background:var(--surface2);border-radius:var(--radius);margin-bottom:8px;border:1px solid var(--border)}
.artifact-id{font-size:10px;color:var(--text-dim);font-family:var(--mono);margin-bottom:6px}
.artifact-text{white-space:pre-wrap;word-break:break-word}
pre.json-block{background:var(--bg);padding:10px;border-radius:6px;font-family:var(--mono);font-size:11px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;margin:4px 0;border:1px solid var(--border)}
.metadata-block{background:var(--bg);padding:10px;border-radius:6px;font-family:var(--mono);font-size:11px;white-space:pre-wrap;word-break:break-word;border:1px solid var(--border)}
/* State transitions timeline */
.transitions-timeline{display:flex;flex-direction:column;gap:0;margin:4px 0 0 2px}
.transition-item{display:flex;gap:10px;min-height:28px}
.transition-dot-col{display:flex;flex-direction:column;align-items:center;width:12px;flex-shrink:0}
.transition-dot{width:8px;height:8px;border-radius:50%;background:var(--accent);flex-shrink:0;margin-top:4px}
.transition-line{width:1px;flex:1;background:var(--border-light);min-height:12px}
.transition-content{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-bottom:6px}
.transition-ts{font-family:var(--mono);font-size:10px;color:var(--text-dim)}
.transition-msg{font-size:11px;color:var(--text);font-style:italic;max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.task-error{padding:14px;background:var(--error-bg);border:1px solid rgba(240,104,104,0.2);border-radius:var(--radius);color:var(--error);font-size:13px}

/* Scrollbar styling */
::-webkit-scrollbar{width:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--border-light)}
