:root {
  color-scheme: dark;
  --bg: #0a0d14;
  --panel: #111722;
  --panel-2: #151d2b;
  --line: #263244;
  --line-soft: #1d2635;
  --text: #edf3ff;
  --muted: #91a0b8;
  --muted-2: #66758c;
  --ok: #48d597;
  --warn: #f8bd4d;
  --bad: #ff6b7f;
  --info: #72a7ff;
  --accent: #6fd3c5;
  --shadow: 0 14px 44px rgba(0, 0, 0, .24);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, .link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #182131;
  color: var(--text);
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
}
button:hover, .link-button:hover { background: #202c40; }
button.primary { background: #23675f; border-color: #2c8176; }
button.danger { background: #3a1822; border-color: #69303b; color: #ffd6dc; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1320;
  color: var(--text);
  min-height: 36px;
  padding: 8px 10px;
}
a { color: #9cc3ff; }
.app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); background: #0d121b; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; gap: 12px; align-items: center; }
.mark { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #6fd3c5, #72a7ff); }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: 0; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #0a0d14; }
.login-panel { width: min(420px, 100%); display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.login-panel label { display: grid; gap: 6px; color: var(--muted); }
.login-panel .brand { margin-bottom: 4px; }
.login-error { border: 1px solid #6b2c38; background: #2a1118; color: #ffd6dc; border-radius: 8px; padding: 9px 10px; }
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 0; }
.sidebar { border-right: 1px solid var(--line-soft); padding: 16px; background: #0d121b; }
.main { padding: 18px; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; }
.section-title h2, .section-title h3 { margin: 0; font-size: 15px; }
.nav { display: grid; gap: 6px; margin-bottom: 14px; }
.nav-item { width: 100%; text-align: left; background: transparent; border-color: transparent; color: var(--muted); }
.nav-item:hover { color: var(--text); background: #141d2b; }
.nav-item.active { color: var(--text); background: #1d2a3e; border-color: #334761; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat, .panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: var(--shadow); }
.stat { padding: 12px; }
.stat .value { font-size: 24px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; }
.panel { padding: 14px; margin-bottom: 14px; }
.panel.compact { box-shadow: none; }
.form-grid { display: grid; gap: 9px; }
.create-grid { display: grid; grid-template-columns: 1fr 160px auto; gap: 9px; align-items: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.page-head h2 { margin: 0 0 4px; font-size: 22px; }
.page-head p { margin: 0; }
.side-metric { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.side-metric b { color: var(--text); }
.side-metric span { color: var(--muted); }
.side-poc { border-top: 1px solid var(--line-soft); margin-top: 10px; padding-top: 10px; display: grid; gap: 6px; }
.context-card { min-width: 190px; display: grid; gap: 6px; justify-items: start; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
.workflows { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.workflow { min-height: 92px; text-align: left; padding: 12px; display: grid; align-content: start; gap: 8px; background: var(--panel); }
.workflow b { font-size: 14px; }
.workflow span { color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .65fr); gap: 14px; align-items: start; }
.inspector { margin-top: 14px; }
.subpanel { border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 14px; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 110px auto auto auto; gap: 8px; align-items: center; }
.log-output { max-height: 64vh; }
.session-workbench { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 14px; align-items: start; }
.activity { border-bottom: 1px solid var(--line-soft); padding: 9px 0; display: grid; gap: 3px; }
.activity b { color: var(--text); }
.activity span { color: var(--muted); }
.activity small { color: var(--muted-2); }
.runbook { display: grid; gap: 8px; }
.runbook button { text-align: left; background: #101724; }
.account-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.poc-table { width: 100%; border-collapse: collapse; }
.poc-table th, .poc-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.poc-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.poc-row { cursor: pointer; }
.poc-row:hover, .poc-row.selected { background: #141d2b; }
.name-cell b { display: block; margin-bottom: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 8px; background: #1d293d; border: 1px solid var(--line); font-size: 12px; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.info { color: var(--info); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.tab.active { background: #21334b; border-color: #365171; }
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.detail-head h2 { margin: 0; font-size: 18px; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 7px 10px; font-size: 12px; }
.kv div:nth-child(odd) { color: var(--muted); }
.qr-frame { display: grid; place-items: center; min-height: 310px; border: 1px dashed var(--line); border-radius: 8px; background: #0b1019; padding: 12px; text-align: center; }
.qr-frame img { width: 260px; height: 260px; padding: 8px; border-radius: 8px; background: white; }
.countdown { height: 8px; border-radius: 999px; background: #273246; overflow: hidden; margin: 10px 0; }
.countdown span { display: block; height: 100%; background: var(--accent); width: 0%; transition: width .4s linear; }
pre { white-space: pre-wrap; word-break: break-word; background: #070b11; border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; max-height: 52vh; overflow: auto; margin: 0; }
.job-list { display: grid; gap: 8px; }
.job { border: 1px solid var(--line-soft); background: var(--panel-2); border-radius: 8px; padding: 10px; }
.job-head { display: flex; justify-content: space-between; gap: 8px; }
.steps { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.session-list { display: grid; gap: 8px; max-height: 38vh; overflow: auto; }
.session { border: 1px solid var(--line-soft); background: #101724; border-radius: 8px; padding: 10px; cursor: pointer; }
.session:hover { border-color: #38516e; }
.session.selected { border-color: #6fd3c5; background: #132032; }
.session-messages { display: grid; gap: 10px; max-height: 62vh; overflow: auto; align-content: start; }
.message { border: 1px solid var(--line-soft); background: #0b1019; border-radius: 8px; padding: 0; overflow: hidden; }
.message.user { border-color: #3f5f92; background: #0d1422; }
.message.assistant { border-color: #2d665d; background: #0b1518; }
.message.tool { border-color: #5b4f2b; background: #151309; }
.message.system { border-color: #4b5264; background: #10131a; }
.message-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 11px; border-bottom: 1px solid var(--line-soft); background: rgba(255, 255, 255, .025); }
.message-head time { color: var(--muted-2); font-size: 12px; }
.role-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.role-badge.user { color: #b8d0ff; background: #172642; }
.role-badge.assistant { color: #a7eadf; background: #12322e; }
.role-badge.tool { color: #ffe1a3; background: #34290f; }
.role-badge.system { color: #c6cfdf; background: #252b37; }
.message-body { display: grid; gap: 9px; padding: 11px; min-width: 0; }
.message-part { min-width: 0; }
.message-part.text p { margin: 0 0 8px; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.message-part.text p:last-child { margin-bottom: 0; }
.message-part.user-text { font-size: 14px; }
.part-label { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tool-call, .tool-result, .structured { border-left: 3px solid var(--line); padding-left: 9px; }
.tool-call { border-left-color: var(--info); }
.tool-result { border-left-color: var(--warn); }
.structured { border-left-color: var(--muted-2); }
.message-code { max-height: none; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 12px; line-height: 1.5; background: #070b11; }
.message-code.json { color: #dbe7ff; }
.message-code.terminal { color: #d4f7dc; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-card { border: 1px solid var(--line-soft); background: var(--panel-2); border-radius: 8px; padding: 12px; display: grid; gap: 9px; min-width: 0; }
.metric-card.ok { border-color: rgba(72, 213, 151, .28); }
.metric-card.warn { border-color: rgba(248, 189, 77, .45); }
.metric-card.bad { border-color: rgba(255, 107, 127, .55); background: #1b1118; }
.metric-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.metric-top span { color: var(--muted); font-size: 12px; }
.metric-top b { font-size: 22px; }
.meter { height: 8px; border-radius: 999px; overflow: hidden; background: #273246; }
.meter span { display: block; height: 100%; background: var(--ok); }
.metric-card.warn .meter span { background: var(--warn); }
.metric-card.bad .meter span { background: var(--bad); }
.monitor-hero { display: grid; gap: 12px; }
.live-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.live-title { display: flex; gap: 8px; align-items: center; }
.live-title h2 { margin: 0; font-size: 16px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(248, 189, 77, .12); }
.live-dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(72, 213, 151, .14); }
.live-dot.off { background: var(--bad); box-shadow: 0 0 0 4px rgba(255, 107, 127, .12); }
.empty-state { min-height: 110px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); background: #0b1019; }
.monitor-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 14px; align-items: start; }
.monitor-layout.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.monitor-section { overflow: hidden; }
.monitor-stack, .monitor-list { display: grid; gap: 8px; }
.resource-row { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(140px, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px; background: #0d1420; }
.resource-main { display: grid; gap: 2px; min-width: 0; }
.resource-main span, .resource-meter small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.resource-meter { display: grid; gap: 5px; min-width: 0; }
.monitor-item { border: 1px solid var(--line-soft); background: #0d1420; border-radius: 8px; overflow: hidden; }
.monitor-item summary, .alert-item summary, .netdata-panel summary { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 10px; cursor: pointer; list-style: none; min-width: 0; }
.monitor-item summary::-webkit-details-marker, .alert-item summary::-webkit-details-marker, .netdata-panel summary::-webkit-details-marker { display: none; }
.monitor-item summary::before, .alert-item summary::before, .netdata-panel summary::before { content: "›"; color: var(--muted); transition: transform .15s ease; flex: 0 0 auto; }
.monitor-item[open] summary::before, .alert-item[open] summary::before, .netdata-panel[open] summary::before { transform: rotate(90deg); }
.item-name { display: grid; gap: 2px; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.item-name small, .alert-item summary small, .netdata-panel summary small { color: var(--muted); font-weight: 400; font-size: 12px; display: block; margin-top: 2px; }
.item-metrics { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item-detail { border-top: 1px solid var(--line-soft); padding: 9px 10px; color: var(--muted); font-size: 12px; display: grid; gap: 5px; overflow-wrap: anywhere; }
.item-detail.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.netdata-panel { border: 1px solid var(--line-soft); background: #0d1420; border-radius: 8px; overflow: hidden; }
.netdata-frame { width: 100%; height: min(76vh, 820px); border: 0; border-top: 1px solid var(--line-soft); background: #05070b; display: block; }
.netdata-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.netdata-card { border: 1px solid var(--line-soft); background: #0d1420; border-radius: 8px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.sparkline { display: flex; align-items: end; gap: 2px; height: 48px; padding: 5px; border-radius: 6px; background: #080d14; border: 1px solid var(--line-soft); }
.sparkline i { flex: 1; min-width: 2px; background: var(--accent); border-radius: 999px 999px 0 0; opacity: .9; }
.compact-grid h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.monitor-table { width: 100%; border-collapse: collapse; }
.monitor-table th, .monitor-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.monitor-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.monitor-table td { min-width: 0; }
.monitor-table .strong .pill { border-color: #527aa8; }
.alert-log { display: grid; gap: 8px; }
.alert-item { border: 1px solid var(--line-soft); background: #101724; border-radius: 8px; padding: 10px; display: grid; gap: 6px; }
.alert-item { padding: 0; overflow: hidden; }
.alert-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.alert-head span { color: var(--muted-2); font-size: 12px; }
.cause-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cause-list span { border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 8px; color: var(--muted); font-size: 12px; background: #0b1019; }
.alert-item > .muted, .alert-item > .cause-list { margin: 0 10px 10px; }
.pill.strong { border-color: #527aa8; background: #18263a; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 520px; background: #111722; border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: var(--shadow); z-index: 20; }
.hidden { display: none !important; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-grid { grid-template-columns: 1fr; }
  .workflows, .two-col, .session-workbench, .metric-grid, .monitor-layout, .monitor-layout.equal, .resource-row { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .live-toolbar { display: grid; }
  .item-metrics { justify-content: flex-start; }
  .page-head { display: grid; }
}
