/* Artemis chat — prototype-local styles built on top of design-system tokens. */

html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--gradient-page);
  background-attachment: fixed;
  overflow: hidden;
}

/* Aurora layer */
.aurora { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.aurora .blob { position: absolute; border-radius: 50%; filter: blur(140px); opacity: 0.22; }
.aurora .b1 { width: 480px; height: 480px; background: #22d3ee; top: -120px; left: -120px; }
.aurora .b2 { width: 520px; height: 520px; background: #a855f7; right: -160px; top: 20%; opacity: 0.18; }
.aurora .b3 { width: 600px; height: 600px; background: #38bdf8; bottom: -240px; left: 35%; opacity: 0.15; }

/* ---------- AUTH SHELL ---------- */
.auth-stage {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  height: 100vh;
}
.auth-card {
  width: 420px;
  padding: 36px 32px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 16px;
}
.auth-card .mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--gradient-kernel);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 28px; color: #0b1224;
  box-shadow: 0 14px 40px -8px rgba(34,211,238,0.7);
}
.auth-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.18em; text-transform: uppercase; }
.auth-card h1 { font-family: var(--font-display); font-size: 30px; margin: 0; letter-spacing: -0.02em; }
.auth-card p  { color: var(--fg-2); font-size: 14px; line-height: 1.5; margin: 0 0 8px; }
.auth-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-sans); font-size: 14px;
  outline: none;
}
.auth-input:focus { border-color: rgba(34,211,238,0.6); box-shadow: 0 0 0 4px rgba(34,211,238,0.18); }
.auth-btn {
  padding: 12px 16px; border-radius: 10px;
  background: var(--gradient-kernel); color: #fff;
  border: 1px solid rgba(34,211,238,0.35); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: filter 200ms;
  box-shadow: var(--shadow-button);
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--fg-3); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.10); }
.sso-btn {
  padding: 11px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.04); color: var(--fg);
  border: 1px solid rgba(255,255,255,0.14);
  font-weight: 500; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 200ms;
}
.sso-btn:hover { background: rgba(255,255,255,0.08); }
.descope-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); letter-spacing: 0.10em; text-transform: uppercase;
}
.descope-chip .pulse { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }

/* ---------- APP LAYOUT ---------- */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}
.topbar {
  grid-column: 1 / -1;
  background: rgba(11,18,36,0.7);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.topbar .brand { display: flex; gap: 10px; align-items: center; }
.topbar .brand .glyph {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--gradient-kernel);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; color: #0b1224; font-size: 16px;
}
.topbar .name {
  font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
}
.topbar .name .city {
  background: var(--gradient-kernel);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar .right { display: flex; gap: 10px; align-items: center; }
.session-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 8px;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.30);
  color: #67e8f9; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 13px;
}
.user-chip .av {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #a855f7);
  display: grid; place-items: center; color: #0b1224; font-weight: 700; font-size: 11px;
}

/* Left sidebar */
.sidebar {
  background: rgba(11,18,36,0.55);
  backdrop-filter: blur(14px);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 18px 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.sidebar h4 {
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-3);
  letter-spacing: 0.16em; text-transform: uppercase; margin: 0 6px 6px;
}
.task-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: linear-gradient(120deg, rgba(245,158,11,0.18), rgba(245,158,11,0.10));
  border: 1px solid rgba(245,158,11,0.40);
  color: #fcd34d;
  font-family: var(--font-sans); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: filter 200ms;
}
.task-btn:hover { filter: brightness(1.08); }
.new-chat {
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  color: var(--fg); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
}
.thread {
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--fg-2);
  cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid transparent;
}
.thread:hover { background: rgba(255,255,255,0.04); color: var(--fg); }
.thread.active { background: rgba(34,211,238,0.08); border-color: rgba(34,211,238,0.30); color: var(--fg); }
.thread .ttl { font-size: 13px; font-weight: 500; }
.thread .meta { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); letter-spacing: 0.04em; }

/* Chat column */
.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}
.chat-head {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; justify-content: space-between; align-items: center;
}
.chat-head .ttl { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin: 0; }
.chat-head .pol {
  display: inline-flex; gap: 8px; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.08em;
}
.chat-head .pol b { color: #67e8f9; font-weight: 500; }
.thread-body { overflow-y: auto; padding: 22px 22px 12px; display: flex; flex-direction: column; gap: 18px; }
.empty-state {
  margin: auto; max-width: 480px; text-align: center; color: var(--fg-2); padding: 40px 12px;
}
.empty-state h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 32px;
  background: var(--gradient-kernel); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 0 0 10px;
}
.empty-state p { line-height: 1.5; margin: 0 0 18px; }
.empty-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty-prompt {
  padding: 12px; text-align: left;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--fg-1); transition: all 200ms;
}
.empty-prompt:hover { border-color: rgba(34,211,238,0.40); background: rgba(34,211,238,0.06); }
.empty-prompt .eye { font-family: var(--font-mono); font-size: 10px; color: var(--accent); letter-spacing: 0.10em; text-transform: uppercase; display: block; margin-bottom: 4px; }

.msg { display: grid; grid-template-columns: 36px 1fr; gap: 12px; max-width: 760px; }
.msg.user { justify-self: end; grid-template-columns: 1fr 36px; }
.msg .av {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: #0b1224; font-weight: 700;
  font-family: var(--font-mono); font-size: 13px;
}
.msg.user .av { order: 2; background: linear-gradient(135deg, #22d3ee, #a855f7); color: #0b1224; }
.msg .bubble {
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
  color: var(--fg-1);
  white-space: pre-wrap;
  position: relative;
}
.msg.user .bubble {
  background: linear-gradient(120deg, rgba(34,211,238,0.18), rgba(168,85,247,0.18));
  border-color: rgba(34,211,238,0.35);
  color: var(--fg);
}
.msg .who {
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 6px;
}
.msg .who b { color: var(--fg-1); margin-right: 6px; font-weight: 600; }
.msg .citation {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10px;
  background: rgba(168,85,247,0.10);
  color: #d8b4fe;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid rgba(168,85,247,0.30);
  margin: 0 2px; cursor: pointer;
}
.typing {
  display: inline-flex; gap: 4px;
}
.typing span {
  width: 5px; height: 5px; border-radius: 50%; background: #22d3ee;
  animation: typing 1s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%,80%,100% { opacity: 0.2; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Composer */
.composer {
  padding: 14px 22px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 10px;
}
.composer-tools {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.agent-pick {
  display: flex; gap: 4px; padding: 3px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9px;
}
.agent-pick button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: transparent; border: none;
  color: var(--fg-2); font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  border-radius: 6px; cursor: pointer;
}
.agent-pick button.on {
  background: rgba(255,255,255,0.10);
  color: var(--fg);
  box-shadow: 0 0 12px -2px rgba(34,211,238,0.35);
}
.agent-dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--fg-2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 200ms;
}
.tool-btn:hover { background: rgba(255,255,255,0.08); color: var(--fg); }
.tool-btn.on { background: rgba(34,211,238,0.10); border-color: rgba(34,211,238,0.40); color: #67e8f9; }

.input-row {
  display: grid; grid-template-columns: 1fr auto;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 4px;
  align-items: end;
}
.input-row textarea {
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  padding: 12px 14px;
  resize: none; min-height: 44px; max-height: 180px;
  width: 100%; box-sizing: border-box;
}
.input-row textarea::placeholder { color: var(--fg-3); }
.send-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--gradient-kernel); color: #fff;
  border: none; border-radius: 10px;
  cursor: pointer; transition: filter 200ms;
  box-shadow: 0 8px 24px -8px rgba(34,211,238,0.6);
}
.send-btn:hover { filter: brightness(1.10); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.send-btn svg { width: 18px; height: 18px; }

/* Right panel */
.right {
  background: rgba(11,18,36,0.55);
  backdrop-filter: blur(14px);
  border-left: 1px solid rgba(255,255,255,0.08);
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}
.right-tabs {
  display: flex; gap: 2px; padding: 12px 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.right-tabs button {
  flex: 1;
  background: transparent; border: none;
  color: var(--fg-3); font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  padding: 8px 10px; border-radius: 8px 8px 0 0; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.right-tabs button.on { color: var(--fg); border-bottom-color: #22d3ee; }
.right-body { overflow-y: auto; padding: 14px; }

/* Agent activity */
.agent-card {
  padding: 12px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.agent-card.active { border-color: rgba(34,211,238,0.40); box-shadow: 0 0 20px -6px rgba(34,211,238,0.4); }
.agent-card.idle { opacity: 0.7; }
.agent-card .row { display: flex; justify-content: space-between; align-items: center; }
.agent-card .name { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; }
.agent-card .pill {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 8px; border-radius: 9999px;
  letter-spacing: 0.06em;
}
.pill.running { background: rgba(34,211,238,0.14); color: #67e8f9; border: 1px solid rgba(34,211,238,0.35); }
.pill.idle    { background: rgba(255,255,255,0.06); color: var(--fg-3); border: 1px solid rgba(255,255,255,0.10); }
.pill.success { background: rgba(34,197,94,0.14); color: #86efac; border: 1px solid rgba(34,197,94,0.35); }
.agent-card .task { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }
.agent-card .bar { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.agent-card .fill { height: 100%; background: linear-gradient(90deg, #22d3ee, #a855f7); }
.agent-card .progress { animation: progress 3s ease-in-out infinite; }
@keyframes progress { 0% { width: 10%; } 50% { width: 80%; } 100% { width: 100%; } }

/* Memory */
.mem-search {
  width: 100%; box-sizing: border-box;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--fg); font-size: 13px;
  margin-bottom: 12px;
}
.mem-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.mem-tabs button {
  padding: 4px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10);
  color: var(--fg-2); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer;
}
.mem-tabs button.on { background: rgba(168,85,247,0.10); border-color: rgba(168,85,247,0.35); color: #d8b4fe; }
.mem-item {
  padding: 8px 10px; margin-bottom: 6px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 12px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; transition: all 150ms;
}
.mem-item:hover { border-color: rgba(168,85,247,0.30); }
.mem-item .src {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
}
.mem-item .ttl { color: var(--fg); font-weight: 500; font-size: 13px; }
.mem-item .snip { color: var(--fg-3); font-size: 11px; line-height: 1.4; }
.src.obsidian { color: #a855f7; }
.src.notion   { color: #67e8f9; }
.src.vector   { color: #fbbf24; }

/* Tools */
.tool-row {
  padding: 10px 12px; margin-bottom: 6px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 12px;
}
.tool-row .left { display: flex; gap: 8px; align-items: center; }
.tool-row .name { font-weight: 500; color: var(--fg); font-size: 13px; }
.tool-row .desc { color: var(--fg-3); font-size: 11px; }
.tool-row .meta { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); letter-spacing: 0.08em; }
.toggle {
  width: 32px; height: 18px; border-radius: 9999px;
  background: rgba(255,255,255,0.10);
  position: relative; cursor: pointer; transition: background 200ms;
  flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--fg-2);
  transition: all 200ms;
}
.toggle.on { background: linear-gradient(120deg, #22d3ee, #a855f7); box-shadow: 0 0 12px -2px rgba(34,211,238,0.5); }
.toggle.on::after { left: 16px; background: #fff; }

/* Task modal */
.modal-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.50); backdrop-filter: blur(8px);
  display: grid; place-items: center;
  animation: fadeIn 200ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 640px; max-height: 80vh; overflow: auto;
  background: rgba(11,18,36,0.92);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(34,211,238,0.30);
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6), 0 0 60px -10px rgba(34,211,238,0.4);
  display: flex; flex-direction: column; gap: 16px;
}
.modal .head { display: flex; justify-content: space-between; align-items: center; }
.modal h2 { font-family: var(--font-display); font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.modal .x {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px; cursor: pointer; color: var(--fg-2);
}
.modal .steps { display: flex; gap: 6px; margin-bottom: 4px; }
.modal .steps .step {
  height: 4px; flex: 1; border-radius: 2px; background: rgba(255,255,255,0.08);
}
.modal .steps .step.done { background: linear-gradient(90deg, #22d3ee, #a855f7); box-shadow: 0 0 8px rgba(34,211,238,0.4); }
.modal label { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.10em; text-transform: uppercase; display: block; margin-bottom: 6px; }
.modal input, .modal textarea, .modal select {
  width: 100%; box-sizing: border-box;
  padding: 11px 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: var(--fg); font-family: var(--font-sans); font-size: 14px;
  outline: none; font-weight: 400;
}
.modal textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.modal input:focus, .modal textarea:focus, .modal select:focus {
  border-color: rgba(34,211,238,0.6); box-shadow: 0 0 0 4px rgba(34,211,238,0.18);
}
.policy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tool-pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tp {
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9999px;
  color: var(--fg-2); font-size: 12px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center;
  transition: all 150ms;
}
.tp.on { background: rgba(34,211,238,0.10); border-color: rgba(34,211,238,0.40); color: #67e8f9; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.modal-foot .ghost {
  padding: 9px 14px; border-radius: 9px;
  background: transparent; color: var(--fg-2); border: 1px solid rgba(255,255,255,0.10);
  font-size: 13px; cursor: pointer;
}
.modal-foot .primary {
  padding: 9px 16px; border-radius: 9px;
  background: var(--gradient-kernel); color: #fff; border: 1px solid rgba(34,211,238,0.35);
  font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-button);
}
.review-card {
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.30);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.review-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 13px; }
.review-row .k { color: var(--fg-3); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.review-row .v { color: var(--fg); }
.review-row .v code {
  font-family: var(--font-mono); font-size: 12px; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px;
}
