:root {
  --bg: #08080d;
  --surface: #0f0f16;
  --surface2: #16161f;
  --surface3: #1e1e28;
  --border: #252532;
  --border2: #30303f;
  --text: #d8d8f0;
  --text-muted: #606078;
  --text-dim: #555568;
  --accent: #00d4ff;
  --accent2: #6366f1;
  --green: #00e87a;
  --yellow: #ffc700;
  --red: #ff3d5a;
  --orange: #ff6b35;
  --purple: #c084fc;
  --pink: #f472b6;
  --user-bubble: #12213a;
  --agent-bubble: #0f0f16;
  --error: #ff3d5a;
  --success: #00e87a;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --topbar-h: 50px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  height: 100dvh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ── Auth screen ── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 30%, #0d1a2a 0%, var(--bg) 70%);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 0 60px rgba(0, 212, 255, 0.05);
}

.auth-logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--accent);
  text-align: center;
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.auth-tagline {
  color: var(--text-dim);
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: -0.4rem;
}

.auth-card input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-card input::placeholder { color: var(--text-dim); }

.btn-primary {
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  width: 100%;
}
.btn-primary:hover { background: #818cf8; box-shadow: 0 0 20px rgba(99,102,241,0.3); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.full-width { width: 100%; }

.auth-switch { color: var(--text-dim); font-size: 0.82rem; text-align: center; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-error { color: var(--error); font-size: 0.82rem; text-align: center; }

/* ── App shell ── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
  white-space: nowrap;
}

.badge-web {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--accent2);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
}

.tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface2); }
.tab.active { color: var(--accent); background: rgba(0, 212, 255, 0.08); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.clock {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  min-width: 60px;
  text-align: right;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  width: 32px; height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.recording { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }

.user-email-top {
  font-size: 0.75rem;
  color: var(--text-dim);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-btn {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 0.78rem; cursor: pointer;
  white-space: nowrap;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-xs);
  transition: color 0.15s;
}
.text-btn:hover { color: var(--text); }

/* ── Tab content ── */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}
.tab-content.active { display: flex; flex-direction: column; }

/* Scrollable tab content */
#tab-dashboard.active,
#tab-tasks.active,
#tab-memories.active {
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  gap: 1.25rem;
}

/* custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  flex-shrink: 0;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Section ── */
.section { display: flex; flex-direction: column; gap: 0.75rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brain-icon { font-size: 0.9rem; }

/* ── Agents grid ── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color 0.2s;
  cursor: default;
}
.agent-card:hover { border-color: var(--border2); }
.agent-card.running { border-color: rgba(0, 232, 122, 0.3); }

.agent-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agent-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.agent-status-dot.running {
  background: var(--green);
  box-shadow: 0 0 6px rgba(0, 232, 122, 0.7);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agent-badge-live {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 232, 122, 0.15);
  color: var(--green);
  border: 1px solid rgba(0, 232, 122, 0.3);
}

.agent-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.agent-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.agent-stat-val {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
}

.agent-stat-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-model {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Hive Mind table ── */
.hive-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.hive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.hive-table th {
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.hive-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}

.hive-table tr:last-child td { border-bottom: none; }
.hive-table tr:hover td { background: var(--surface2); }

.hive-table td:first-child { font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }

.hive-action {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
}
.hive-action.tool    { background: rgba(99, 102, 241, 0.15); color: var(--accent2); }
.hive-action.message { background: rgba(0, 212, 255, 0.1); color: var(--accent); }
.hive-action.memory  { background: rgba(255, 199, 0, 0.1); color: var(--yellow); }
.hive-action.error   { background: rgba(255, 61, 90, 0.1); color: var(--red); }
.hive-action.default { background: var(--surface3); color: var(--text-muted); }

.empty-row { text-align: center; color: var(--text-dim); padding: 2rem !important; font-style: italic; }

/* blur toggle */
.blur-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.blur-toggle input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent2); }
.blur-toggle span { color: var(--text-dim); }

.blurred td:last-child { filter: blur(5px); transition: filter 0.2s; }
.blurred td:last-child:hover { filter: blur(0); }

/* ── Chat tab ── */
#tab-chat.active {
  flex-direction: row;
  overflow: hidden;
}

.chat-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.chat-sidebar-section { display: flex; flex-direction: column; gap: 0.4rem; }

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  width: 100%;
}
.select:focus { border-color: var(--accent); }

.toggle { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; width: fit-content; }
.toggle input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent2); border-color: var(--accent2); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); background: #fff; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 76%;
  gap: 0.2rem;
}
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.agent { align-self: flex-start; align-items: flex-start; }
.msg.system { align-self: center; align-items: center; max-width: 90%; }

.msg-role {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.msg-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  line-height: 1.65;
  word-break: break-word;
  font-size: 0.9rem;
}
.msg.user .msg-bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-bottom-right-radius: var(--radius-xs);
}
.msg.agent .msg-bubble {
  background: var(--agent-bubble);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-xs);
}
.msg.system .msg-bubble {
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-style: italic;
  border: none;
  padding: 0.15rem 0.4rem;
}

/* markdown inside bubble */
.msg-bubble p { margin-bottom: 0.45rem; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { margin: 0.6rem 0 0.3rem; font-size: 0.95rem; font-weight: 600; }
.msg-bubble h1:first-child, .msg-bubble h2:first-child, .msg-bubble h3:first-child { margin-top: 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 1.2rem; margin-bottom: 0.4rem; }
.msg-bubble li { margin-bottom: 0.15rem; }
.msg-bubble code { font-family: var(--mono); font-size: 0.82em; background: var(--surface3); padding: 0.1em 0.3em; border-radius: 3px; }
.msg-bubble pre { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; overflow-x: auto; margin: 0.4rem 0; }
.msg-bubble pre code { background: none; padding: 0; }
.msg-bubble blockquote { border-left: 2px solid var(--accent2); padding-left: 0.65rem; color: var(--text-dim); margin: 0.4rem 0; }
.msg-bubble a { color: var(--accent); }
.msg-bubble img { max-width: 100%; border-radius: var(--radius-sm); margin-top: 0.4rem; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 0.6rem 0; }
.msg-bubble table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin: 0.4rem 0; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--border); padding: 0.35rem 0.55rem; text-align: left; }
.msg-bubble th { background: var(--surface2); }

/* typing indicator */
.typing-indicator {
  align-self: flex-start;
  margin: 0 1.25rem 0.4rem;
  display: flex;
  gap: 4px;
  align-items: center;
  height: 22px;
}
.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* input area */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.6rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

.attachments {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.attachment-chip {
  display: flex; align-items: center; gap: 0.35rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  max-width: 160px;
}
.attachment-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 2px; }
.attachment-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.attachment-chip .chip-remove { cursor: pointer; color: var(--text-dim); flex-shrink: 0; }
.attachment-chip .chip-remove:hover { color: var(--red); }

#message-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  resize: none;
  outline: none;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.15s;
  min-height: 36px;
}
#message-input:focus { border-color: var(--accent); }
#message-input::placeholder { color: var(--text-dim); }

.btn-send {
  background: var(--accent2);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  width: 36px; height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-send:hover { background: #818cf8; }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Mission Control tab ── */
#tab-mission.active {
  flex-direction: column;
  overflow: hidden;
}

.mission-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mission-board {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.kanban-col {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 100%;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
}

.kanban-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kanban-title.queued  { color: var(--yellow); }
.kanban-title.running { color: var(--accent); }
.kanban-title.done    { color: var(--green); }
.kanban-title.failed  { color: var(--red); }

.kanban-count {
  font-size: 0.7rem;
  background: var(--surface3);
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--mono);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  max-height: calc(100dvh - var(--topbar-h) - 120px);
  padding-bottom: 0.5rem;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s;
}
.task-card:hover { border-color: var(--border2); }

.task-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-agent-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.task-card-prompt {
  font-size: 0.78rem;
  color: var(--text-dim);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.task-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.task-action-btn {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.task-action-btn:hover { color: var(--text); border-color: var(--text-dim); }
.task-action-btn.cancel:hover { color: var(--red); border-color: var(--red); }

/* mission modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}
.modal-input:focus { border-color: var(--accent2); }
.modal-input::placeholder { color: var(--text-dim); }

.modal-row { display: flex; gap: 0.6rem; }
.modal-row .select { flex: 1; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* ── Scheduled Tasks tab ── */
.tasks-header {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.task-item-left { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.task-item-name { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.task-item-prompt { font-size: 0.78rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
.task-item-right { display: flex; align-items: center; gap: 0.85rem; flex-shrink: 0; }
.task-cron { font-family: var(--mono); font-size: 0.75rem; color: var(--accent2); }
.task-next { font-size: 0.75rem; color: var(--text-dim); }
.task-status { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 3px; }
.task-status.enabled { background: rgba(0, 232, 122, 0.12); color: var(--green); }
.task-status.paused  { background: rgba(255, 199, 0, 0.12); color: var(--yellow); }

/* ── Memories tab ── */
.memories-stats {
  display: flex;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.mem-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.mem-stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
}

.mem-stat-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.memories-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.memory-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.memory-type {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  text-transform: uppercase;
}
.memory-type.user      { background: rgba(0, 212, 255, 0.12); color: var(--accent); }
.memory-type.feedback  { background: rgba(255, 199, 0, 0.12); color: var(--yellow); }
.memory-type.project   { background: rgba(192, 132, 252, 0.12); color: var(--purple); }
.memory-type.reference { background: rgba(0, 232, 122, 0.12); color: var(--green); }
.memory-type.fact      { background: rgba(99, 102, 241, 0.12); color: var(--accent2); }
.memory-type.default   { background: var(--surface3); color: var(--text-dim); }

.memory-content { font-size: 0.85rem; color: var(--text); line-height: 1.5; flex: 1; }
.memory-meta { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.25rem; }

/* ── Loading placeholder ── */
.loading-placeholder {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

/* ── Agent color accents ── */
.agent-color-main     { color: var(--accent); }
.agent-color-research { color: var(--yellow); }
.agent-color-comms    { color: var(--green); }
.agent-color-content  { color: var(--purple); }
.agent-color-ops      { color: var(--orange); }

.agent-tag-main     { background: rgba(0,212,255,0.12); color: var(--accent); }
.agent-tag-research { background: rgba(255,199,0,0.12); color: var(--yellow); }
.agent-tag-comms    { background: rgba(0,232,122,0.12); color: var(--green); }
.agent-tag-content  { background: rgba(192,132,252,0.12); color: var(--purple); }
.agent-tag-ops      { background: rgba(255,107,53,0.12); color: var(--orange); }
.agent-tag-default  { background: var(--surface3); color: var(--text-dim); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .tabs .tab[data-tab="mission"],
  .tabs .tab[data-tab="tasks"] { display: none; }
  .chat-sidebar { width: 160px; }
  .user-email-top { display: none; }
}

@media (max-width: 540px) {
  .topbar { padding: 0 0.6rem; }
  .tabs { gap: 0; }
  .tab { padding: 0.3rem 0.5rem; font-size: 0.7rem; }
  .chat-sidebar { display: none; }
}
