:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #0c1823;
  --panel-2: #101f2d;
  --line: #21364a;
  --line-strong: #31506b;
  --text: #eef7ff;
  --muted: #9eb1c1;
  --accent: #3dd8ff;
  --accent-2: #7ee7bd;
  --warning: #f4c96b;
  --danger: #ff7f8d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% -10%, #153b50 0, transparent 38%), var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1600px, calc(100% - 32px)); margin: 0 auto 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 4px 18px; }
.brand { display: flex; gap: 16px; align-items: center; }
.mark { width: 62px; height: 62px; display: grid; place-items: center; border: 1px solid #4dd8ff66; border-radius: 16px; background: linear-gradient(145deg, #12314a, #0b1b28); box-shadow: inset 0 0 22px #3dd8ff18; color: var(--accent); font-weight: 800; letter-spacing: .08em; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: 30px; }
.brand p { margin: 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tabs { display: flex; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: #08131dcc; box-shadow: var(--shadow); overflow-x: auto; }
.tab { border: 0; border-radius: 10px; color: var(--muted); background: transparent; padding: 11px 16px; white-space: nowrap; }
.tab.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, #0d1924f2, #09141df2); box-shadow: var(--shadow); min-height: 620px; padding: 20px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.button { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; color: var(--text); background: var(--panel-2); font-weight: 700; }
.button:hover { border-color: var(--accent); transform: translateY(-1px); }
.button.primary { color: #021016; border-color: #58dcff; background: linear-gradient(135deg, #54dbff, #7ee7bd); }
.button.danger { color: #250409; border-color: #ff8b98; background: #ff7f8d; }
.button.secondary { background: #0d1d2a; }
.button.full { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.chip { display: inline-flex; align-items: center; min-height: 30px; border-radius: 999px; padding: 5px 10px; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 800; }
.chip.neutral { color: var(--muted); }
.chip.good { color: var(--accent-2); border-color: #55d6a766; background: #12352b80; }
.chip.warning { color: var(--warning); border-color: #f4c96b55; background: #3b301480; }
.chip.bad { color: var(--danger); border-color: #ff7f8d66; background: #3c172080; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; min-height: 580px; }
.sidebar-card, .chat-card, .pipeline-editor, .run-detail { border: 1px solid var(--line); border-radius: 14px; background: #0a151f; }
.sidebar-card { padding: 16px; }
.sidebar-card h2 { font-size: 16px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 14px; }
input, textarea, select { width: 100%; color: var(--text); background: #07131c; border: 1px solid var(--line); border-radius: 9px; padding: 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #3dd8ff14; }
textarea { resize: vertical; }
.file-label { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px; }
.file-label input { padding: 6px 0 0; border: 0; background: transparent; }
.chat-card { display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
.messages { padding: 18px; overflow-y: auto; min-height: 430px; max-height: calc(100vh - 310px); }
.message { max-width: 88%; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.message.user { margin-left: auto; background: #123047; border-color: #315f7c; }
.message.assistant { background: #0f1d29; }
.message-head { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #ffffff0d; }
.message-body { padding: 12px 14px; line-height: 1.58; overflow-wrap: anywhere; }
.message-body pre { overflow: auto; background: #061019; border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.message-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.composer { padding: 14px; border-top: 1px solid var(--line); background: #0a1620; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.empty-state { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 180px; color: var(--muted); text-align: center; padding: 24px; }
.empty-state strong { color: var(--text); font-size: 18px; }
.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.section-head h2 { margin-bottom: 4px; }
.section-head p { color: var(--muted); margin-bottom: 0; }
.pipeline-layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 16px; }
.pipeline-list, .run-list { display: grid; gap: 9px; align-content: start; }
.pipeline-item, .run-item { text-align: left; color: var(--text); background: #0b1721; border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.pipeline-item.active, .run-item.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.pipeline-item strong, .run-item strong { display: block; margin-bottom: 5px; }
.pipeline-item span, .run-item span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.pipeline-editor { padding: 18px; }
.pipeline-summary { padding: 14px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 11px; background: #0e1d29; }
.pipeline-summary h3 { margin-bottom: 6px; }
.pipeline-summary p { color: var(--muted); margin-bottom: 10px; }
.step-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.step-pill { color: #bfefff; background: #102a3a; border: 1px solid #285169; border-radius: 999px; padding: 5px 9px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label:has(textarea) { grid-column: 1 / -1; }
.file-label.large { margin-top: 4px; }
.pipeline-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.runs-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; }
.run-list { max-height: 720px; overflow: auto; padding-right: 4px; }
.run-detail { min-height: 500px; padding: 16px; overflow: auto; }
.run-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.run-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.step-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 11px; background: #0d1a25; overflow: hidden; }
.step-card-head { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border-bottom: 1px solid #ffffff0d; }
.step-card-body { padding: 12px; }
.step-card pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; overflow: auto; color: #d6e9f5; font-size: 12px; }
.artifacts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.artifact { color: var(--accent); text-decoration: none; border: 1px solid #3dd8ff44; border-radius: 8px; padding: 6px 8px; font-size: 11px; }
.approval-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.status-card { border: 1px solid var(--line); border-radius: 12px; background: #0b1721; padding: 14px; }
.status-card h4 { margin: 0 0 6px; }
.status-card dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; color: var(--muted); font-size: 12px; }
.status-card dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.model-grid { display: grid; gap: 10px; }
.model-provider { border: 1px solid var(--line); border-radius: 12px; background: #0b1721; padding: 12px; }
.model-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.model-tag { font-family: ui-monospace, monospace; color: #cdefff; font-size: 11px; border: 1px solid #27475e; border-radius: 7px; padding: 4px 7px; background: #0a2130; }
.audit-list { display: grid; gap: 8px; }
.audit-row { display: grid; grid-template-columns: 190px 250px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #0a151f; font-size: 12px; }
.audit-row code { color: var(--accent); }
dialog { color: var(--text); background: transparent; border: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .68); backdrop-filter: blur(3px); }
.dialog-card { width: min(520px, calc(100vw - 36px)); border: 1px solid var(--line-strong); border-radius: 16px; padding: 22px; background: var(--panel); box-shadow: var(--shadow); }
.dialog-card p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 430px; transform: translateY(30px); opacity: 0; pointer-events: none; transition: .2s ease; color: var(--text); background: #122534; border: 1px solid var(--line-strong); border-radius: 11px; padding: 12px 14px; box-shadow: var(--shadow); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: var(--danger); }
@media (max-width: 1000px) {
  .chat-layout, .pipeline-layout, .runs-layout { grid-template-columns: 1fr; }
  .messages { max-height: 600px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-row { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 16px, 1600px); }
  .topbar, .section-head { flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .panel { padding: 12px; }
  .form-grid, .card-grid { grid-template-columns: 1fr; }
  .message { max-width: 100%; }
}
