/* ===== Ascend · Oracle LLM wiki ===== */

:root {
  --gold: #ffcf8f;
  --gold-strong: #ffb567;
  --ink: #1c1128;
  --user-bubble: #241a33;
  --user-bubble-text: #fdf6ec;
  --bot-bubble: rgba(255, 250, 242, 0.94);
  --bot-bubble-text: #2a2033;
  --card-bg: rgba(20, 12, 28, 0.55);
  --card-border: rgba(255, 235, 200, 0.18);
  --pane-bg: rgba(12, 7, 20, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --error: #ff8f8f;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family:
    'Segoe UI',
    -apple-system,
    BlinkMacSystemFont,
    'Helvetica Neue',
    Arial,
    sans-serif;
  background: #140b2b url('assets/ascend-bg.svg') center center / cover
    no-repeat fixed;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.shell {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: none;
  border-radius: 0;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: none;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 235, 200, 0.14);
  flex: 0 0 auto;
}

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

.auth-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-strong) 100%);
  color: #2a1710;
  flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(255, 181, 103, 0.35);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff6e8;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 12px;
  color: rgba(255, 246, 232, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-status {
  font-size: 12px;
  color: rgba(255, 246, 232, 0.65);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6be3a0;
  box-shadow: 0 0 0 3px rgba(107, 227, 160, 0.2);
  display: inline-block;
}

.brand-status--busy .status-dot {
  background: var(--gold-strong);
  box-shadow: 0 0 0 3px rgba(255, 181, 103, 0.25);
  animation: pulse 1.2s ease-in-out infinite;
}

.brand-status--error .status-dot {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 143, 143, 0.25);
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 0;
}

/* ---------- Wiki pane ---------- */

.wiki-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  border-right: 1px solid rgba(255, 235, 200, 0.14);
  background: var(--pane-bg);
}

.wiki-toolbar {
  grid-column: 1 / 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 235, 200, 0.1);
}

.wiki-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff6e8;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.wiki-search::placeholder {
  color: rgba(255, 246, 232, 0.45);
}

.wiki-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 181, 103, 0.18);
}

.wiki-lint {
  width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.28);
  background: rgba(255, 207, 143, 0.12);
  color: #fff6e8;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.wiki-lint:hover:not(:disabled) {
  background: rgba(255, 207, 143, 0.22);
  border-color: var(--gold);
}

.wiki-lint:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wiki-nav {
  grid-column: 1 / 2;
  grid-row: 2;
  overflow-y: auto;
  padding: 8px 10px 16px;
  font-size: 13px;
}

.wiki-nav details {
  margin-bottom: 4px;
}

.wiki-nav summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: rgba(255, 246, 232, 0.75);
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 8px;
  list-style: none;
}

.wiki-nav__folder-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.wiki-nav summary.wiki-nav__folder--active {
  background: rgba(255, 207, 143, 0.18);
  color: #fff6e8;
}

.wiki-nav summary::-webkit-details-marker {
  display: none;
}

.wiki-nav summary::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  color: var(--gold);
  transition: transform 0.12s ease;
}

.wiki-nav details[open] > summary::before {
  transform: rotate(90deg);
}

.wiki-nav__group {
  padding-left: 10px;
  border-left: 1px solid rgba(255, 235, 200, 0.12);
  margin-left: 6px;
}

.wiki-nav__item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: rgba(255, 246, 232, 0.82);
  padding: 6px 8px;
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  overflow: hidden;
}

.wiki-nav__item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.wiki-nav__item:hover {
  background: rgba(255, 207, 143, 0.1);
}

.wiki-nav__item--active {
  background: rgba(255, 207, 143, 0.18);
  color: #fff6e8;
  font-weight: 600;
}

.wiki-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(255, 181, 103, 0.22);
  color: var(--gold);
  border: 1px solid rgba(255, 181, 103, 0.35);
}

.wiki-article__header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 235, 200, 0.14);
}

.wiki-article__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.wiki-article__header h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.25;
  color: #fff6e8;
}

.wiki-article__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.wiki-publish,
.wiki-action {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.28);
  background: rgba(107, 227, 160, 0.16);
  color: #b8f5d0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.wiki-action {
  background: rgba(255, 207, 143, 0.12);
  color: #fff6e8;
}

.wiki-action--muted {
  background: rgba(255, 246, 232, 0.06);
  color: rgba(255, 246, 232, 0.75);
}

.wiki-action--danger {
  background: rgba(255, 143, 143, 0.12);
  color: #ffb0b0;
  border-color: rgba(255, 143, 143, 0.35);
}

.wiki-publish:hover:not(:disabled),
.wiki-action:hover:not(:disabled) {
  background: rgba(107, 227, 160, 0.28);
}

.wiki-action:hover:not(:disabled) {
  background: rgba(255, 207, 143, 0.22);
  border-color: var(--gold);
}

.wiki-action--danger:hover:not(:disabled) {
  background: rgba(255, 143, 143, 0.22);
}

.wiki-publish:disabled,
.wiki-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wiki-nav__root {
  margin-bottom: 8px;
  font-weight: 600;
  color: rgba(255, 246, 232, 0.9);
}

.wiki-name-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 235, 200, 0.2);
  background: rgba(255, 250, 242, 0.05);
}

.wiki-name-form__label {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 246, 232, 0.85);
}

.wiki-name-form__input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 235, 200, 0.24);
  background: rgba(12, 7, 20, 0.55);
  color: #fff6e8;
  font: inherit;
  font-size: 13px;
}

.wiki-name-form__input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 181, 103, 0.18);
}

.wiki-name-form__error {
  margin: 0;
  font-size: 12.5px;
  color: var(--error);
}

.wiki-name-form__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wiki-editor {
  display: block;
  width: 100%;
  min-height: min(60vh, 560px);
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 235, 200, 0.22);
  background: rgba(12, 7, 20, 0.72);
  color: #fff6e8;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  tab-size: 2;
}

.wiki-editor:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 181, 103, 0.18);
}

.wiki-article__meta {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 246, 232, 0.55);
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

.wiki-article__desc {
  margin: 10px 0 0;
  font-size: 14px;
  color: rgba(255, 246, 232, 0.78);
  line-height: 1.45;
}

.wiki-article {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  overflow-y: auto;
  padding: 20px 24px 32px;
  color: #fff6e8;
  background: rgba(255, 250, 242, 0.04);
}

.wiki-article__body {
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(255, 246, 232, 0.92);
}

.wiki-article__body p {
  margin: 0 0 12px;
}

.wiki-article__body h1,
.wiki-article__body h2,
.wiki-article__body h3,
.wiki-article__body h4,
.wiki-article__body h5,
.wiki-article__body h6 {
  margin: 1.2em 0 0.5em;
  line-height: 1.3;
  color: #fff6e8;
}

.wiki-article__body h1 {
  font-size: 1.35em;
}
.wiki-article__body h2 {
  font-size: 1.2em;
}
.wiki-article__body h3 {
  font-size: 1.08em;
}

.wiki-article__body ul,
.wiki-article__body ol {
  margin: 0 0 12px;
  padding-left: 1.35em;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
  max-width: 100%;
}

.wiki-article__body table,
.bubble table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.wiki-article__body th,
.wiki-article__body td,
.bubble th,
.bubble td {
  padding: 8px 10px;
  border: 1px solid rgba(255, 235, 200, 0.16);
  text-align: left;
  vertical-align: top;
}

.wiki-article__body th {
  background: rgba(255, 207, 143, 0.14);
  color: #fff6e8;
  font-weight: 600;
}

.wiki-article__body td {
  background: rgba(8, 4, 16, 0.28);
}

.wiki-article__body tbody tr:nth-child(even) td {
  background: rgba(8, 4, 16, 0.42);
}

.wiki-article__body th code,
.wiki-article__body td code {
  white-space: nowrap;
}

.wiki-article__body li {
  margin-bottom: 4px;
}

.wiki-article__body pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(8, 4, 16, 0.55);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.4;
}

.wiki-article__body code {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.wiki-article__body :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 207, 143, 0.12);
}

.wiki-article__body a,
.wiki-cite,
.wiki-cite-code,
.wiki-fn {
  color: var(--gold);
  cursor: pointer;
}

.wiki-article__body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wiki-cite {
  display: inline;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wiki-cite-code {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wiki-fn {
  display: inline;
  border: none;
  background: transparent;
  padding: 0 0.1em;
  margin: 0;
  font: inherit;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  vertical-align: super;
  color: var(--gold);
  cursor: pointer;
}

.wiki-fn--static {
  cursor: help;
}

.wiki-fn:hover,
.wiki-fn:focus-visible {
  color: var(--gold-strong, #ffb567);
  outline: none;
}

.wiki-sources {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 235, 200, 0.16);
}

.wiki-sources__title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 246, 232, 0.82);
}

.wiki-sources__list {
  margin: 0;
  padding-left: 1.25rem;
  color: rgba(255, 246, 232, 0.72);
  font-size: 0.85rem;
  line-height: 1.45;
}

.wiki-sources__list li + li {
  margin-top: 0.35rem;
}

.wiki-sources__label {
  color: rgba(255, 246, 232, 0.9);
}

.wiki-sources__list code {
  font-size: 0.8em;
  color: rgba(255, 207, 143, 0.92);
}

.wiki-sources__list a {
  color: var(--gold);
}

.wiki-empty {
  margin: 16px;
  color: rgba(255, 246, 232, 0.55);
  font-size: 13px;
}

/* ---------- Chat pane ---------- */

.chat-pane {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(12, 7, 20, 0.28);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 235, 200, 0.14);
  flex: 0 0 auto;
}

.chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff6e8;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.chat-action {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.28);
  background: rgba(255, 207, 143, 0.12);
  color: #fff6e8;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chat-action:hover:not(:disabled) {
  background: rgba(255, 207, 143, 0.22);
  border-color: var(--gold);
}

.chat-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-action[aria-expanded='true'] {
  background: rgba(255, 207, 143, 0.28);
  border-color: var(--gold);
}

.chat-history {
  flex: 0 0 auto;
  max-height: 220px;
  overflow-y: auto;
  border-bottom: 1px solid rgba(255, 235, 200, 0.14);
  background: rgba(8, 4, 14, 0.45);
  padding: 8px 10px 10px;
}

.chat-history__empty {
  margin: 8px 6px;
  color: rgba(255, 246, 232, 0.55);
  font-size: 12.5px;
}

.chat-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-history__item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff6e8;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-history__item:hover {
  background: rgba(255, 207, 143, 0.12);
  border-color: rgba(255, 235, 200, 0.18);
}

.chat-history__item[aria-current='true'] {
  background: rgba(255, 207, 143, 0.18);
  border-color: rgba(255, 181, 103, 0.45);
}

.chat-history__item-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history__item-meta {
  font-size: 11px;
  color: rgba(255, 246, 232, 0.55);
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-messages::-webkit-scrollbar,
.wiki-nav::-webkit-scrollbar,
.wiki-article::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb,
.wiki-nav::-webkit-scrollbar-thumb,
.wiki-article::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

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

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

.avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.avatar svg {
  width: 16px;
  height: 16px;
}

.avatar--user {
  background: linear-gradient(160deg, #3a2a4d, #201526);
  color: #ffd9a6;
}

.avatar--bot {
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #2a1710;
}

.bubble {
  max-width: 86%;
  min-width: 0;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 6px 18px rgba(10, 5, 20, 0.18);
}

.bubble p {
  margin: 0 0 8px;
}

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

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 0 0 8px;
  font-size: 1em;
  line-height: 1.35;
  color: inherit;
}

.bubble ol,
.bubble ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

.bubble .md-table-wrap {
  margin-bottom: 8px;
}

.bubble th,
.bubble td {
  border-color: rgba(28, 17, 40, 0.14);
}

.bubble th {
  background: rgba(28, 17, 40, 0.1);
  font-weight: 600;
}

.bubble pre {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(28, 17, 40, 0.08);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.4;
}

.bubble code {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.bubble :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(28, 17, 40, 0.08);
}

.bubble a,
.bubble .wiki-cite {
  color: #a5622f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bubble--user {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-left-radius: 6px;
  white-space: pre-wrap;
}

.bubble--bot {
  background: var(--bot-bubble);
  color: var(--bot-bubble-text);
  border-bottom-right-radius: 6px;
}

.bubble--streaming::after {
  content: '▍';
  display: inline-block;
  width: 0.5em;
  margin-left: 1px;
  animation: blink 0.9s step-end infinite;
  color: #a5622f;
}

.chat-thinking,
.chat-tools {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(42, 32, 51, 0.72);
}

.chat-thinking summary,
.chat-tool__detail summary {
  cursor: pointer;
  font-weight: 600;
  color: rgba(42, 32, 51, 0.78);
  list-style: none;
}

.chat-thinking summary::-webkit-details-marker,
.chat-tool__detail summary::-webkit-details-marker {
  display: none;
}

.chat-thinking summary::before,
.chat-tool__detail summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.12s ease;
}

.chat-thinking[open] summary::before,
.chat-tool__detail[open] summary::before {
  transform: rotate(90deg);
}

.chat-thinking__body,
.chat-tool__args,
.chat-tool__detail-body {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(28, 17, 40, 0.06);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 11.5px;
  max-height: 160px;
  overflow-y: auto;
}

.chat-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-tool {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(28, 17, 40, 0.05);
  border: 1px solid rgba(28, 17, 40, 0.08);
}

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

.chat-tool__name {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: #5a3d28;
}

.chat-tool__phase {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(42, 32, 51, 0.55);
}

.chat-tool[data-phase='running'] .chat-tool__phase {
  color: #a5622f;
}

.chat-tool[data-phase='done'] .chat-tool__phase {
  color: #3d6b4f;
}

.chat-tool[data-phase='error'] .chat-tool__phase {
  color: #a33a3a;
}

.chat-tool__args {
  margin-top: 6px;
  max-height: 72px;
}

.chat-tool__detail {
  margin-top: 6px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.msg-error {
  align-self: stretch;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 143, 143, 0.35);
  color: var(--error);
  font-size: 13px;
  line-height: 1.4;
}

.chat-input {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 235, 200, 0.14);
  background: rgba(12, 7, 20, 0.25);
}

.chat-input__field {
  flex: 1 1 auto;
  resize: none;
  max-height: 122px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 235, 200, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 14.5px;
  font-family: inherit;
  line-height: 20px;
  outline: none;
  color-scheme: light;
  overflow-y: hidden;
}

.chat-input__field--scrollable {
  overflow-y: auto;
}

.chat-input__field::placeholder {
  color: #8a7f94;
}

.chat-input__field:focus {
  border-color: var(--gold-strong);
  box-shadow: 0 0 0 3px rgba(255, 181, 103, 0.22);
}

.chat-input__field:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.chat-input__send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #2a1710;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 181, 103, 0.4);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

.chat-input__send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 181, 103, 0.5);
}

.chat-input__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.chat-input__send svg {
  width: 18px;
  height: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(280px, 42%);
  }

  .wiki-pane {
    border-right: none;
    border-bottom: 1px solid rgba(255, 235, 200, 0.14);
  }
}

@media (max-width: 640px) {
  .wiki-pane {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(120px, 32%) 1fr;
  }

  .wiki-toolbar {
    grid-column: 1;
    grid-row: 1;
  }

  .wiki-nav {
    grid-column: 1;
    grid-row: 2;
    border-bottom: 1px solid rgba(255, 235, 200, 0.1);
  }

  .wiki-article {
    grid-column: 1;
    grid-row: 3;
    padding: 16px;
  }

  .brand-sub {
    display: none;
  }
}

/* ---- Clerk auth overlay ---- */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 7, 20, 0.72);
  backdrop-filter: blur(10px);
}

.auth-overlay[hidden] {
  display: none !important;
}

/* Caption only: Clerk renders its own sign-in modal above this backdrop. */
.auth-overlay__card {
  width: min(420px, 100%);
  text-align: center;
  color: #fdf6ec;
}

.auth-overlay__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 650;
}

.auth-overlay__copy {
  margin: 0;
  color: rgba(253, 246, 236, 0.72);
  font-size: 0.95rem;
  line-height: 1.45;
}

.notion-connect {
  margin-right: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.22);
  background: transparent;
  color: #fdf6ec;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.notion-connect:hover {
  border-color: rgba(255, 207, 143, 0.55);
  color: #ffcf8f;
}

.notion-connect[data-connected="true"] {
  border-color: rgba(143, 220, 170, 0.45);
  color: #b6f0c8;
}

.auth-sign-out {
  margin-right: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 200, 0.22);
  background: transparent;
  color: #fdf6ec;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.auth-sign-out:hover {
  border-color: rgba(255, 207, 143, 0.55);
  color: #ffcf8f;
}
