@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --ink: #E8EAED;
  --ink-soft: #8B93A7;
  --ink-faint: #5A6275;
  --paper: #0B0E14;
  --panel: #1A2030;
  --line: #262E42;
  --amber: #E8B563;
  --amber-soft: rgba(232, 181, 99, 0.14);
  --teal: #3DDC84;
  --teal-dim: #2A9960;
  --teal-soft: rgba(61, 220, 132, 0.14);
  --clay: #FF6482;
  --clay-soft: rgba(255, 100, 130, 0.14);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(61, 220, 132, 0.06), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(124, 156, 255, 0.05), transparent 40%);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.hamburger-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger-btn span {
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.15);
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-weight: 500;
  color: var(--ink-faint);
  font-size: 13px;
}

.pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  flex-shrink: 0;
  white-space: nowrap;
}

.pill-overdue {
  background: var(--clay-soft);
  border-color: transparent;
  color: var(--clay);
}

.pill-webmcp {
  cursor: default;
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal);
}

.pill-webmcp.unsupported {
  background: var(--panel);
  color: var(--ink-faint);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.agent-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-thread::-webkit-scrollbar {
  width: 6px;
}

.agent-thread::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.msg-row-user {
  justify-content: flex-end;
}

.msg-row-agent {
  justify-content: flex-start;
}

.msg-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.msg-avatar-agent {
  background: var(--paper);
  color: var(--teal);
  border: 1.5px solid var(--teal-dim);
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.1);
}

.msg-avatar-user {
  background: var(--panel);
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}

.agent-message {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  max-width: 100%;
}

.msg-row-agent .agent-message {
  flex: 1 1 auto;
  min-width: 0;
}

.msg-row-user .agent-message,
.agent-message.pending,
.agent-message.confirmed,
.agent-message.error {
  padding: 11px 14px;
  border-radius: 16px 16px 16px 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  max-width: 78%;
}

.msg-row-user .agent-message {
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  color: #0B0E14;
  border-color: transparent;
  font-weight: 500;
}

.agent-message.pending {
  background: var(--amber-soft);
  border-color: rgba(232, 181, 99, 0.3);
}

.agent-message.confirmed {
  background: var(--teal-soft);
  border-color: rgba(61, 220, 132, 0.3);
}

.agent-message.error {
  background: var(--clay-soft);
  border-color: rgba(255, 100, 130, 0.3);
}

.msg-body p {
  margin: 0 0 10px;
}

.msg-body p:last-child {
  margin-bottom: 0;
}

.msg-body h4 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  margin: 14px 0 8px;
  color: var(--ink);
}

.msg-body h4:first-child {
  margin-top: 0;
}

.msg-body ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.msg-body li {
  margin-bottom: 4px;
}

.msg-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--teal);
}

.msg-row-user .msg-body code {
  background: rgba(11, 14, 20, 0.15);
  color: #0B0E14;
}

.msg-body strong {
  font-weight: 700;
}

.msg-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0 14px;
}

.msg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.msg-table th,
.msg-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.msg-table th {
  background: var(--panel);
  color: var(--teal);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.msg-table td {
  background: var(--paper);
  color: var(--ink-soft);
}

.msg-table td code {
  color: var(--teal);
}

.msg-table tr:last-child td {
  border-bottom: none;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px 16px 16px 4px;
  max-width: fit-content;
}

.typing-bubble .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.5;
  animation: typing-bounce 1.1s infinite ease-in-out;
}

.typing-bubble .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.agent-message .approve-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.agent-message .approve-row button {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  padding: 6px 11px;
  cursor: pointer;
  border: 1px solid transparent;
}

.approve-yes {
  background: var(--teal);
  color: #0B0E14;
}

.approve-no {
  background: transparent;
  border-color: var(--line) !important;
  color: var(--ink-soft);
}

.msg-row-user .approve-no {
  border-color: rgba(11, 14, 20, 0.35) !important;
  color: #0B0E14;
}

.agent-chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}

.agent-chat-form input {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
}

.agent-chat-form input::placeholder {
  color: var(--ink-faint);
}

.agent-chat-form input:focus {
  outline: none;
  border-color: var(--teal-dim);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.12);
}

.agent-chat-form button {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: var(--teal);
  color: #0B0E14;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.agent-chat-form button:hover:not(:disabled) {
  opacity: 0.88;
}

.agent-chat-form button:disabled {
  opacity: 0.4;
  cursor: default;
}

.agent-message .tool-trace {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: inherit;
  opacity: 0.75;
  border-top: 1px solid currentColor;
  padding-top: 6px;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.drawer-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--panel);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 50;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
}

.drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.model-pill {
  font-size: 11px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--teal);
}

.drawer-section h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--ink-faint);
  font-weight: 600;
}

.board-mini {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.column-head h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}

.column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 30px;
}

.task-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  transition: border-color 0.18s ease;
}

.task-card:hover {
  border-color: var(--teal-dim);
}

.task-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 7px;
  color: var(--ink);
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  text-transform: lowercase;
}

.task-due {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
}

.task-due.overdue {
  color: var(--clay);
  font-weight: 600;
}

.task-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.task-actions button {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.task-actions button:hover {
  border-color: var(--teal-dim);
}

.tool-list h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--ink-faint);
  font-weight: 600;
}

.tool-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-list li {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  transition: border-color 0.15s ease;
}

.tool-list li:hover {
  border-color: var(--teal-dim);
}

.tool-list li code {
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
  font-weight: 600;
}

.empty-note {
  font-size: 12px;
  color: var(--ink-faint);
  padding: 8px 10px;
  font-style: italic;
}

.proposal-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--paper);
  transition: border-color 0.15s ease;
}

.proposal-item:hover {
  border-color: var(--amber);
}

.proposal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.proposal-head code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.proposal-desc {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 6px 0 0;
  line-height: 1.4;
}

.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: capitalize;
}

.badge-pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-approved {
  background: var(--teal-soft);
  color: var(--teal);
}

.badge-rejected {
  background: var(--clay-soft);
  color: var(--clay);
}

.file-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--paper);
  transition: border-color 0.15s ease;
}

.file-item:hover {
  border-color: var(--teal-dim);
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  word-break: break-all;
}

.file-row button {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}

.file-row button:hover {
  border-color: var(--teal-dim);
}

.file-content {
  display: none;
  margin: 8px 0 0;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.file-content.open {
  display: block;
}

.run-output.error {
  color: var(--clay);
}

.drawer-footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-link-btn {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.drawer-link-btn:hover {
  color: var(--teal);
}

.drawer-link {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--teal);
  text-decoration: none;
}

.drawer-link:hover {
  text-decoration: underline;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
}

.modal-card h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 19px;
  margin: 0 0 10px;
  color: var(--ink);
}

.modal-card > p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 14px;
}

.modal-list {
  margin: 0 0 20px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-list li {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.modal-list li strong {
  color: var(--ink);
}

.modal-card .approve-yes {
  width: 100%;
  padding: 11px;
  font-size: 13.5px;
  border-radius: 999px;
}

@media (max-width: 560px) {
  .brand-sub {
    display: none;
  }
}
