:root {
  --brand: #01c2cb;
  --brand-50: #e6fafb;
  --brand-100: #ccf5f6;
  --brand-500: #10b4b4;
  --brand-700: #018890;
  --brand-800: #006a6a;
  --brand-900: #005151;
  --paper: #f8fafa;
  --line: #e5e7eb;
  --ink-900: #0d1e1e;
  --ink-700: #1f2937;
  --ink-600: #374151;
  --ink-500: #475467;
  --ink-200: #f1f4f4;
  --danger: #ba1a1a;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --sans: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink-900);
  background: #fff;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }

.app { display: flex; min-height: 100vh; background: #fff; }

.side {
  width: 256px;
  flex: none;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.brand strong { font-size: 15px; letter-spacing: -0.02em; }
.brand span { display: block; margin-top: 1px; color: var(--ink-500); font-size: 11px; font-weight: 700; }

.mode {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.mode i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--brand);
  display: block;
}

nav { margin-top: 22px; display: flex; flex-direction: column; gap: 2px; }
nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--ink-700);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  font-size: 15px;
}
nav button svg { flex: none; }
nav button[aria-current="page"] {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 800;
}
nav button:hover { background: var(--paper); }
nav button .count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.who { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
.who strong { display: block; font-size: 14px; }
.who span { color: var(--ink-500); font-size: 12px; }

.main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}
.top h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-500);
}
.menu { display: none; border: 0; background: var(--paper); border-radius: 8px; padding: 8px 10px; font-weight: 800; }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  min-height: 0;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 53px);
  border-right: 1px solid var(--line);
}
.thread {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
}
.msg { max-width: 640px; display: flex; flex-direction: column; gap: 6px; }
.msg.user { align-self: flex-end; }
.msg .who-line { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-500); }
.bubble {
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg.agent .bubble { background: var(--paper); border: 1px solid var(--line); }
.msg.user .bubble { background: var(--brand-800); color: #fff; }
.tool {
  align-self: flex-start;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: var(--brand-50);
  color: var(--brand-900);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}
.tool::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--brand-700); }

.composer {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
  background: #fff;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chips button, .text-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-800);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.chips button:hover, .text-btn:hover { background: var(--brand-50); }
.composer form { display: flex; gap: 8px; }
.composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
}
.composer input:focus { border-color: var(--brand-700); box-shadow: 0 0 0 3px rgba(1, 136, 144, 0.15); }
.composer button[type="submit"] {
  border: 0;
  background: var(--brand-800);
  color: #fff;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 800;
}

.panel { padding: 20px; background: var(--paper); overflow: auto; max-height: calc(100vh - 53px); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
}
.card h2 { margin: 0 0 10px; font-size: 18px; letter-spacing: -0.02em; }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.fact:first-of-type { border-top: 0; }
.fact b { font-weight: 700; }
.fact span { color: var(--ink-700); text-align: right; }
.empty { color: var(--ink-500); font-style: italic; }

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  background: var(--ink-200);
  color: var(--ink-700);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--brand-100); color: var(--brand-900); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-900);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}
.tabs button[aria-selected="true"] { background: var(--brand-800); color: #fff; border-color: var(--brand-800); }
.thinking { display: flex; align-items: center; gap: 8px; color: var(--ink-700); }
.dots { color: var(--brand-700); letter-spacing: 2px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.item { padding: 10px 0; border-top: 1px solid var(--line); }
.item strong { display: block; }
.item p { margin: 4px 0 0; color: var(--ink-600); font-size: 14px; }

.setup { min-height: 100vh; background: var(--paper); }
.setup-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.setup-top img { width: 36px; height: 36px; }
.setup-top strong { display: block; }
.setup-top span { color: var(--ink-500); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.setup-form p { color: var(--ink-600); }
.form-status {
  background: var(--brand-50);
  color: var(--brand-900);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.setup label, .setup-form label { display: block; font-size: 13px; font-weight: 800; margin: 12px 0 6px; }
.setup input, .setup textarea, .setup-form input, .setup-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.setup textarea, .setup-form textarea { min-height: 68px; resize: vertical; }
.checkline { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checkline input { width: auto; }
.check { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.primary {
  border: 0;
  background: var(--brand-800);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
}
.dash { padding: 24px 28px 48px; background: var(--paper); min-height: calc(100vh - 53px); }
.dash-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.dash-head h2 { margin: 0; font-size: 32px; letter-spacing: -0.03em; }
.dash-head p { margin: 6px 0 0; color: var(--ink-500); }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
.stat b { display: block; font-size: 32px; letter-spacing: -0.04em; color: var(--brand-900); }
.stat span { color: var(--ink-500); font-size: 13px; }

@media (max-width: 980px) {
  .side { display: none; position: fixed; z-index: 5; }
  .side.open { display: flex; }
  .menu { display: inline-flex; }
  .setup-grid, .fields, .grid.stats, .grid.two, .dash-head { grid-template-columns: 1fr; display: grid; }
  .workspace { grid-template-columns: 1fr; }
  .chat { min-height: auto; border-right: 0; }
  .panel { max-height: none; }
}
