:root {
  color-scheme: light dark;
  --ink: #17202a;
  --muted: #637083;
  --line: #d9e1ea;
  --paper: #ffffff;
  --soft: #f4f7f9;
  --accent: #116d6e;
  --accent-dark: #0d4f50;
  --danger: #a33b3b;
  --prompt-skill-fg: #42be65;
  --prompt-knowledge-fg: #4589ff;
}

.stream-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.work-progress__status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.work-progress__elapsed { white-space: nowrap; font-variant-numeric: tabular-nums; margin-left: auto; }
.work-progress__bar { display: block; width: 100%; height: 5px; margin-top: 14px; accent-color: var(--accent); }
.work-progress--image .bubble__content:empty { min-height: 160px; border-radius: 12px; background: linear-gradient(110deg, var(--soft) 15%, var(--line) 40%, var(--soft) 65%); background-size: 220% 100%; animation: greta-shimmer 2s linear infinite; }
.work-progress--failed .work-progress__status { color: var(--danger); }
.assistant-action.working svg { animation: greta-pulse 1s ease-in-out infinite; }
@keyframes greta-shimmer { to { background-position: -220% 0; } }
@keyframes greta-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .work-progress--image .bubble__content:empty, .assistant-action.working svg { animation: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1f5f9;
    --muted: #9aa6b2;
    --line: #34404d;
    --paper: #111820;
    --soft: #0b1117;
    --accent: #19a5a5;
    --accent-dark: #65d4d1;
    --danger: #f38b8b;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #17202a;
  --muted: #637083;
  --line: #d9e1ea;
  --paper: #ffffff;
  --soft: #f4f7f9;
  --accent: #116d6e;
  --accent-dark: #0d4f50;
  --danger: #a33b3b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1f5f9;
  --muted: #9aa6b2;
  --line: #34404d;
  --paper: #111820;
  --soft: #0b1117;
  --accent: #19a5a5;
  --accent-dark: #65d4d1;
  --danger: #f38b8b;
}

* {
  box-sizing: border-box;
}

body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body.admin-page {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 38px;
  padding: 8px 12px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* Literal colors keep startup guidance readable in legacy Office webviews. */
.startup-message {
  color: #a33b3b;
  background: #ffffff;
  padding: 10px;
  line-height: 1.5;
}

.startup-retry {
  color: #ffffff;
  background: #116d6e;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 9px 10px;
}

input::placeholder,
textarea::placeholder {
  color: #8a93a2;
  opacity: 1;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  background: #151f29;
  color: #f1f5f9;
  border-color: #465466;
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #9aa6b2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) input,
  :root:not([data-theme]) textarea,
  :root:not([data-theme]) select {
    background: #151f29;
    color: #f1f5f9;
    border-color: #465466;
  }

  :root:not([data-theme]) input::placeholder,
  :root:not([data-theme]) textarea::placeholder {
    color: #9aa6b2;
  }
}

textarea {
  min-height: 76px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.pane {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background: var(--paper);
  overflow: hidden;
}

.auth,
.chat {
  gap: 14px;
  padding: 18px;
}

.auth {
  display: grid;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
}

.mfa-enrollment {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  text-align: center;
}

.mfa-enrollment p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mfa-enrollment img {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
}

.mfa-enrollment code {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  position: relative;
}

.chat__header {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.greta-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.greta-brand__logo {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
  border-radius: 8px;
}

.header-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.realtime-button.is-connecting {
  color: var(--accent);
  animation: realtime-pulse 1.1s ease-in-out infinite;
}

.realtime-button.is-active {
  border-color: #e11d48;
  background: #e11d48;
  color: #ffffff;
}

.realtime-button.is-active:hover {
  background: #be123c;
}

.realtime-button.is-speaking {
  box-shadow: 0 0 0 4px rgb(225 29 72 / 22%);
  animation: realtime-pulse 0.85s ease-in-out infinite;
}

@keyframes realtime-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.58;
  }
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--danger);
}

.messages {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  scroll-padding-bottom: 16px;
  margin: 0;
  contain: layout paint;
}

:root[data-theme="dark"] .messages {
  background: #0d141c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .messages {
    background: #0d141c;
  }
}

.bubble {
  max-width: 95%;
  border-radius: 8px;
  padding: 10px 11px;
  line-height: 1.45;
  font-size: 14px;
}

.bubble.user {
  white-space: pre-wrap;
}

.bubble:last-child {
  margin-bottom: 2px;
}

.bubble.user {
  align-self: flex-end;
  background: #dfeff0;
}

.bubble.assistant {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  white-space: normal;
}

.bubble__content {
  display: grid;
  gap: 8px;
}

.bubble__content > * {
  margin: 0;
}

.bubble__content h2,
.bubble__content h3,
.bubble__content h4 {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.3;
}

.bubble__content ul,
.bubble__content ol {
  display: grid;
  gap: 4px;
  padding-left: 20px;
}

.bubble__content code {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef2f5;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.bubble__content pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1720;
  color: #f1f5f9;
  padding: 10px;
}

.bubble__content pre code {
  display: block;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  white-space: pre;
}

.bubble__content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bubble__content .generated-image {
  margin: 8px 0;
}

.bubble__content .generated-image img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.bubble__content th,
.bubble__content td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.bubble__content th {
  background: #eef2f5;
  font-weight: 700;
}

:root[data-theme="dark"] .bubble.user {
  background: #153c42;
}

:root[data-theme="dark"] .bubble.assistant {
  background: #151f29;
}

:root[data-theme="dark"] .bubble__content code {
  background: #1e2935;
}

:root[data-theme="dark"] .bubble__content th {
  background: #1e2935;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .bubble.user {
    background: #153c42;
  }

  :root:not([data-theme]) .bubble.assistant {
    background: #151f29;
  }

  :root:not([data-theme]) .bubble__content code {
    background: #1e2935;
  }

  :root:not([data-theme]) .bubble__content th {
    background: #1e2935;
  }
}

.assistant-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.assistant-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.assistant-action:hover,
.assistant-action.active {
  background: #eef2f5;
  color: var(--accent-dark);
}

.assistant-action.error {
  background: #fff0f0;
  color: #b42318;
}

.assistant-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

.assistant-action-status {
  flex: 1 1 auto;
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.35;
}

.assistant-action-status.error {
  color: #b42318;
}

.assistant-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.composer {
  flex: 0 0 auto;
  display: block;
  align-self: end;
  width: 100%;
  min-height: 0;
  margin: 0;
  position: relative;
  z-index: 1;
}

.prompt-shell {
  position: relative;
  min-height: 148px;
  max-height: min(248px, 42dvh);
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  padding: 18px 18px 72px;
}

.prompt-shell textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  line-height: 1.45;
  outline: none;
  resize: none;
  max-height: 132px;
  overflow-y: auto;
}

.prompt-shell textarea::placeholder {
  color: #8a93a2;
}

.prompt-editor { position: relative; }
.prompt-editor textarea,
.prompt-highlights {
  font: inherit;
  line-height: 1.45;
  letter-spacing: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 8;
}
.prompt-editor textarea { position: relative; margin: 0; }
.prompt-highlights {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--ink);
}
.prompt-editor textarea.prompt--highlighted {
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--ink);
}
.prompt-editor textarea.prompt--highlighted::placeholder {
  -webkit-text-fill-color: var(--muted);
}
.prompt-token {
  padding: 0;
  color: var(--prompt-skill-fg);
  background: transparent;
  /* Embolden without changing glyph advances: the native textarea caret and
     wrapping must stay aligned with this display-only text layer. */
  -webkit-text-stroke: 0.6px currentColor;
}
.prompt-token--knowledge {
  color: var(--prompt-knowledge-fg);
}
@media (forced-colors: active) {
  .prompt-highlights { display: none; }
  .prompt-editor textarea.prompt--highlighted {
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
    caret-color: CanvasText;
  }
}

:root[data-theme="dark"] .prompt-shell textarea::placeholder {
  color: #9aa6b2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .prompt-shell textarea::placeholder {
    color: #9aa6b2;
  }
}

.prompt-actions {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.attach-button,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  border-radius: 50%;
  padding: 0;
  font-size: 28px;
  line-height: 1;
  pointer-events: auto;
}

.attach-button {
  background: #eef2f5;
  color: var(--ink);
}

.prompt-tools { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.permission-button { display: grid; place-items: center; width: 38px; height: 38px; min-height: 38px; padding: 8px; border-radius: 50%; color: var(--muted); background: transparent; border: 1px solid var(--line); }
.permission-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.permission-button[data-mode="full"] { color: #c89618; border-color: #c89618; }
.permission-button[data-mode="auto"] { color: var(--accent); }
.excel-permission-menu { position: absolute; left: 0; bottom: 60px; z-index: 20; width: min(320px, calc(100vw - 64px)); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 8px 30px rgb(0 0 0 / 25%); }
.excel-permission-menu button { display: grid; gap: 4px; width: 100%; height: auto; min-height: 58px; text-align: left; padding: 10px 28px 10px 10px; position: relative; background: transparent; color: var(--ink); border-radius: 6px; }
.excel-permission-menu button span { font-size: 12px; color: var(--muted); font-weight: normal; line-height: 1.35; }
.excel-permission-menu button[aria-checked="true"] { background: var(--soft); }
.excel-permission-menu button[aria-checked="true"]::after { content: "✓"; position: absolute; right: 10px; top: 12px; color: var(--accent); }
.excel-agent-card { display: grid; gap: 8px; width: 100%; min-width: 0; }
.excel-agent-card > p { margin: 0; font-size: 12px; color: var(--muted); }
.excel-agent-steps { margin: 0; padding-left: 20px; font-size: 12px; display: grid; gap: 5px; }
.excel-agent-steps [data-status="done"] { color: var(--muted); }
.excel-agent-steps [data-status="waiting"] { color: var(--accent); font-weight: 700; }
.excel-agent-detail { margin: 0; max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 12px; }
.excel-agent-approval { display: flex; flex-wrap: wrap; gap: 6px; }
.excel-agent-approval button { height: auto; min-height: 34px; padding: 8px 10px; font-size: 12px; }
.excel-agent-approval button:last-child { color: var(--ink); background: var(--soft); border: 1px solid var(--line); }
.excel-functions-overlay { position: fixed; inset: 0; z-index: 50; padding: 12px; background: rgb(0 0 0 / 50%); display: flex; align-items: center; justify-content: center; }
.excel-functions-panel { width: min(100%, 540px); max-height: 95vh; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.excel-functions-panel p { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.excel-functions-panel label { display: grid; gap: 4px; font-size: 12px; }
.excel-functions-panel input, .excel-functions-panel select { min-width: 0; width: 100%; }
.excel-functions-list { min-height: 80px; overflow: auto; display: grid; gap: 6px; }
.excel-function-row { display: grid; gap: 4px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
.excel-function-row > span { font-size: 12px; color: var(--muted); }
.excel-function-row > .excel-function-policy.external { color: var(--accent); }

:root[data-theme="dark"] .attach-button {
  background: #1e2935;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .attach-button {
    background: #1e2935;
  }
}

.submit-button {
  background: var(--accent);
  color: white;
}

.submit-button.is-stopping {
  background: #ff1f1f;
  color: white;
  font-size: 23px;
  box-shadow: 0 0 0 3px rgb(255 31 31 / 20%);
}

.submit-button.is-stopping:hover {
  background: #e00000;
}

.attachment-list {
  position: absolute;
  right: 76px;
  bottom: 17px;
  left: 76px;
  display: flex;
  height: 42px;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.attachment-chip {
  display: grid;
  flex: 0 0 min(168px, 100%);
  height: 40px;
  grid-template-columns: auto minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 3px 4px;
}

.attachment-chip img {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
}

.attachment-type-icon {
  position: relative;
  display: inline-flex;
  width: 28px;
  min-width: 28px;
  height: 32px;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border-radius: 3px;
  background: #52606d;
  color: #fff;
  padding: 0 2px 4px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.attachment-type-icon::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-bottom: 1px solid rgb(255 255 255 / 45%);
  border-left: 1px solid rgb(255 255 255 / 45%);
  background: rgb(255 255 255 / 22%);
  content: "";
}

.attachment-type-icon--pdf {
  background: #c9362b;
}

.attachment-type-icon--word {
  background: #2563a9;
}

.attachment-type-icon--spreadsheet {
  background: #16784a;
}

.attachment-type-icon--presentation {
  background: #c04f23;
}

.attachment-type-icon--text {
  background: #52606d;
}

.attachment-type-icon--archive {
  background: #8a6417;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.attachment-remove:hover {
  background: var(--line);
  color: var(--ink);
}

.attachment-error {
  flex: 0 0 auto;
  color: var(--danger);
}

.intel-menu,
.command-menu {
  position: absolute;
  left: 16px;
  bottom: calc(100% + 8px);
  z-index: 10;
  display: grid;
  gap: 6px;
  min-width: 190px;
  max-width: min(280px, 90vw);
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgb(23 32 42 / 18%);
  padding: 8px;
}

.history-panel {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
}

.history-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: grid;
  gap: 3px;
  width: 100%;
  height: auto;
  min-height: 48px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.history-item span,
.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.history-item:hover {
  background: #dfeff0;
  color: var(--accent-dark);
}

.bubble-attachments {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.bubble-attachment {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 6px 8px;
  color: var(--ink);
  text-decoration: none;
}

.bubble-attachment:hover {
  border-color: var(--accent);
}

.bubble-attachment img,
.bubble-attachment .attachment-type-icon {
  width: 34px;
  height: 34px;
}

.bubble-attachment img {
  border-radius: 4px;
  object-fit: cover;
}

.bubble-attachment span {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.intel-option,
.command-option {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.command-option {
  display: grid;
  gap: 3px;
  height: auto;
  min-height: 44px;
}

.command-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
}

.intel-option {
  color: var(--prompt-knowledge-fg);
  font-weight: 700;
}
.command-option {
  color: var(--prompt-skill-fg);
  font-weight: 700;
}
.intel-option[aria-pressed="true"],
.intel-option:hover,
.intel-option.is-active,
.command-option.is-active,
.command-option:hover {
  background: var(--soft);
}

.intel-option.is-active,
.command-option.is-active {
  background: #0043ce;
  color: #fff;
  box-shadow: inset 4px 0 0 #a6c8ff;
  opacity: 1;
}
.intel-option.is-active small,
.command-option.is-active span {
  color: #fff;
}

.intel-menu__empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
}

.landing {
  background: var(--paper);
  overflow: auto;
}

.landing__main {
  display: grid;
  gap: 28px;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 20px;
}

.landing__hero,
.landing__section {
  display: grid;
  gap: 14px;
}

.landing__hero img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.landing__hero h1 {
  font-size: 36px;
}

.landing__hero p,
.landing__section p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.landing__section {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.landing__section h2 {
  margin: 0;
  font-size: 24px;
}

.manifest-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.landing__main a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--accent);
  text-decoration: none;
}

.landing__main a:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.manifest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.manifest-grid a {
  color: var(--ink);
  font-weight: 700;
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.admin-auth,
.admin-panel {
  display: grid;
  gap: 16px;
}

.admin-auth {
  max-width: 420px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  width: auto;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.admin-tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.admin-header button,
.admin-actions button:nth-child(2),
.admin-row button {
  width: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.skill-form textarea {
  min-height: 90px;
  resize: vertical;
}

.skill-modal,
.config-modal {
  width: min(760px, 100%);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-label input {
  width: auto;
}

.admin-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px 10px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pagination-controls button {
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.pagination-controls button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.pagination-summary {
  white-space: nowrap;
}

.chat-admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-admin-topbar button {
  width: auto;
}

.chat-admin-manager {
  display: grid;
  grid-template-columns: minmax(180px, 0.28fr) minmax(260px, 0.45fr) minmax(320px, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.chat-admin-head {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  padding: 8px 10px;
}

.chat-admin-head:not(:last-of-type),
.chat-admin-users,
.chat-admin-titles {
  border-right: 1px solid var(--line);
}

.chat-admin-users,
.chat-admin-titles,
.chat-admin-detail {
  min-height: 420px;
  max-height: 620px;
  overflow: auto;
  padding: 10px;
}

.chat-admin-user,
.chat-admin-title {
  display: grid;
  gap: 3px;
  width: 100%;
  height: auto;
  min-height: 40px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.chat-admin-title strong {
  font-size: 13px;
  line-height: 1.25;
}

.chat-admin-user span,
.chat-admin-title span,
.chat-admin-title small,
.chat-admin-empty,
.chat-admin-detail-header span,
.chat-admin-message header span {
  color: var(--muted);
  font-size: 12px;
}

.chat-admin-user.active,
.chat-admin-user:hover,
.chat-admin-title-row.active .chat-admin-title,
.chat-admin-title:hover {
  background: #dfeff0;
  color: var(--accent-dark);
}

.chat-admin-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.chat-title-pagination {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -10px -10px 8px;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 10px;
}

.chat-title-pagination .pagination-controls button {
  min-height: 30px;
  padding: 4px 8px;
}

.chat-admin-delete {
  width: auto;
  min-height: 34px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chat-admin-detail {
  display: grid;
  align-content: start;
  gap: 10px;
}

.chat-admin-detail-header {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.chat-admin-message {
  display: grid;
  min-width: 0;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.chat-admin-message header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chat-admin-message pre {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-admin-message-content {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.chat-admin-image {
  margin: 0;
  min-width: 0;
}

.chat-admin-image img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chat-admin-image figcaption {
  color: var(--muted);
  font-size: 13px;
}

.chat-admin-message.assistant {
  background: var(--paper);
}

.chat-admin-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-admin-attachments a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--accent-dark);
  font-size: 12px;
  text-decoration: none;
}

.chat-admin-attachments .chat-admin-image-attachment {
  display: grid;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .chat-admin-user.active,
  :root:not([data-theme]) .chat-admin-user:hover,
  :root:not([data-theme]) .chat-admin-title-row.active .chat-admin-title,
  :root:not([data-theme]) .chat-admin-title:hover {
    background: #174648;
    color: #dffefd;
  }
}

:root[data-theme="dark"] .chat-admin-user.active,
:root[data-theme="dark"] .chat-admin-user:hover,
:root[data-theme="dark"] .chat-admin-title-row.active .chat-admin-title,
:root[data-theme="dark"] .chat-admin-title:hover {
  background: #174648;
  color: #dffefd;
}

.knowledge-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.knowledge-topbar button,
.folder-actions button {
  width: auto;
  background: #176a86;
  color: #fff;
}

.skill-manager {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.skill-head {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  padding: 8px 12px;
}

.skill-head:first-child,
.skill-cell {
  border-right: 1px solid var(--line);
}

.skill-cell,
.skill-definition-cell {
  border-bottom: 1px solid var(--line);
  min-height: 190px;
  padding: 12px;
}

.skill-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 8px;
}

.skill-link {
  display: grid;
  gap: 4px;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.skill-link strong {
  font-size: 18px;
}

.skill-link span,
.skill-link small,
.skill-block p {
  color: var(--muted);
  font-size: 13px;
}

.skill-actions {
  display: grid;
  gap: 6px;
  align-content: start;
}

.skill-actions button {
  width: auto;
  height: auto;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
}

.skill-definition-cell {
  display: grid;
  gap: 14px;
}

.skill-block {
  display: grid;
  gap: 5px;
}

.skill-block h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.skill-block p,
.skill-block pre {
  margin: 0;
}

.skill-block pre {
  max-height: 140px;
  overflow: auto;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.config-manager {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.config-head {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  padding: 8px 12px;
}

.config-head:first-child,
.config-cell {
  border-right: 1px solid var(--line);
}

.config-cell,
.config-definition-cell {
  border-bottom: 1px solid var(--line);
  min-height: 150px;
  padding: 12px;
}

.config-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 8px;
}

.config-link {
  display: grid;
  gap: 4px;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.config-link strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.config-link span,
.config-link small,
.config-block p {
  color: var(--muted);
  font-size: 13px;
}

.config-actions {
  display: grid;
  gap: 6px;
  align-content: start;
}

.config-actions button {
  width: auto;
  height: auto;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
}

.config-actions button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.55;
}

.config-definition-cell {
  display: grid;
  gap: 14px;
}

.config-definition-cell.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
}

.config-block {
  display: grid;
  gap: 5px;
}

.config-block h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.config-block p {
  overflow-wrap: anywhere;
  margin: 0;
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.user-summary section {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.user-summary strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.user-summary span {
  color: var(--muted);
  font-size: 13px;
}

.user-manager {
  display: grid;
  gap: 10px;
}

.user-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.user-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.user-toolbar select {
  min-width: 180px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.user-row.is-blocked {
  border-color: var(--danger);
}

.user-main {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.user-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.user-main small,
.user-meta span {
  color: var(--muted);
  font-size: 13px;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgb(148 163 184 / 16%);
}

.connection-dot.connected {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgb(22 163 74 / 20%);
}

.user-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.user-meta strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.user-actions {
  display: flex;
  gap: 6px;
}

.user-actions button {
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.user-actions button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.55;
}

.user-actions .block {
  border-color: var(--danger);
  color: var(--danger);
}

.user-actions .unblock {
  border-color: #16a34a;
  color: #16a34a;
}

.knowledge-manager {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.knowledge-head {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  padding: 8px 12px;
}

.knowledge-head:first-child,
.knowledge-cell {
  border-right: 1px solid var(--line);
}

.knowledge-cell,
.document-cell {
  border-bottom: 1px solid var(--line);
  min-height: 160px;
  padding: 12px;
}

.knowledge-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 8px;
}

.knowledge-link {
  display: grid;
  gap: 4px;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.knowledge-link strong {
  font-size: 18px;
}

.knowledge-link span,
.folder-empty {
  color: var(--muted);
  font-size: 13px;
}

.knowledge-actions button,
.document-row button {
  width: auto;
  height: auto;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
}

.knowledge-actions {
  display: grid;
  gap: 6px;
  align-content: start;
}

.document-cell {
  display: grid;
  align-content: start;
  gap: 22px;
}

.folder-block {
  display: grid;
  gap: 8px;
}

.folder-block h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

.document-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}

.document-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #176a86;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px var(--paper);
}

.folder-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  border-top: 1px solid #176a86;
  margin-top: 8px;
  padding-top: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 55%);
  padding: 18px;
}

.admin-modal {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 20px 60px rgb(0 0 0 / 25%);
  padding: 18px;
}

.admin-modal h2 {
  color: var(--ink);
  margin: 0 0 14px;
}

.admin-modal form {
  display: grid;
  gap: 12px;
}

.admin-modal .admin-form {
  border-bottom: 0;
  padding-bottom: 0;
}

.knowledge-explorer {
  display: grid;
  grid-template-columns: minmax(210px, 0.32fr) minmax(0, 1fr);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.knowledge-sidebar {
  display: grid;
  align-content: start;
  gap: 4px;
  border-right: 1px solid var(--line);
  background: var(--soft);
  padding: 8px;
}

.knowledge-base-item,
.knowledge-tree-row {
  display: grid;
  gap: 3px;
  width: 100%;
  height: auto;
  min-height: 46px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.knowledge-base-item.active,
.knowledge-base-item:hover,
.knowledge-tree-row.active,
.knowledge-tree-row:hover {
  background: #dfeff0;
  color: var(--accent-dark);
}

.knowledge-base-item span,
.knowledge-tree-row small,
.knowledge-empty,
.knowledge-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.knowledge-browser {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background: var(--paper);
}

.knowledge-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 0.7fr) auto auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.knowledge-toolbar div {
  display: grid;
  gap: 2px;
}

.knowledge-toolbar button {
  width: auto;
}

.knowledge-tree {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  max-height: 420px;
  overflow: auto;
  padding: 8px;
}

.knowledge-tree-row {
  grid-template-columns: 22px minmax(120px, 0.35fr) minmax(0, 1fr);
  align-items: center;
}

.knowledge-tree-row span {
  color: var(--accent);
  font-weight: 700;
}

.knowledge-tree-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-tree-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.knowledge-empty {
  padding: 16px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.admin-row div {
  display: grid;
  gap: 3px;
}

.admin-row span,
.admin-row small {
  color: var(--muted);
}

@media (max-width: 420px) {
  .auth,
  .chat {
    padding: 14px;
  }

  .composer {
    display: block;
  }

  .admin-form,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .knowledge-topbar,
  .admin-pagination,
  .folder-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-manager {
    grid-template-columns: 1fr;
  }

  .knowledge-head:first-child,
  .knowledge-cell,
  .skill-head:first-child,
  .skill-cell,
  .config-head:first-child,
  .config-cell {
    border-right: 0;
  }

  .skill-manager,
  .config-manager,
  .config-definition-cell.compact,
  .user-summary,
  .user-row,
  .user-meta,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .knowledge-explorer,
  .knowledge-toolbar,
  .manifest-grid,
  .chat-admin-manager {
    grid-template-columns: 1fr;
  }

  .chat-admin-head,
  .chat-admin-users,
  .chat-admin-titles {
    border-right: 0;
  }

  .chat-admin-users,
  .chat-admin-titles,
  .chat-admin-detail {
    min-height: 0;
    max-height: 360px;
  }

  .knowledge-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
/* Shown before React only on Office WebViews without module support. */
.office-legacy-message {
  max-width: 36rem;
  margin: 10vh auto;
  padding: 1.5rem;
  line-height: 1.6;
  color: #161616;
  background: #f4f4f4;
  border-left: 4px solid #0f62fe;
}
