@import url("./tokens.css");
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--type-body)/var(--leading-body) var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}
button,
a {
  transition:
    background var(--motion),
    color var(--motion);
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: var(--type-page);
  line-height: var(--leading-heading);
  letter-spacing: -0.035em;
  font-weight: 500;
}
h2 {
  font-size: 15px;
  font-weight: 600;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
p {
  color: var(--secondary);
}
small,
.metadata {
  font-size: 12px;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.spacer {
  flex: 1;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s6);
}
.primary,
.quiet,
.icon-button,
.danger-button,
.new-chat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r1);
  min-height: 38px;
  padding: 8px 14px;
  font-size: var(--type-secondary);
  background: var(--surface);
  color: var(--secondary);
  white-space: nowrap;
}
.primary {
  background: linear-gradient(180deg, #d0dfed, #b8cee1);
  color: var(--accent-ink);
  box-shadow: var(--shadow-control);
  border-color: transparent;
  font-weight: 600;
}
.quiet:hover,
.icon-button:hover {
  background: var(--raised);
  color: var(--text);
}
.primary:hover {
  background: #e0eaf3;
}
.danger-button {
  color: var(--danger);
}
.icon-button {
  width: 36px;
  padding: 7px;
  font-size: 17px;
  background: transparent;
  border-color: transparent;
}
.badge {
  font-size: 11px;
  line-height: 1.4;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--raised);
  color: var(--secondary);
  white-space: nowrap;
}
.badge.available,
.badge.done {
  color: var(--success);
}
.badge.beta,
.badge.keyword_only {
  color: var(--accent);
}
.badge.planned,
.badge.integration_required,
.badge.not_indexed {
  color: var(--warning);
}
.badge.failed,
.badge.blocked {
  color: var(--danger);
}
kbd {
  font: 11px var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
}
.skip {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 100;
  background: var(--raised);
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
.app-shell.has-context {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 280px;
}
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 18px;
  overflow-y: auto;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--text);
  letter-spacing: 0.15em;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-mark.compact {
  width: 32px;
  height: 32px;
}
.brand-mark.header {
  width: 23px;
  height: 23px;
}
.brand-mark.large {
  width: 56px;
  height: 56px;
}
.axis-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
}
.brand strong {
  font-size: 16px;
  font-weight: 550;
  letter-spacing: 0.19em;
}
.nav-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-icon {
  width: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--muted);
}
nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-item {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--secondary);
  border-radius: 6px;
  font-size: 13px;
}
.nav-item:hover {
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(100deg, #2a323a, #20252b);
  color: var(--text);
  box-shadow:
    inset 1px 0 0 var(--accent),
    inset 0 1px 0 var(--light-edge);
}
.nav-item.active .nav-icon {
  color: var(--accent);
}
.new-chat {
  justify-content: flex-start;
  text-align: left;
  min-height: 44px;
  background: linear-gradient(180deg, #252b31, #1e2328);
  color: var(--text);
  border-color: #414b55;
  box-shadow: var(--shadow-control);
}
details summary {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
details nav {
  margin-top: 6px;
}
.pinned-projects h2 {
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.pinned-projects .nav-item {
  display: block;
}
.project-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 3px;
  background: #929bab;
}
.project-dot.blue {
  background: #7299c5;
}
.project-dot.sage {
  background: #7a9c8c;
}
.project-dot.amber {
  background: #aa926e;
}
.project-dot.violet {
  background: #9786ac;
}
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.operator {
  font-size: 12px;
  color: var(--muted);
  padding: 0 10px;
}
.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}
.sidebar-collapsed.has-context {
  grid-template-columns: 64px minmax(0, 1fr) 280px;
}
.sidebar-collapsed .sidebar {
  padding: 20px 6px;
}
.sidebar-collapsed .nav-label,
.sidebar-collapsed details,
.sidebar-collapsed .pinned-projects {
  display: none;
}
.sidebar-collapsed .new-chat {
  padding: 6px 12px;
}
.sidebar-collapsed .brand {
  padding: 0 11px;
}
.sidebar-collapsed .nav-content {
  justify-content: center;
}
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
#breadcrumbs {
  font-size: 13px;
  color: var(--secondary);
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
#breadcrumbs a {
  color: var(--muted);
}
#workspace {
  min-height: 0;
  flex: 1;
  overflow: auto;
  outline: none;
}
.page-content {
  padding: 48px 48px 64px;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}
.page-heading p {
  font-size: 13px;
  margin-top: 8px;
  max-width: 680px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section {
  min-width: 0;
}
.section p {
  font-size: 13px;
}
.section + .section {
  margin-top: 4px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.card {
  padding: 24px;
  border: 1px solid var(--light-edge);
  border-radius: var(--r2);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow-soft);
}
.card h2 {
  font-size: 15px;
}
.card p {
  font-size: 13px;
}
.card .row:last-child {
  margin-top: auto;
}
.card-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.record-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.row-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  color: var(--text);
  font: inherit;
  border: 0;
  background: none;
  padding: 0;
  overflow-wrap: anywhere;
}
.record-row .metadata {
  max-width: 200px;
  text-align: right;
}
.empty {
  padding: 44px 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.empty h2 {
  color: var(--text);
  font-size: 20px;
  font-weight: 450;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
.empty p {
  font-size: 13px;
  max-width: 520px;
  margin-bottom: 14px;
}
.loading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 24px 0;
  color: var(--muted);
}
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.tabs {
  display: flex;
  flex-direction: row;
  gap: 5px;
  overflow: auto;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.tabs button,
.tabs a {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
  border: 0;
  background: none;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
}
.tabs .active {
  color: var(--text);
  background: var(--raised);
}
.tabs a:hover {
  text-decoration: none;
  background: var(--surface);
}
.context-panel {
  padding: 24px 20px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}
.context-panel p {
  font-size: 13px;
  margin: 12px 0 20px;
}
.context-detail {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.context-detail span {
  color: var(--muted);
}
.context-detail strong {
  font-weight: 500;
  text-align: right;
}
.context-panel > a {
  display: block;
  margin-top: 20px;
  font-size: 13px;
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.timeline strong {
  font-size: 13px;
  font-weight: 500;
}
.timeline small {
  display: block;
  margin-top: 4px;
}
.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  margin-top: 7px;
}
input,
textarea,
select {
  width: 100%;
  min-height: 36px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--r1);
  padding: 10px 12px;
  color: var(--text);
}
textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--secondary);
}
input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}
dialog {
  max-height: 90dvh;
  overflow: auto;
  width: min(500px, calc(100vw - 32px));
  padding: 32px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #08090bd1;
}
dialog form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
dialog h2 {
  font-size: 20px;
}
dialog p {
  font-size: 13px;
}
dialog label {
  font-size: 13px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.form-error,
#auth-error {
  color: var(--danger);
  font-size: 13px;
}
.detail-dialog {
  width: min(740px, calc(100vw - 32px));
}
.detail-dialog > .quiet {
  margin-top: 20px;
}
.detail-dialog pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.command-dialog {
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  height: min(580px, 80dvh);
}
.command-input {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.command-input input {
  border: 0;
  background: none;
  font-size: 15px;
}
.command-input input:focus-visible {
  outline-offset: -2px;
}
.command-category {
  padding: 12px 16px 5px;
  font-size: 11px;
  text-transform: capitalize;
  color: var(--muted);
}
.command-option {
  display: flex;
  width: calc(100% - 16px);
  margin: 2px 8px;
  padding: 9px 10px;
  min-height: 40px;
  background: none;
  border: 0;
  border-radius: 6px;
  text-align: left;
  color: var(--text);
}
.command-option[aria-selected="true"] {
  background: var(--raised);
}
.command-option strong {
  font-weight: 500;
  font-size: 13px;
}
.command-option small {
  display: block;
}
.command-status {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
}
#command-options {
  min-height: 100px;
}
#toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  z-index: 50;
  max-width: 360px;
}
.toast {
  background: var(--overlay);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
}
.filter-input {
  max-width: 400px;
}
.prose {
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.paragraph {
  white-space: pre-wrap;
}
.prose pre {
  background: var(--sidebar);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 6px;
  overflow: auto;
  font: 12px/1.6 var(--mono);
}
.prose code {
  font: inherit;
}
.legacy-frame {
  width: 100%;
  height: calc(100dvh - 180px);
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.chat-page {
  max-width: 960px;
  width: 100%;
  height: 100%;
  padding-bottom: 16px;
  gap: 16px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 12px 0;
}
.chat-message {
  max-width: 100%;
}
.chat-message header {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.chat-message.user {
  background: var(--surface);
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
  max-width: 85%;
}
.chat-message .message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  opacity: 0.7;
}
.message-actions button {
  min-height: 26px;
  font-size: 11px;
  padding: 3px 6px;
}
.composer {
  flex-shrink: 0;
  background: linear-gradient(180deg, #20252b, #1c2025);
  border: 1px solid #3b444d;
  border-radius: var(--r3);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--light-edge);
  padding: 12px;
}
.composer textarea {
  border: 0;
  background: none;
  min-height: 64px;
  max-height: 160px;
  resize: none;
}
.composer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer-footer small {
  flex: 1;
}
.context-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--secondary);
}
.context-pills span {
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.operational-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 20px;
}
.task-check {
  background: none;
  border: 1px solid var(--muted);
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 4px;
  color: var(--success);
  padding: 0;
  font-size: 12px;
}
.done-title {
  text-decoration: line-through;
  color: var(--muted);
}
.file-drop {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 28px;
  border-radius: var(--r2);
  display: grid;
  gap: 12px;
}
.file-drop label {
  max-width: 500px;
}
.capability-list {
  display: grid;
  gap: 0;
}
.capability-list .record-row {
  padding: 16px 0;
}
@media (max-width: 1100px) {
  .app-shell.has-context,
  .sidebar-collapsed.has-context {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }
  .sidebar-collapsed.has-context {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .context-panel {
    position: fixed;
    right: 0;
    top: 64px;
    bottom: 0;
    width: 300px;
    z-index: 20;
    box-shadow: var(--shadow);
  }
  .split {
    gap: 24px;
  }
  .page-content {
    padding: 26px;
  }
}
@media (max-width: 899px) {
  .app-shell,
  .app-shell.has-context,
  .sidebar-collapsed,
  .sidebar-collapsed.has-context {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    z-index: 30;
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    transition: transform var(--motion);
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-collapsed .sidebar {
    padding: 20px 12px 12px;
  }
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed details,
  .sidebar-collapsed .pinned-projects {
    display: revert;
  }
  .sidebar-collapsed .nav-content {
    justify-content: flex-start;
  }
  .sidebar-collapsed .brand {
    padding: 0 8px;
  }
  .topbar {
    padding: 0 16px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .page-content {
    padding: 24px;
  }
  .chat-page {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
@media (max-width: 600px) {
  .topbar {
    gap: 6px;
    height: 52px;
    padding: 0 10px;
  }
  #breadcrumbs {
    font-size: 12px;
  }
  #search-open kbd {
    display: none;
  }
  #search-open {
    padding: 6px 9px;
  }
  .page-content {
    padding: 22px 16px;
    gap: 24px;
  }
  h1 {
    font-size: 23px;
  }
  .page-heading {
    flex-direction: column;
    gap: 14px;
  }
  .page-heading .row {
    width: 100%;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .record-row {
    gap: 10px;
    flex-wrap: wrap;
  }
  .record-row .metadata {
    max-width: none;
    font-size: 11px;
  }
  .record-row .row-title {
    min-width: 45%;
  }
  .command-dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    margin: 0;
  }
  .context-panel {
    top: 52px;
    width: min(340px, 100vw);
  }
  input,
  textarea,
  select {
    font-size: 16px;
  }
  .chat-page {
    height: calc(100dvh - 52px);
    gap: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .chat-page .page-heading {
    gap: 8px;
  }
  .chat-messages {
    gap: 20px;
  }
  .composer-footer {
    flex-wrap: wrap;
  }
  .composer-footer small {
    font-size: 11px;
  }
  .composer textarea {
    font-size: 16px;
  }
  .chat-message.user {
    max-width: 94%;
  }
  .legacy-frame {
    height: calc(100dvh - 220px);
    min-height: 450px;
  }
  .tabs {
    margin: 0 -2px;
  }
  .quiet,
  .primary {
    min-height: 38px;
  }
  #toasts {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
  .context-pills {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.task-status {
  max-width: 125px;
  width: auto;
  min-height: 30px;
  padding: 4px 7px;
  font-size: 12px;
}
.model-select {
  max-width: 230px;
  width: auto;
  font-size: 12px;
}
.chat-page:has(.chat-messages) {
  min-height: 0;
}
.chat-message .prose {
  font-size: 14px;
}
@media (max-height: 500px) {
  .chat-page {
    padding: 10px 20px;
    gap: 6px;
  }
  .chat-page .page-heading {
    flex-direction: row;
    gap: 10px;
  }
  .chat-page h1 {
    font-size: 18px;
  }
  .chat-page .context-pills {
    display: none;
  }
  .chat-page .chat-messages {
    min-height: 0;
    gap: 12px;
    padding: 4px 0;
  }
  .chat-page .composer textarea {
    min-height: 40px;
    height: 40px;
  }
  .chat-page .composer {
    padding: 6px;
  }
  .chat-page .operational-status {
    min-height: 18px;
  }
}
