:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #171b25;
  --border: #232836;
  --text: #e7eaf0;
  --muted: #8b93a7;
  --accent: #f6821f;
  --accent-soft: rgba(246, 130, 31, 0.14);
  --green: #37d39b;
  --amber: #f5b544;
  --red: #ff5c72;
  --blue: #5b9dff;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #161a24 0%, var(--bg) 55%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app { display: flex; flex-direction: column; height: 100vh; max-width: 860px; margin: 0 auto; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #ffab5e); color: #1a1206; font-size: 18px;
  box-shadow: 0 4px 14px rgba(246, 130, 31, 0.35);
}
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.agent-status {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
}
.agent-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.agent-status.working .dot { background: var(--accent); animation: pulse 1.1s infinite; }
.agent-status.done .dot { background: var(--green); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Conversation */
.conversation { flex: 1; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 20px; }
.conversation::-webkit-scrollbar { width: 8px; }
.conversation::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.welcome { margin: auto 0; text-align: center; padding: 20px 0; }
.welcome h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 8px; }
.welcome p { color: var(--muted); max-width: 460px; margin: 0 auto 24px; line-height: 1.5; }
.examples { display: grid; gap: 10px; max-width: 440px; margin: 0 auto; }
.chip {
  text-align: left; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 12px; cursor: pointer; transition: all 0.15s; display: grid; gap: 2px;
}
.chip:hover { border-color: var(--accent); background: var(--panel-2); transform: translateY(-1px); }
.chip-title { font-weight: 600; font-size: 14px; }
.chip-sub { color: var(--muted); font-size: 12px; }

/* Turn */
.turn { display: flex; flex-direction: column; gap: 12px; animation: rise 0.3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.user-msg {
  align-self: flex-end; background: var(--accent); color: #1a1206; font-weight: 500;
  padding: 10px 15px; border-radius: 14px 14px 4px 14px; max-width: 80%; font-size: 14px;
}

/* Agent card */
.agent-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.step { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step-head { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.step-head .ico { width: 16px; height: 16px; }

.spinner { width: 13px; height: 13px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Plan */
.plan-body { margin-top: 10px; }
.plan-target { font-size: 14px; }
.plan-target b { color: var(--accent); }
.plan-reason { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.45; font-style: italic; }

/* Tool grid */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.tool {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
  border-left: 3px solid var(--border); animation: rise 0.25s ease;
}
.tool.status-healthy { border-left-color: var(--green); }
.tool.status-warning { border-left-color: var(--amber); }
.tool.status-critical { border-left-color: var(--red); }
.tool.status-info { border-left-color: var(--blue); }
.tool.pending { opacity: 0.55; }
.tool-name { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; }
.tool-badge { font-size: 10px; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; }
.status-healthy .tool-badge { background: rgba(55, 211, 155, 0.15); color: var(--green); }
.status-warning .tool-badge { background: rgba(245, 181, 68, 0.15); color: var(--amber); }
.status-critical .tool-badge { background: rgba(255, 92, 114, 0.15); color: var(--red); }
.status-info .tool-badge { background: rgba(91, 157, 255, 0.15); color: var(--blue); }
.tool-metric { font-family: var(--mono); font-size: 13px; margin-top: 8px; }
.tool-detail { color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.4; }

/* Summary */
.summary-body { margin-top: 10px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.summary-body .cursor { display: inline-block; width: 7px; height: 15px; background: var(--accent); margin-left: 1px; animation: pulse 1s infinite; vertical-align: text-bottom; }
.confidence { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.confidence.high { background: rgba(55, 211, 155, 0.15); color: var(--green); }
.confidence.medium { background: rgba(245, 181, 68, 0.15); color: var(--amber); }
.confidence.low { background: rgba(139, 147, 167, 0.15); color: var(--muted); }
.err { color: var(--red); font-size: 14px; }

/* Composer */
.composer { padding: 14px 20px 18px; border-top: 1px solid var(--border); }
#form { display: flex; gap: 10px; }
#input {
  flex: 1; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.15s;
}
#input:focus { border-color: var(--accent); }
#send {
  width: 46px; border: none; border-radius: 12px; background: var(--accent); color: #1a1206;
  cursor: pointer; display: grid; place-items: center; transition: opacity 0.15s;
}
#send:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-note { text-align: center; color: var(--muted); font-size: 11px; margin-top: 9px; }
