/* Original browser styling informed by T3 Code's compact sidebar and chat hierarchy. */
:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --background: #111214;
  --sidebar: #17181b;
  --surface: #191a1e;
  --raised: #202226;
  --border: #2b2d32;
  --text: #eceef0;
  --muted: #9b9ea7;
  --subtle: #777d88;
  --accent: #b9e3ce;
  --accent-ink: #182b22;
  background: var(--background);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 13px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, input, textarea { color: inherit; }
button { border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:hover:not(:disabled) { filter: brightness(1.12); }
h1, h2, h3, p { margin: 0; }
pre, code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); height: 100dvh; }
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 61px; padding: 0 17px; letter-spacing: -.3px; font-size: 14px; font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #52665b; border-radius: 7px; color: var(--accent); font: 600 15px ui-monospace, monospace; }
.brand-secondary { color: var(--muted); font-size: 12px; font-weight: 400; }
.sidebar-content { padding: 22px 12px; flex: 1; overflow-y: auto; min-height: 100px; }
.section-label { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; color: var(--subtle); font-size: 10px; font-weight: 650; letter-spacing: 1.2px; margin-bottom: 12px; }
.section-label > span { letter-spacing: 0; font-size: 11px; }
.sidebar-empty { color: var(--subtle); padding: 0 8px; font-size: 12px; line-height: 1.7; }
.members-label { margin-top: 32px; }
.workspace-link, .agent-link { display: flex; align-items: center; gap: 9px; border-radius: 6px; padding: 9px 10px; }
.workspace-link { background: #26282d; font-weight: 550; }
.workspace-symbol { color: var(--accent); font-family: ui-monospace, monospace; }
.agent-link { margin: 3px 0 3px 12px; color: var(--muted); font-size: 12px; }
.agent-link:hover { background: var(--raised); color: var(--text); }
.agent-link .status-dot { width: 6px; height: 6px; }
.nav-caption { margin-left: auto; color: var(--subtle); font-size: 10px; }
.member-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.member-row .avatar { width: 26px; height: 26px; font-size: 10px; }
.member-name { text-transform: capitalize; }
.member-you { margin-left: auto; color: var(--subtle); font-size: 10px; }
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: #30353c; color: #d5dae3; font-size: 11px; font-weight: 600; }
.avatar[data-color="1"] { background: #303a36; color: #c4dfcf; }
.avatar[data-color="2"] { background: #393342; color: #d9cce7; }
.avatar[data-color="3"] { background: #3d3730; color: #e3d2bd; }
.session-panel { border-top: 1px solid var(--border); padding: 16px; }
.session-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.session-heading strong { font-size: 12px; font-weight: 550; text-transform: capitalize; }
.session-caption { display: block; color: var(--subtle); font-size: 11px; margin-top: 1px; }
label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.token-control { display: flex; border: 1px solid #383b43; border-radius: 6px; background: var(--background); }
.token-control input { width: 100%; min-width: 0; padding: 8px; border: 0; background: transparent; font-size: 11px; outline-offset: 1px; }
.connect-button { background: #2c3037; border-radius: 0 5px 5px 0; padding: 0 9px; font-size: 10px; font-weight: 600; }
.preview-help { margin-top: 12px; color: var(--muted); font-size: 11px; }
.preview-help summary { font-size: 11px; }
.preview-help p { margin-top: 8px; line-height: 1.8; }
.preview-help code { font-size: 10px; color: #c5cbd4; }
.privacy-note { margin-top: 10px; color: var(--subtle); font-size: 10px; }
.main-shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 61px; padding: 0 26px; border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; gap: 12px; align-items: center; min-width: 0; color: var(--subtle); font-size: 12px; }
.breadcrumb strong { color: #cdd0d6; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.environment-badge { border: 1px solid #34383d; padding: 3px 8px; border-radius: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.connection-strip { display: flex; align-items: center; gap: 8px; padding: 10px 27px; color: var(--muted); font-size: 11px; min-height: 37px; }
.status-dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #727986; }
.connection-strip[data-state="connected"] .status-dot, .status-badge[data-state="idle"] .status-dot, .agent-link[data-state="idle"] .status-dot { background: #a6d5ba; }
.status-badge[data-state="busy"] .status-dot, .agent-link[data-state="busy"] .status-dot { background: #dfbd7b; }
.status-badge[data-state="reconnecting"] .status-dot { background: #dc9c88; }
.main-content { overflow-y: auto; min-height: 0; flex: 1; padding: 12px 26px 24px; }
.welcome { max-width: 620px; margin: clamp(50px, 14vh, 160px) auto 60px; text-align: center; }
.welcome-mark { display: inline-grid; place-items: center; width: 58px; height: 58px; border: 1px solid #3c4641; background: #202823; border-radius: 16px; color: var(--accent); font: 23px ui-monospace, monospace; margin-bottom: 25px; }
.eyebrow { display: block; color: var(--subtle); font-size: 10px; font-weight: 600; letter-spacing: 1.8px; }
.welcome h1 { margin: 15px 0 20px; font-size: clamp(30px, 3vw, 42px); line-height: 1.2; font-weight: 550; letter-spacing: -1.6px; }
.welcome > p { color: var(--muted); font-size: 14px; line-height: 1.85; max-width: 420px; margin: auto auto 24px; }
.primary-button { background: var(--accent); color: var(--accent-ink); padding: 10px 15px; border-radius: 7px; font-weight: 600; font-size: 12px; }
.primary-button > span { margin-left: 12px; }
.welcome-features { display: flex; gap: 18px; justify-content: center; margin-top: 33px; color: var(--subtle); font-size: 10px; flex-wrap: wrap; }
.welcome-features span + span::before { content: "/"; margin-right: 18px; color: #41464f; }
.workspace-section { margin-bottom: 24px; }
.workspace-overview { margin-bottom: 18px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.workspace-heading h1 { font-size: 21px; font-weight: 550; letter-spacing: -.6px; }
.workspace-heading .eyebrow { font-size: 9px; letter-spacing: 1.2px; margin-bottom: 4px; }
.workspace-description { color: var(--muted); font-size: 12px; margin-top: 6px; }
.member-avatars { display: flex; padding-left: 5px; flex-shrink: 0; }
.member-avatars .avatar { border: 3px solid var(--background); width: 32px; height: 32px; margin-left: -5px; }
.coordination-details { margin-top: 12px; }
.coordination-details summary { color: var(--muted); font-size: 11px; width: fit-content; }
.coordination-details[open] summary { margin-bottom: 12px; }
.coordination-copy { font-size: 11px; color: var(--muted); max-width: 800px; margin-bottom: 12px; }
.matrix-scroll { overflow-x: auto; }
table { border-collapse: collapse; font-size: 11px; min-width: 460px; width: 100%; max-width: 850px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 500; }
td { color: #c7cdd4; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.agent-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; min-width: 0; height: max(540px, calc(100dvh - 238px)); max-height: 1000px; overflow: hidden; scroll-margin-top: 12px; }
.agent-header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.agent-glyph { display: grid; place-items: center; background: #29332d; color: var(--accent); border: 1px solid #3c4c42; width: 32px; height: 32px; border-radius: 8px; font: 12px ui-monospace, monospace; }
.agent-panel[data-kind="external"] .agent-glyph { background: #2a2b35; color: #c0bfdc; border-color: #40404d; }
.agent-heading { flex: 1; min-width: 0; }
.agent-heading h2 { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.agent-heading p { color: var(--subtle); font-size: 10px; margin-top: 1px; }
.status-badge { display: flex; gap: 6px; align-items: center; font-size: 10px; color: var(--muted); white-space: nowrap; }
.transcript { flex: 1; overflow-y: auto; min-height: 130px; padding: 18px; scrollbar-width: thin; scrollbar-color: #3f444c transparent; }
.conversation-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; height: 100%; min-height: 145px; }
.conversation-empty .agent-glyph { border-style: dashed; background: transparent; margin-bottom: 14px; opacity: .7; }
.conversation-empty h3 { font-size: 13px; font-weight: 500; margin-bottom: 7px; }
.conversation-empty p { font-size: 11px; color: var(--subtle); line-height: 1.8; max-width: 260px; }
.message { margin-bottom: 20px; }
.message:last-child { margin-bottom: 0; }
.message-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; font-size: 11px; font-weight: 550; }
.message-heading .avatar { width: 20px; height: 20px; font-size: 8px; }
.message-role { color: var(--subtle); font-weight: 400; margin-left: auto; font-size: 9px; }
.message-body { font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.message[data-role="user"] .message-body { background: #24262b; border: 1px solid #30323a; padding: 11px 13px; border-radius: 2px 8px 8px 8px; }
.message[data-role="assistant"] .message-body { padding: 0 0 0 1px; color: #cdd2da; }
.message[data-role="assistant"] .avatar { border-radius: 5px; background: #303b34; color: var(--accent); }
.progress { margin: 0 18px 12px; padding: 10px 12px; background: #1d2521; border-left: 2px solid #7d9b87; border-radius: 0 4px 4px 0; max-height: 120px; overflow-y: auto; }
.progress-label { color: #a8c1b1; font-size: 9px; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 5px; }
.progress pre { color: #b7c2ba; font-size: 11px; line-height: 1.65; }
.command-activity { margin: 0 18px 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.command-activity summary { color: var(--muted); font-size: 10px; }
.command-list { max-height: 95px; overflow-y: auto; padding-top: 8px; }
.command-empty { color: var(--subtle); font-size: 10px; }
.command-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 10px; }
.command-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.command-author code { font-size: 9px; color: var(--subtle); margin-left: 7px; }
.command-state { color: var(--muted); font-size: 9px; border: 1px solid #373b43; padding: 1px 6px; border-radius: 4px; }
.command-row[data-status="completed"] .command-state { color: #b0cbb9; border-color: #3b4c41; }
.command-row[data-status="running"] .command-state { color: #dec594; border-color: #5e5036; }
.command-row[data-status="failed"] .command-state, .command-row[data-status="interrupted"] .command-state { color: #e4b2a7; border-color: #64453f; }
.command-reason { grid-column: 1 / -1; color: #caaca4; font-size: 10px; overflow-wrap: anywhere; }
.composer-area { padding: 0 14px 12px; }
.composer { background: #222429; border: 1px solid #3a3d45; border-radius: 9px; overflow: hidden; }
.composer:focus-within { border-color: #758b7e; }
.composer textarea { resize: vertical; width: 100%; min-height: 78px; max-height: 220px; background: transparent; border: 0; outline: none; padding: 12px; font-size: 12px; line-height: 1.7; display: block; }
.composer textarea::placeholder { color: #7f8490; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 8px 12px; }
.composer-caption { color: var(--subtle); font-size: 9px; }
.composer .primary-button { padding: 5px 11px; font-size: 10px; border-radius: 5px; }
.lane-actions { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 7px; }
.subtle-button { background: transparent; color: var(--muted); padding: 4px 5px; font-size: 10px; border-radius: 4px; }
.subtle-button:hover:not(:disabled) { background: #292c32; color: var(--text); }
.stop-button { color: #caa19a; }
.feedback { color: var(--muted); font-size: 10px; line-height: 1.6; margin: 5px 4px 0; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback[data-tone="error"] { color: #dfafa2; }
.sidebar-toggle { display: none; }
.workspace-files { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 16px; padding: 12px 14px; }
.workspace-files summary { color: var(--text); font-size: 12px; font-weight: 550; }
.file-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.file-toolbar code { color: var(--accent); overflow-wrap: anywhere; min-width: 0; }
.file-layout { display: grid; grid-template-columns: minmax(130px, 24%) minmax(0, 1fr); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.file-list { overflow: auto; max-height: 320px; min-height: 120px; padding: 6px; border-right: 1px solid var(--border); }
.file-entry { display: block; width: 100%; text-align: left; background: transparent; padding: 6px 8px; border-radius: 4px; color: var(--muted); font: 11px ui-monospace, monospace; overflow-wrap: anywhere; }
.file-entry:hover { background: var(--raised); color: var(--text); }
.file-viewer { min-width: 0; }
.file-title { padding: 8px 12px; color: var(--muted); border-bottom: 1px solid var(--border); font-size: 10px; overflow-wrap: anywhere; }
.file-viewer pre { padding: 12px; max-height: 320px; overflow: auto; font-size: 11px; line-height: 1.7; }
.conflict-panel { border: 1px solid #52665b; background: var(--surface); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.conflict-panel > summary { font-size: 13px; font-weight: 600; color: var(--accent); }
.conflict-panel > .workspace-description { max-width: 950px; line-height: 1.8; }
.conflict-steps { padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.conflict-comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; margin: 12px 0; }
.conflict-card { min-width: 0; border: 1px solid var(--border); border-radius: 6px; padding: 12px; background: var(--background); }
.conflict-card h3 { color: var(--muted); font-size: 11px; font-weight: 500; margin-bottom: 8px; overflow-wrap: anywhere; }
.conflict-card pre { font-size: 12px; max-height: 160px; overflow: auto; }
.conflict-card[data-status="conflict"] { border-color: #9c7845; }
.conflict-card[data-status="applied"] { border-color: #52665b; }
.resolution-controls { margin: 12px 0; }
.resolution-input { display: block; width: 100%; min-height: 85px; max-height: 240px; resize: vertical; margin: 8px 0; padding: 10px; background: var(--background); border: 1px solid var(--border); border-radius: 6px; font: 12px ui-monospace, monospace; }
.activity-timeline { max-height: 130px; overflow: auto; padding-left: 17px; color: var(--muted); font-size: 10px; line-height: 1.8; margin: 9px 0 0; }
.activity-timeline li { overflow-wrap: anywhere; }
.activity-timeline [data-status="failed"], .activity-timeline [data-status="interrupted"] { color: #e4b2a7; }
.activity-note { font-size: 9px; color: var(--subtle); line-height: 1.6; margin-top: 6px; }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .brand { padding-inline: 12px; gap: 7px; }
  .brand-secondary { font-size: 10px; }
  .main-content { padding-inline: 16px; }
  .topbar { padding-inline: 18px; }
  .connection-strip { padding-inline: 19px; }
  .agent-grid { grid-template-columns: minmax(0,1fr); }
  .agent-panel { height: 650px; }
}
@media (max-width: 700px) {
  .file-layout { grid-template-columns: minmax(0, 1fr); }
  .file-list { max-height: 150px; border-right: 0; border-bottom: 1px solid var(--border); }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; z-index: 20; visibility: hidden; transform: translateX(-100%); }
  body.sidebar-open .sidebar { visibility: visible; transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 19; background: #0009; border: 0; }
  .sidebar-toggle { display: block; font-size: 11px; padding: 6px 8px; border: 1px solid var(--border); }
  .breadcrumb { display: none; }
  .topbar { min-height: 55px; padding-inline: 16px; }
  .connection-strip { padding: 10px 17px; line-height: 1.7; }
  .workspace-heading h1 { font-size: 19px; }
  .workspace-description { font-size: 11px; }
  .agent-panel { height: 650px; min-height: 500px; }
  .main-content { padding-inline: 12px; }
  .welcome { margin-top: 80px; }
  .welcome > p { padding-inline: 16px; font-size: 13px; }
  .welcome-features { gap: 10px; }
  .welcome-features span + span::before { margin-right: 10px; }
  .composer textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
