@import url("./identity.css");

:root {
  --sidebar: 238px;
  --sans: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --display: var(--sans);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-optical-sizing: auto;
  font-synthesis: none;
  font-variant-numeric: proportional-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
textarea { font: inherit; }
button { color: inherit; }

#app {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  background:
    radial-gradient(circle at 67% -20%, rgba(158, 232, 210, 0.055), transparent 35%),
    var(--bg);
}

#sidebar {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 14px 14px;
  background: #151613;
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 7px;
  gap: 11px;
}

.brand-mark,
.empty-mark {
  flex: 0 0 auto;
  box-shadow: 0 10px 30px rgba(160, 214, 60, 0.12);
  overflow: hidden;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.brand-mark img,
.empty-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.brand-copy strong { font-family: var(--display); font-size: 15px; font-weight: 650; letter-spacing: -0.012em; }
.brand-copy span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.new-chat {
  width: 100%;
  height: 43px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 20px 0 22px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
}

.new-chat:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); }
.new-chat > span { color: var(--accent); font-size: 20px; font-weight: 300; line-height: 1; }

kbd {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--faint);
  font: 500 12px var(--sans);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.history-heading {
  min-height: 27px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 8px 10px;
}

.history-label {
  padding-top: 3px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#cleanup-chats {
  padding: 3px 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

#cleanup-chats:hover { color: var(--text); }

#chat-list {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

.chat-row {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 100ms ease, border-color 100ms ease;
}

.chat-row:hover { background: rgba(255, 255, 255, 0.035); }
.chat-row.active { background: var(--panel-3); border-color: rgba(255, 255, 255, 0.055); }
.chat-row.unread .chat-icon::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.chat-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}

.chat-copy { min-width: 0; display: grid; gap: 4px; }
.chat-copy strong,
.chat-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-copy strong { color: #dedfd8; font-size: 13px; font-weight: 600; }
.chat-copy small { color: var(--faint); font-size: 12px; }
.chat-row time { align-self: start; padding-top: 2px; color: #5c6058; font-size: 12px; }

.sidebar-footer {
  display: grid;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.connection-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 5px 8px;
}

.connection-row strong {
  color: #dfe2d9;
  font-size: 12px;
  font-weight: 590;
  letter-spacing: -0.005em;
  line-height: 1.35;
}
.connection-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d98371;
  box-shadow: 0 0 0 4px rgba(217, 131, 113, 0.075);
}
.connection-dot.online { background: var(--accent); box-shadow: 0 0 0 4px rgba(158, 232, 210, 0.08); }

#workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 18, 16, 0.84);
  backdrop-filter: blur(18px);
  z-index: 10;
}

.conversation-heading { min-width: 0; display: grid; gap: 3px; }
.conversation-heading h1 {
  font-family: var(--display);
  max-width: min(50vw, 620px);
  margin: 0;
  overflow: hidden;
  color: #f3f4ee;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eyebrow { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

.subtle-button,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}
.subtle-button:hover,
.icon-button:hover { background: rgba(255, 255, 255, 0.065); }
.subtle-button {
  height: 35px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.subtle-button > span { color: var(--accent); font-size: 17px; }
.subtle-button kbd { margin-left: 4px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; }

#conversation {
  min-height: 0;
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

.message-list,
.typing {
  width: min(100%, 840px);
  margin: 0 auto;
  padding-inline: 28px;
}
.message-list { padding-top: 34px; padding-bottom: 18px; opacity: 1; transition: opacity 100ms ease; }
.message-list.loading { opacity: 0.45; }

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  margin: 0 0 30px;
  animation: message-in 180ms ease-out both;
}
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}
.message.user .message-avatar { grid-column: 2; grid-row: 1; }
.message.user .message-body { grid-column: 1; grid-row: 1; justify-self: end; max-width: min(78%, 650px); }

.message-avatar,
.assistant-avatar {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px 9px 9px 3px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 850;
}
.message-avatar.talos-avatar,
.assistant-avatar {
  border-radius: 9px;
  background: url("./talos-icon.png") center / cover no-repeat;
  color: transparent;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.message.user .message-avatar {
  border-radius: 9px 9px 3px 9px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
}

.message-body { min-width: 0; }
.message.user .message-content {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px 4px 14px 14px;
  background: var(--panel-2);
  color: #edf3fa;
  white-space: pre-wrap;
}
.message-content {
  color: #dbddd5;
  font-size: 14px;
  line-height: 1.68;
  overflow-wrap: anywhere;
}
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 12px; }
.message-content h1,
.message-content h2,
.message-content h3 { margin: 20px 0 9px; color: var(--text); line-height: 1.25; }
.message-content h1 { font-size: 19px; }
.message-content h2 { font-size: 17px; }
.message-content h3 { font-size: 15px; }
.message-content ul,
.message-content ol { margin: 8px 0 14px; padding-left: 22px; }
.message-content li { margin: 5px 0; }
.message-content code { padding: 2px 5px; border-radius: 5px; background: #243446; color: #c8eee5; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-content pre { max-width: 100%; margin: 12px 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #0a121e; }
.message-content pre code { padding: 0; background: transparent; color: #d8dbd1; line-height: 1.55; }
.message-content a { color: var(--accent); text-underline-offset: 3px; }
.message-content blockquote { margin: 12px 0; padding: 3px 0 3px 13px; border-left: 2px solid #659d96; color: var(--muted); }
.message-content blockquote > :last-child { margin-bottom: 0; }
.table-scroll { max-width: 100%; margin: 14px 0; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(0, 0, 0, .12); }
.message-content table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 12.5px; line-height: 1.45; }
.message-content th,
.message-content td { padding: 9px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.message-content th:last-child,
.message-content td:last-child { border-right: 0; }
.message-content tbody tr:last-child td { border-bottom: 0; }
.message-content th { background: rgba(158, 232, 210, .055); color: var(--text); font-size: 12px; font-weight: 720; letter-spacing: .035em; }
.message-content tbody tr:nth-child(even) { background: rgba(255, 255, 255, .018); }
.message-content .align-center { text-align: center; }
.message-content .align-right { text-align: right; font-variant-numeric: tabular-nums; }
.message-meta { min-height: 20px; display: flex; align-items: center; gap: 10px; padding-top: 7px; color: #555a51; font-size: 12px; }
.message.user .message-meta { justify-content: flex-end; }
.message-meta button { padding: 0; border: 0; background: none; color: #6f756b; cursor: pointer; font-size: 12px; }
.message-meta button:hover { color: var(--text); }

.activity-message { margin-top: -8px; margin-bottom: 20px; }
.activity-avatar { width: 24px; height: 24px; margin: 3px 0 0 4px; opacity: .72; }
.activity-disclosure { max-width: 100%; color: var(--muted); }
.activity-disclosure > summary { min-height: 30px; display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; list-style: none; color: #7f857b; font-size: 12px; font-weight: 590; user-select: none; }
.activity-disclosure > summary::-webkit-details-marker { display: none; }
.activity-disclosure > summary:hover { color: #b9bdb4; }
.activity-chevron { width: 6px; height: 6px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); transition: transform 120ms ease; }
.activity-disclosure[open] .activity-chevron { transform: rotate(45deg) translateY(-2px); }
.activity-list { width: min(100%, 720px); margin: 2px 0 4px; padding: 6px 0 6px 12px; border-left: 1px solid rgba(158, 232, 210, .16); }
.activity-step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 7px; padding: 4px 6px; color: #797f75; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.activity-step:hover { color: #aeb3a9; }
.activity-step-icon { filter: grayscale(.45); font-size: 12px; text-align: center; opacity: .82; }
.activity-meta { min-height: 12px; padding-top: 0; opacity: .7; }

.task-card-message { margin-top: -4px; margin-bottom: 22px; }
.task-card-avatar { width: 24px; height: 24px; margin: 5px 0 0 4px; opacity: .78; }
.task-card { width: min(100%, 760px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(19, 20, 18, .82); box-shadow: 0 8px 26px rgba(0, 0, 0, .12); }
.task-card > summary { min-height: 40px; display: flex; align-items: center; padding: 7px 12px; cursor: pointer; list-style: none; user-select: none; }
.task-card > summary::-webkit-details-marker { display: none; }
.task-card-heading { min-width: 0; display: flex; align-items: center; gap: 8px; color: #a8aca4; }
.task-card-heading strong { color: #b9bdb5; font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.task-card-chevron { width: 6px; height: 6px; flex: 0 0 auto; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); transition: transform 120ms ease; }
.task-card[open] .task-card-chevron { transform: rotate(45deg) translateY(-2px); }
.task-card-live { padding: 2px 6px; border-radius: 999px; background: rgba(158, 232, 210, .08); color: #9dbd60; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.task-card-list { padding: 0 12px 9px; }
.task-card-row { min-height: 29px; display: grid; grid-template-columns: 15px minmax(0, 1fr); align-items: start; gap: 8px; padding: 5px 3px; color: #747a70; font-size: 12px; line-height: 1.55; }
.task-card-marker { width: 12px; height: 12px; display: grid; place-items: center; margin-top: 2px; border: 1px dashed #50554d; border-radius: 50%; color: #11130f; font-size: 12px; font-weight: 900; line-height: 1; }
.task-card-row.complete { color: #858b80; }
.task-card-row.complete .task-card-marker { border-color: #2aa775; background: #2aa775; color: #0d1712; }
.task-card-row.in_progress { color: #c9ccc4; }
.task-card-row.in_progress .task-card-marker { border: 1.5px dotted var(--accent); animation: task-spin 1.6s linear infinite; }
.task-card-row.error { color: #c9948b; }
.task-card-row.error .task-card-marker { border-color: #b8665b; background: #b8665b; color: #180b09; }
.task-card-row.cancelled { text-decoration: line-through; opacity: .65; }
.task-card-copy { min-width: 0; overflow-wrap: anywhere; }
.task-card-meta { min-height: 13px; padding-top: 4px; opacity: .7; }
@keyframes task-spin { to { transform: rotate(360deg); } }

.system-message { margin: 0 auto 24px; padding: 7px 12px; width: fit-content; max-width: 80%; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel); font-size: 12px; text-align: center; }

.typing {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 24px;
}
.typing-copy { display: flex; align-items: center; min-height: 31px; gap: 4px; }
.typing-copy > span { width: 5px; height: 5px; border-radius: 50%; background: #878c81; animation: pulse 1.1s infinite ease-in-out; }
.typing-copy > span:nth-child(2) { animation-delay: 140ms; }
.typing-copy > span:nth-child(3) { animation-delay: 280ms; }
.typing-copy small { margin-left: 8px; color: var(--faint); font-size: 12px; }
@keyframes pulse { 0%, 65%, 100% { opacity: 0.35; transform: translateY(0); } 32% { opacity: 1; transform: translateY(-2px); } }
.stream-cursor { display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--accent); animation: blink 700ms step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.empty-state {
  width: min(100%, 680px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 60px 24px 90px;
  text-align: center;
}
.empty-mark { width: 52px; height: 52px; margin-bottom: 19px; border-radius: 15px; }
.empty-state h2 { margin: 0; font-size: 25px; font-weight: 680; letter-spacing: -0.035em; }
.empty-state > p { max-width: 460px; margin: 10px 0 26px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.suggestions { width: min(100%, 570px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.suggestions button { min-height: 72px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); color: #b8bcb1; cursor: pointer; font-size: 12px; line-height: 1.35; text-align: left; }
.suggestions button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.04); color: var(--text); }

.composer-wrap {
  position: relative;
  padding: 12px 24px max(13px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(17, 18, 16, 0), var(--bg) 20%);
}
.composer {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 12px 12px 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #1b1d19;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.composer:focus-within { border-color: rgba(158, 232, 210, 0.27); box-shadow: 0 12px 38px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(158, 232, 210, 0.035); }
.composer.submitting { border-color: rgba(158, 232, 210, 0.2); }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 9px; }
.attachment-chip { max-width: min(100%, 270px); display: grid; grid-template-columns: 25px minmax(0, 1fr) 20px; align-items: center; gap: 7px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 9px; background: #23251f; }
.attachment-chip-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(158,232,210,.08); color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.attachment-chip-copy { min-width: 0; display: grid; gap: 2px; }
.attachment-chip-copy strong { overflow: hidden; color: #dfe1d9; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip-copy small { color: var(--faint); font-size: 12px; }
.attachment-chip-remove { width: 20px; height: 20px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.attachment-chip-remove:hover { color: var(--danger); }
#message-input { width: 100%; max-height: 180px; min-height: 28px; padding: 2px 2px 5px; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: var(--text); caret-color: var(--accent); line-height: 1.5; }
#message-input::placeholder { color: #6a6f65; }
#message-input:disabled { color: var(--muted); opacity: .8; }
.composer-bottom { position: relative; display: flex; align-items: center; min-height: 31px; }
.attach-button { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; margin-right: 5px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.attach-button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.attach-button:disabled { opacity: .35; cursor: default; }
.attach-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.attachment-menu { position: absolute; left: 0; bottom: 39px; z-index: 35; width: min(280px, calc(100vw - 42px)); padding: 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: #242620; box-shadow: 0 14px 40px rgba(0,0,0,.42); }
.attachment-menu button { width: 100%; display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.attachment-menu button:hover,
.attachment-menu button:focus-visible { outline: 0; background: rgba(255,255,255,.055); }
.attachment-menu button > span:first-child { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: rgba(158,232,210,.08); color: var(--accent); font-size: 15px; }
.attachment-menu button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.attachment-menu strong { color: var(--text); font-size: 12px; font-weight: 650; }
.attachment-menu small { color: var(--muted); font-size: 12px; }
.composer-hint { min-width: 0; display: flex; align-items: center; gap: 7px; color: #62675e; font-size: 12px; }
.message-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.message-attachment { width: min(100%, 340px); min-height: 52px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 12px; text-align: left; }
.message-attachment b { width: 38px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: rgba(158, 232, 210, .075); color: var(--accent); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.message-attachment-copy { min-width: 0; display: grid; gap: 3px; overflow: hidden; }
.message-attachment-copy strong { overflow: hidden; color: #dfe2d9; font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.message-attachment-copy small { color: var(--faint); font-size: 12px; }
.message-attachment.downloadable { grid-template-columns: 38px minmax(0, 1fr) 25px; appearance: none; cursor: pointer; transition: border-color 120ms ease, background 120ms ease, transform 120ms ease; }
.message-attachment.downloadable:hover,
.message-attachment.downloadable:focus-visible { outline: 0; border-color: rgba(158, 232, 210, .3); background: rgba(158, 232, 210, .045); transform: translateY(-1px); }
.message-attachment.downloadable:disabled { cursor: wait; opacity: .72; transform: none; }
.attachment-download-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(255, 255, 255, .045); color: var(--accent); font-size: 15px; }
.message-attachment.downloading .attachment-download-icon { animation: pulse 1.1s infinite ease-in-out; }
.wake-indicator { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #6f7f53; }
.send-button { width: 31px; height: 31px; display: grid; place-items: center; margin-left: auto; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); cursor: pointer; transition: transform 100ms ease, opacity 100ms ease; }
.send-button:hover:not(:disabled) { transform: translateY(-1px); }
.send-button:disabled { opacity: 0.24; cursor: default; }
.send-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: min(90vw, 520px); padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #282a24; box-shadow: 0 12px 36px rgba(0,0,0,.4); color: var(--text); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 140ms ease, transform 140ms ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#sidebar-scrim,
.mobile-only { display: none; }

/* Capability Center stays secondary to chat and occupies the same workspace. */
body.capability-open #workspace { grid-template-rows: 72px minmax(0, 1fr); }
body.capability-open #conversation,
body.capability-open .composer-wrap { display: none; }
.capability-nav { position: relative; }
.capability-nav[aria-pressed="true"] { border-color: rgba(158, 232, 210, .34); background: rgba(158, 232, 210, .08); color: var(--text); }
.capability-nav.has-pending { border-color: rgba(196, 181, 248, .45); color: var(--text); }
.nav-badge { min-width: 18px; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: #c4b5f8; color: #1a1406; font-size: 12px; font-weight: 750; text-align: center; }

#capability-center { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.capability-shell { width: min(100%, 760px); margin: 0 auto; padding: 34px 28px 72px; display: grid; gap: 22px; }
.capability-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.capability-header h2 { margin: 0 0 6px; font: 680 26px/1.1 var(--display); letter-spacing: -.03em; }
.capability-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.capability-header-actions { display: flex; gap: 4px; }
.capability-header .icon-button { flex: 0 0 auto; color: var(--muted); font-size: 18px; }

.capability-status { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 13px; }
.capability-status strong { color: var(--text); font-weight: 650; }
.capability-status-detail { color: var(--muted); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--faint); }
.capability-status[data-tone="ok"] .status-dot,
.status-dot[data-tone="ok"] { background: var(--accent); box-shadow: 0 0 0 4px rgba(158,232,210,.1); }
.capability-status[data-tone="warn"] .status-dot,
.status-dot[data-tone="warn"] { background: #c4b5f8; box-shadow: 0 0 0 4px rgba(196,181,248,.1); }
.capability-status[data-tone="off"] .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,142,123,.1); }
.capability-status[data-tone="checking"] .status-dot { animation: status-pulse 1.2s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: .35; } }

.capability-block { display: grid; gap: 10px; }
.block-heading { display: flex; align-items: center; gap: 9px; }
.block-heading h3 { margin: 0; color: #edf3fa; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.block-copy { margin: -4px 0 2px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.count-pill { min-width: 20px; padding: 2px 7px; border-radius: 999px; background: rgba(196,181,248,.14); color: #c4b5f8; font-size: 12px; text-align: center; }

.request-list { display: grid; gap: 10px; }
.request-card { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid rgba(196,181,248,.3); border-radius: 14px; background: linear-gradient(180deg, rgba(196,181,248,.06), rgba(196,181,248,.02)); }
.request-title { margin: 0; color: var(--text); font-size: 16px; font-weight: 500; line-height: 1.4; letter-spacing: -.01em; }
.request-title strong { font-weight: 680; }
.request-where { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.request-reason { margin: 0; padding: 9px 12px; border-left: 2px solid rgba(196,181,248,.45); border-radius: 0 8px 8px 0; background: rgba(0,0,0,.14); }
.request-reason-label { display: block; margin-bottom: 3px; color: var(--faint); font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.request-reason p { margin: 0; color: #bacadc; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-effect { margin: 0; color: #c4b5f8; font-size: 12px; font-weight: 650; }
.request-effect-change { color: #fbbf72; }
.command-text { margin: 4px 0 0; padding: 9px 10px; overflow: auto; max-height: 180px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.26); color: #e6c07a; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.plan-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; color: #bacadc; font-size: 13px; line-height: 1.45; }
.plan-step strong { color: #edf3fa; font-weight: 650; }
.plan-step-effect { color: #c4b5f8; font-size: 12px; }
.plan-step-text { margin: 4px 0 0; padding: 6px 9px; border: 1px solid rgba(196,181,248,.3); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 10em; overflow: auto; }
.rule-form { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(0,0,0,.14); }
.rule-form[hidden] { display: none; }
.rule-scope { margin: 0; color: #bacadc; font-size: 12px; line-height: 1.45; }
.rule-check, .rule-field { display: flex; align-items: center; gap: 6px; color: #bacadc; font-size: 13px; }
.rule-uses { width: 90px; }
.rule-note, .rule-duration, .rule-uses { background: rgba(0,0,0,.25); color: #edf3fa; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 13px; }
.rule-limits { display: block; color: var(--faint); font-size: 12px; line-height: 1.4; }
.broker-key p { margin: 0 0 8px; font-size: 12px; line-height: 1.45; }
.broker-key-ok { color: var(--faint); }
.broker-key-warn { color: #c4b5f8; }
.credential-missing { color: #c4b5f8; }
.credential-form[hidden] { display: none; }
.evidence-toggle { margin-left: 8px; padding: 2px 10px; font-size: 12px; }
.evidence-panel { margin: -2px 0 10px 28px; padding: 10px 12px; border-left: 2px solid var(--line, rgba(255,255,255,0.12)); display: grid; gap: 10px; }
.evidence-section { display: grid; gap: 4px; }
.evidence-label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.evidence-text, .evidence-quote { margin: 0; font-size: 13px; line-height: 1.45; }
.evidence-quote { color: var(--faint); font-style: italic; }
.evidence-result { margin: 0; max-height: 220px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.evidence-audit { margin: 0; padding-left: 18px; font-size: 12px; color: var(--faint); display: grid; gap: 2px; }
.evidence-section .revoke-button { justify-self: start; }
.device-pairing .pairing-code { display: block; margin: 6px 0 10px; padding: 8px; font-size: 12px; word-break: break-all; user-select: all; border-radius: 6px; background: rgba(255,255,255,0.04); }
.device-add { display: grid; gap: 6px; margin-top: 10px; }
.pairing-input { font-family: ui-monospace, monospace; font-size: 12px; resize: vertical; }
.device-revoked { opacity: 0.55; }
.request-content { margin: 0; padding: 9px 12px; border: 1px solid rgba(196,181,248,.35); border-radius: 8px; background: rgba(196,181,248,.06); }
.request-content p { margin: 0; color: #edf3fa; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16em; overflow: auto; }
.request-meta { margin: 0; color: var(--faint); font-size: 12px; }
.request-details summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 12px; }
.request-details summary:hover { color: var(--text); }
.request-details .kv { margin-top: 10px; }
.request-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.request-blocked { margin: 0; color: #d9a79c; font-size: 12px; text-align: right; }
.grant-lifetime-label { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--muted); font-size: 12.5px; }
.grant-lifetime { min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(0,0,0,.22); color: var(--text); font-size: 12.5px; }

.allow-button,
.ghost-button,
.revoke-button,
.link-button { min-height: 38px; padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 640; }
.allow-button { border: 0; background: var(--accent); color: var(--accent-ink); }
.allow-button:hover:not(:disabled) { filter: brightness(1.06); }
.ghost-button { border: 1px solid var(--line-strong); background: transparent; color: #bacadc; }
.ghost-button:hover:not(:disabled) { background: rgba(255,255,255,.04); color: var(--text); }
.revoke-button { min-height: 32px; padding: 5px 12px; border: 1px solid rgba(255,142,123,.25); background: transparent; color: #ef9d8e; font-size: 12px; }
.revoke-button:hover:not(:disabled) { background: rgba(255,142,123,.08); }
.link-button { min-height: 32px; padding: 5px 8px; border: 0; background: transparent; color: var(--muted); font-weight: 560; }
.link-button:hover { color: var(--text); }
.allow-button:disabled,
.ghost-button:disabled,
.revoke-button:disabled { opacity: .35; cursor: not-allowed; }

.row-list { display: grid; }
.row-list:empty { display: none; }
.activity-row,
.access-row,
.plain-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.row-list > :last-child { border-bottom: 0; }
.row-copy { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.row-copy strong,
.plain-row strong { color: #e0e9f3; font-size: 13.5px; font-weight: 600; }
.row-copy span,
.plain-row span { overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.plain-row { justify-content: space-between; }
.activity-mark { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgba(255,255,255,.05); color: var(--muted); font-size: 12px; font-weight: 700; }
.activity-row.done .activity-mark { background: rgba(158,232,210,.12); color: var(--accent); }
.activity-row.failed .activity-mark { background: rgba(255,142,123,.12); color: var(--danger); }
.activity-row.running .activity-mark { background: rgba(196,181,248,.12); color: #c4b5f8; }
.activity-state { flex: 0 0 auto; color: var(--faint); font-size: 12px; }

.stop-block { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px solid rgba(255,142,123,.14); border-radius: 12px; }
.stop-block h3 { margin: 0 0 4px; color: #edf3fa; font-size: 14px; font-weight: 650; }
.stop-block p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.danger-button { min-height: 38px; flex: 0 0 auto; padding: 8px 14px; border: 1px solid rgba(255,142,123,.3); border-radius: 9px; background: rgba(255,142,123,.08); color: #ef9d8e; cursor: pointer; font-size: 12.5px; font-weight: 650; }
.danger-button.resume { border-color: rgba(158,232,210,.3); background: rgba(158,232,210,.08); color: var(--accent); }
.danger-button:disabled { opacity: .35; cursor: not-allowed; }

.capability-advanced { border-top: 1px solid var(--line); padding-top: 14px; }
.capability-advanced > summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.capability-advanced > summary:hover { color: var(--text); }
.advanced-body { display: grid; gap: 22px; margin-top: 16px; }
.advanced-group h4 { margin: 0 0 8px; color: #bacadc; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.advanced-group > p { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.kv > div { min-width: 0; }
.kv > div.wide { grid-column: 1 / -1; }
.kv dt { color: var(--faint); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.kv dd { margin: 3px 0 0; overflow: hidden; color: #b0bed0; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.parameter-json { max-height: 200px; margin: 0; padding: 9px 10px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.2); color: #b0bed0; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.capability-empty { margin: 0; padding: 14px 2px; color: var(--faint); font-size: 13px; }

.chat-request-banner { display: grid; gap: 6px; width: min(100%, 860px); margin: 0 auto 8px; }
.chat-request { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border: 1px solid rgba(196,181,248,.35); border-radius: 14px; background: rgba(30, 41, 62, .96); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.chat-request-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #c4b5f8; animation: status-pulse 1.6s ease-in-out infinite; }
.chat-request-copy { display: grid; flex: 1 1 auto; gap: 1px; min-width: 0; }
.chat-request-title { margin: 0; color: var(--text); font-size: 13.5px; line-height: 1.35; }
.chat-request-title strong { font-weight: 680; }
.chat-request-copy > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chat-request-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.chat-request-actions .allow-button,
.chat-request-actions .ghost-button { min-height: 34px; padding: 6px 13px; font-size: 12.5px; }
.more-requests { justify-self: center; font-size: 12px; }

@media (max-width: 760px) {
  :root { --sidebar: min(86vw, 318px); }
  #app { display: block; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding-top: max(18px, env(safe-area-inset-top)); transform: translateX(-101%); transition: transform 180ms ease; box-shadow: 18px 0 55px rgba(0,0,0,.38); }
  body.sidebar-open #sidebar { transform: translateX(0); }
  #sidebar-scrim { position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
  body.sidebar-open #sidebar-scrim { display: block; opacity: 1; pointer-events: auto; }
  .mobile-only { display: grid; }
  .desktop-only { display: none !important; }
  .brand-row #close-sidebar { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
  #workspace { width: 100%; height: 100%; grid-template-rows: calc(62px + env(safe-area-inset-top)) minmax(0, 1fr) auto; }
  .topbar { padding: env(safe-area-inset-top) 14px 0; }
  #open-sidebar { width: 36px; height: 36px; border: 0; background: transparent; align-content: center; gap: 4px; }
  #open-sidebar span { width: 17px; height: 1.5px; border-radius: 1px; background: var(--muted); }
  .conversation-heading h1 { max-width: 54vw; font-size: 16px; }
  .eyebrow { font-size: 12px; }
  .top-actions .icon-button { width: 35px; height: 35px; border: 0; background: transparent; color: var(--accent); font-size: 23px; }
  .message-list,
  .typing { padding-inline: 16px; }
  .message-list { padding-top: 22px; }
  .message { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; margin-bottom: 25px; }
  .message.user { grid-template-columns: minmax(0, 1fr) 30px; }
  .message-avatar,
  .assistant-avatar { width: 29px; height: 29px; }
  .message.user .message-body { max-width: 88%; }
  .message-content { font-size: 14px; line-height: 1.62; }
  .table-scroll { margin-block: 12px; border-radius: 10px; overscroll-behavior-inline: contain; }
  .message-content table { min-width: 380px; font-size: 12px; }
  .message-content th,
  .message-content td { padding: 8px 10px; }
  .activity-message { margin-top: -5px; margin-bottom: 17px; }
  .activity-disclosure > summary { min-height: 44px; padding-inline: 2px 10px; font-size: 12px; }
  .activity-list { padding-left: 7px; }
  .activity-step { grid-template-columns: 20px minmax(0, 1fr); min-height: 38px; align-items: center; padding: 6px 4px; font-size: 12px; }
  .task-card-message { margin-top: -3px; margin-bottom: 19px; }
  .task-card { width: 100%; border-radius: 11px; }
  .task-card > summary { min-height: 46px; padding: 8px 11px; }
  .task-card-list { padding: 0 10px 9px; }
  .task-card-row { min-height: 38px; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px 3px; font-size: 12px; line-height: 1.45; }
  .task-card-marker { width: 14px; height: 14px; margin-top: 0; }
  .message-attachment { width: 100%; min-height: 60px; padding: 9px 10px; }
  .message-attachment.downloadable { grid-template-columns: 40px minmax(0, 1fr) 32px; }
  .attachment-download-icon { width: 32px; height: 32px; }
  .empty-state { justify-content: flex-start; padding-top: 17vh; }
  .empty-state h2 { font-size: 22px; }
  .suggestions { grid-template-columns: 1fr; max-width: 390px; }
  .suggestions button { min-height: 46px; text-align: center; }
  .composer-wrap { padding: 9px 10px max(10px, env(safe-area-inset-bottom)); }
  .composer { border-radius: 15px; }
  #toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
  .capability-shell { padding: 22px 14px calc(48px + env(safe-area-inset-bottom)); gap: 20px; }
  .capability-nav { min-height: 44px; }
  .capability-header .icon-button { width: 44px; height: 44px; }
  .capability-status { flex-wrap: wrap; }
  .request-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .grant-lifetime-label { grid-column: 1 / -1; margin-right: 0; }
  .request-actions button { min-height: 44px; }
  .kv { grid-template-columns: 1fr; }
  .stop-block { align-items: stretch; flex-direction: column; }
  .danger-button { width: 100%; min-height: 44px; }
  .activity-state { display: none; }
  .chat-request { flex-wrap: wrap; }
  .chat-request-actions { width: 100%; justify-content: flex-end; }
  .chat-request-actions button { min-height: 40px; }
}

@media (max-width: 420px) {
  .composer-hint { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .message.user .message-body { max-width: 93%; }
}
