:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --panel: #0f1629;
  --panel-2: #131c33;
  --border: #1e2a48;
  --border-2: #2a3a63;
  --text: #e6ecff;
  --muted: #8b9bc4;
  --muted-2: #5f6f98;
  --primary: #4f7cff;
  --primary-2: #8b5cf6;
  --accent: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 236px;
  --topbar-h: 60px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: radial-gradient(1400px 700px at 15% -10%, #16224a 0%, var(--bg) 55%); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #223052; border-radius: 8px; }
.hidden { display: none !important; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / span 2; background: linear-gradient(180deg, #0b1124 0%, #080d1b 100%); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px; gap: 10px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 18px; box-shadow: 0 0 24px rgba(139,92,246,.45); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: .04em; }
.brand-text small { color: var(--muted); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.nav a i { width: 18px; text-align: center; font-size: 13px; }
.nav a:hover { background: rgba(79,124,255,.08); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(79,124,255,.35), rgba(139,92,246,.2)); color: #fff; box-shadow: inset 0 0 0 1px rgba(79,124,255,.35); }
.sidebar-project, .plan-card { margin-top: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.sidebar-project { margin-top: auto; }
.plan-card { margin-top: 0; }
.sidebar-project small, .plan-card small { color: var(--muted); font-size: 11px; }
.sidebar-project strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.sp-row b { color: var(--text); font-weight: 600; }
.progress { height: 6px; background: #1a2440; border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 6px; transition: width .4s ease; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--border); background: rgba(7,11,22,.7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar-left small { color: var(--muted); font-size: 11px; }
.select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; min-width: 200px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-size: 13px; border: 1px solid transparent; }
.tabs a.active { background: rgba(79,124,255,.18); color: #fff; border-color: rgba(79,124,255,.4); }
.tabs a:hover { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); display: grid; place-items: center; color: #fff; font-size: 13px; }

.view { grid-column: 2; overflow: auto; padding: 18px 20px 30px; }

/* ---------- Components ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--border-2); background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(79,124,255,.3); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ok { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.4); color: #86efac; }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-warn { background: rgba(245,158,11,.15); border-color: rgba(245,158,11,.4); color: #fcd34d; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(79,124,255,.15); color: #a5b4fc; border: 1px solid rgba(79,124,255,.25); }
.badge-ok { background: rgba(34,197,94,.15); color: #86efac; border-color: rgba(34,197,94,.3); }
.badge-warn { background: rgba(245,158,11,.15); color: #fcd34d; border-color: rgba(245,158,11,.3); }
.badge-danger { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.3); }
.badge-muted { background: rgba(139,155,196,.12); color: var(--muted); border-color: var(--border); }
.badge-purple { background: rgba(139,92,246,.18); color: #c4b5fd; border-color: rgba(139,92,246,.35); }
.badge-pink { background: rgba(236,72,153,.15); color: #f9a8d4; border-color: rgba(236,72,153,.3); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card-head h3 i { color: var(--primary); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.input, .textarea { width: 100%; background: #0b1226; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; }
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,.18); }
.textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.empty i { font-size: 28px; display: block; margin-bottom: 8px; color: var(--muted-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-dot.muted { background: var(--muted-2); box-shadow: none; }
.status-dot.info { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.status-dot.purple { background: var(--primary-2); box-shadow: 0 0 8px var(--primary-2); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.table td { padding: 9px 10px; border-bottom: 1px solid rgba(30,42,72,.6); vertical-align: top; }
table.table tr:hover td { background: rgba(79,124,255,.04); }

/* ---------- Dashboard (Imagem 1) ---------- */
.quick-apps { grid-template-columns: repeat(6, 1fr); }
.quick-app { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: .15s; }
.quick-app:hover, .quick-app.active { border-color: rgba(79,124,255,.5); box-shadow: 0 0 0 1px rgba(79,124,255,.3), var(--shadow); transform: translateY(-1px); }
.quick-app .qa-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 15px; margin-bottom: 10px; }
.quick-app strong { display: block; font-size: 13px; }
.quick-app small { color: var(--muted); font-size: 11px; }
.hero { position: relative; border-radius: 18px; padding: 22px 24px; background: linear-gradient(180deg, rgba(20,28,56,.9), rgba(12,18,38,.95)); border: 1px solid rgba(79,124,255,.35); box-shadow: 0 0 0 1px rgba(139,92,246,.15), 0 20px 60px rgba(79,124,255,.12); }
.hero h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; }
.hero p { margin: 0 0 14px; color: var(--muted); }
.hero textarea { background: transparent; border: none; color: var(--text); font-size: 15px; width: 100%; resize: none; outline: none; min-height: 60px; }
.hero-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hero-tools .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: rgba(15,22,41,.8); color: var(--muted); font-size: 12px; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--border-2); }
.send-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.modes { grid-template-columns: repeat(5, 1fr) 48px; }
.mode { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mode.active { border-color: rgba(79,124,255,.6); box-shadow: 0 0 0 1px rgba(79,124,255,.4), 0 0 24px rgba(79,124,255,.18); }
.mode i { color: var(--primary); }
.mode strong { display: block; font-size: 13px; }
.mode small { color: var(--muted); font-size: 11px; }
.pipeline { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 6px 4px; }
.pipeline .step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; position: relative; }
.pipeline .step::after { content: ''; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.pipeline .step:last-child::after { display: none; }
.pipeline .step .num { z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.pipeline .step.done .num { background: rgba(34,197,94,.2); border-color: var(--ok); color: #86efac; }
.pipeline .step.active .num { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; box-shadow: 0 0 16px rgba(79,124,255,.6); }
.pipeline .step.done::after { background: var(--ok); }
.pipeline .step small { color: var(--muted); font-size: 11px; line-height: 1.2; }
.pipeline .step.active small { color: var(--text); }
.team-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.agent-mini { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.agent-mini .row { gap: 8px; }
.agent-mini .ai { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 12px; flex: none; }
.agent-mini strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-mini small { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-mini .bar { height: 3px; background: #1a2440; border-radius: 3px; overflow: hidden; }
.agent-mini .bar span { display: block; height: 100%; }
.model-list .item, .agent-list .item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid rgba(30,42,72,.6); }
.model-list .item:last-child, .agent-list .item:last-child { border-bottom: none; }
.model-list .logo { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); flex: none; }
.model-list .name { flex: 1; min-width: 0; }
.model-list .name strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-list .name small { color: var(--muted); font-size: 11px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters .chip.active { background: rgba(79,124,255,.2); color: #fff; border-color: rgba(79,124,255,.5); }
.final-answer { border: 1px solid rgba(139,92,246,.4); background: linear-gradient(180deg, rgba(139,92,246,.08), rgba(15,22,41,.9)); }

/* ---------- Project workspace (Imagem 2/3) ---------- */
.workspace { display: grid; grid-template-columns: minmax(380px, 5fr) minmax(420px, 6fr); gap: 14px; height: calc(100vh - var(--topbar-h) - 36px); }
.workspace.single { grid-template-columns: 1fr; }
.col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(19,28,51,.6); }
.panel-head h3 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.panel-head h3 i { color: var(--primary); }
.panel-head .spacer { flex: 1; }
.panel-body { flex: 1; overflow: auto; padding: 12px 14px; min-height: 0; }
.panel-body.nopad { padding: 0; }
.subtabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.subtabs button { border: 1px solid transparent; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.subtabs button.active { background: rgba(79,124,255,.18); color: #fff; border-color: rgba(79,124,255,.4); }
.success-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid rgba(34,197,94,.4); background: linear-gradient(90deg, rgba(34,197,94,.12), rgba(15,22,41,.8)); }
.success-banner .ic { width: 32px; height: 32px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.user-bubble { display: flex; gap: 10px; align-items: flex-start; }
.user-bubble .text { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; flex: 1; }
.agent-rows .arow { display: grid; grid-template-columns: 26px 150px 1fr 120px 90px; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid rgba(30,42,72,.5); font-size: 12px; }
.agent-rows .arow .ai { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 11px; }
.agent-rows .arow .bar { height: 5px; background: #1a2440; border-radius: 5px; overflow: hidden; }
.agent-rows .arow .bar span { display: block; height: 100%; border-radius: 5px; }
.agent-rows .arow .task { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Participants (Sala) */
.participants { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.participant { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.participant.central { border-color: rgba(79,124,255,.6); box-shadow: 0 0 0 1px rgba(79,124,255,.3); }
.participant.supervisor { border-color: rgba(34,197,94,.4); }
.participant .ai { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11px; }
.participant strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant .st { font-size: 10px; display: flex; align-items: center; gap: 4px; }
.participant .gen { position: absolute; top: 6px; right: 6px; font-size: 9px; padding: 1px 5px; border-radius: 6px; background: rgba(139,92,246,.25); color: #c4b5fd; }
.participant .menu { position: absolute; bottom: 6px; right: 6px; opacity: 0; transition: .15s; }
.participant:hover .menu { opacity: 1; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .ai { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 12px; flex: none; margin-top: 2px; }
.msg .body { flex: 1; min-width: 0; }
.msg .meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 3px; flex-wrap: wrap; }
.msg .meta strong { color: var(--text); font-size: 12px; }
.msg .content { white-space: pre-wrap; word-break: break-word; font-size: 13px; color: #d5ddf5; }
.msg.type-OBJECTION .content { border-left: 3px solid var(--danger); padding-left: 10px; }
.msg.type-REVISION .content { border-left: 3px solid var(--warn); padding-left: 10px; }
.msg.type-DECISION .content { border-left: 3px solid var(--primary-2); padding-left: 10px; }
.msg.type-APPROVAL .content { border-left: 3px solid var(--ok); padding-left: 10px; }
.msg.type-PROBLEM .content, .msg.type-WARNING .content { border-left: 3px solid var(--warn); padding-left: 10px; }
.msg.type-USER .body { background: rgba(79,124,255,.12); border: 1px solid rgba(79,124,255,.3); border-radius: 12px; padding: 8px 12px; }
.msg.system .content { color: var(--muted); font-style: italic; }
.tag { font-size: 10px; padding: 1px 7px; border-radius: 6px; font-weight: 700; letter-spacing: .03em; }
.tag-QUESTION { background: rgba(34,211,238,.15); color: #67e8f9; }
.tag-ANSWER { background: rgba(79,124,255,.15); color: #a5b4fc; }
.tag-PROPOSAL { background: rgba(139,92,246,.2); color: #c4b5fd; }
.tag-OBJECTION { background: rgba(239,68,68,.2); color: #fca5a5; }
.tag-REVISION { background: rgba(245,158,11,.2); color: #fcd34d; }
.tag-APPROVAL { background: rgba(34,197,94,.2); color: #86efac; }
.tag-DECISION { background: rgba(139,92,246,.3); color: #e9d5ff; }
.tag-HELP { background: rgba(236,72,153,.2); color: #f9a8d4; }
.tag-WARNING, .tag-PROBLEM { background: rgba(245,158,11,.25); color: #fde68a; }
.tag-RESULT { background: rgba(34,197,94,.15); color: #bbf7d0; }
.tag-USER { background: rgba(79,124,255,.25); color: #dbeafe; }
.tag-DIRECT, .tag-BROADCAST, .tag-TASK, .tag-SYSTEM, .tag-GROUP { background: rgba(139,155,196,.15); color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: rgba(19,28,51,.6); align-items: center; }
.composer input { flex: 1; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; }

/* Preview */
.preview-frame { flex: 1; background: #fff; border: none; width: 100%; min-height: 0; display: block; }
.preview-wrap { flex: 1; display: flex; justify-content: center; background: #05070f; min-height: 0; overflow: auto; }
.preview-wrap.tablet .preview-frame { max-width: 820px; margin: 10px auto; border-radius: 12px; height: calc(100% - 20px); }
.preview-wrap.mobile .preview-frame { max-width: 390px; margin: 10px auto; border-radius: 22px; height: calc(100% - 20px); }
.device-btns { display: flex; gap: 2px; }
.device-btns button { border: 1px solid var(--border); background: transparent; color: var(--muted); width: 30px; height: 28px; border-radius: 7px; cursor: pointer; }
.device-btns button.active { background: rgba(79,124,255,.2); color: #fff; border-color: rgba(79,124,255,.5); }

/* Code editor */
.code-layout { display: grid; grid-template-columns: 220px 1fr; flex: 1; min-height: 0; }
.tree { border-right: 1px solid var(--border); overflow: auto; padding: 8px; font-size: 12px; }
.tree .dir { color: var(--muted); padding: 4px 6px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.tree .file { padding: 4px 6px 4px 22px; cursor: pointer; border-radius: 6px; display: flex; gap: 6px; align-items: center; color: #c7d0ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree .file:hover { background: rgba(79,124,255,.08); }
.tree .file.active { background: rgba(79,124,255,.2); color: #fff; }
.tree .file i { font-size: 10px; color: var(--muted); }
.editor { display: flex; flex-direction: column; min-height: 0; }
.editor-tabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); align-items: center; }
.editor-tabs .etab { padding: 5px 10px; border-radius: 7px; font-size: 12px; color: var(--muted); background: rgba(19,28,51,.7); border: 1px solid var(--border); }
.editor-tabs .etab.active { color: #fff; border-color: rgba(79,124,255,.5); }
.editor-area { flex: 1; display: grid; grid-template-columns: 44px 1fr; min-height: 0; overflow: auto; background: #080c19; }
.gutter { color: var(--muted-2); text-align: right; padding: 10px 6px; font-size: 12px; line-height: 1.55; user-select: none; border-right: 1px solid var(--border); white-space: pre; }
.code { margin: 0; padding: 10px 12px; font-size: 12px; line-height: 1.55; color: #d7def5; white-space: pre; overflow: visible; min-height: 100%; }
.code textarea { width: 100%; height: 100%; min-height: 300px; background: transparent; color: #d7def5; border: none; outline: none; font: inherit; line-height: 1.55; resize: none; white-space: pre; }
.tok-k { color: #c792ea; } .tok-s { color: #c3e88d; } .tok-c { color: #5f6f98; font-style: italic; } .tok-n { color: #f78c6c; } .tok-t { color: #82aaff; } .tok-p { color: #89ddff; } .tok-a { color: #ffcb6b; }
.diff-add { background: rgba(34,197,94,.15); display: block; } .diff-del { background: rgba(239,68,68,.15); display: block; text-decoration: line-through; opacity: .8; }

/* Terminal */
.terminal { background: #05070f; color: #c7d0ea; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; flex: 1; overflow: auto; line-height: 1.5; }
.terminal .ok { color: #86efac; } .terminal .err { color: #fca5a5; } .terminal .cmd { color: #67e8f9; } .terminal .dim { color: var(--muted-2); }
.log-line { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(30,42,72,.4); font-size: 12px; }
.log-line time { color: var(--muted-2); flex: none; font-family: ui-monospace, monospace; }

/* Supervisors */
.sup-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid rgba(34,197,94,.3); }
.sup-card .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #16a34a, #22c55e); }
.sup-card strong { font-size: 12px; display: block; }
.sup-card small { font-size: 11px; color: var(--muted); }

/* Toasts / modal */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; display: flex; gap: 8px; align-items: center; animation: slide .25s ease; max-width: 380px; }
.toast.ok { border-color: rgba(34,197,94,.5); } .toast.err { border-color: rgba(239,68,68,.5); } .toast.warn { border-color: rgba(245,158,11,.5); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 40; backdrop-filter: blur(4px); }
.modal { background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; padding: 20px; width: min(720px, 92vw); max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 12px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.stat-big { font-size: 24px; font-weight: 800; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.kbd { font-family: ui-monospace, monospace; background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; font-size: 11px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .panel { min-height: 420px; }
  .quick-apps { grid-template-columns: repeat(3, 1fr); }
  .modes { grid-template-columns: repeat(3, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar, .view { grid-column: 1; }
  .grid-2, .grid-3, .grid-4, .quick-apps, .modes { grid-template-columns: 1fr; }
  .code-layout { grid-template-columns: 1fr; } .tree { max-height: 160px; border-right: none; border-bottom: 1px solid var(--border); }
  .tabs { display: none; }
}
