/*
 * NOC-AI look-and-feel layer, loaded after LibreChat's own CSS (see apply-patches.sh).
 * Pure CSS: no logos, no behaviour changes. Every rule is additive and easy to remove -
 * delete this file's <link> (or the file) and the app is stock LibreChat again.
 *
 *  1. Colour palette: a deep neutral chat surface, two shades in the sidebar (icon rail / chat
 *     list), a header that melts into the chat, and a soft blue-purple glow; dark and light.
 *  2. Phone fixes: no iOS zoom-on-focus, safe-area padding for notches / home bar,
 *     tables and code that scroll inside the message instead of widening the page,
 *     dialogs that fit the screen, comfortable tap targets.
 *  3. Welcome heading on the new-chat screen.
 *  4. Sidebar section headers (the grouped icon rail).
 *  5. Sign-in page: a few introductory lines above a box-less form.
 *  6. A skeleton shimmer used by the custom pages (.noc-skel, see Skeleton.tsx).
 *  7. Chat glass (only while <html> has class "theme-glassmorphism", set by apply-patches.sh):
 *     your question as a right-aligned pill, the answer flowing on the background with no
 *     outer box, full-width tables, a floating frosted message box, a frosted sidebar.
 *  9. Starter suggestion pills on the new-chat screen.
 * 10. Admin page frame (scrolling and shared width for the custom pages).
 * 11. Busy spinner on the sign-in Continue button.
 */

/* ---------------------------------------------------------------- 1. palette + glow */
/* A calm, decent palette: a deep neutral chat surface, a slightly different shade for each side
   of the sidebar (icon rail vs chat list), a header that melts into the chat, and a soft
   blue-purple glow in the corners. Nothing here uses a hard band or a border line. */

/* The chat area is transparent over <body>, so a background-IMAGE on body shows through
   while its colour sets the chat surface. Fixed, so it does not scroll. */
html.dark body {
  background-color: #14161d !important;
  background-image:
    radial-gradient(1000px 620px at 6% -8%, rgba(59, 130, 246, 0.22), transparent 62%),
    radial-gradient(900px 640px at 102% 106%, rgba(139, 92, 246, 0.2), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

html:not(.dark) body {
  background-color: #f5f6fb !important;
  background-image:
    radial-gradient(1000px 620px at 6% -8%, rgba(59, 130, 246, 0.14), transparent 62%),
    radial-gradient(900px 640px at 102% 106%, rgba(139, 92, 246, 0.12), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* LibreChat paints two full-size wrappers with a solid colour that hides <body>. The same colour
   is on <body> itself, so making just those two (they are the .relative ones) see-through
   changes nothing except letting the glow show. Buttons that share the class are untouched. */
.bg-presentation.relative {
  background-color: transparent;
}

/* Sidebar. Its colour comes from the variable --surface-primary-alt (also used by the fade at
   the end of long chat titles), so the variable is overridden rather than the background:
   that keeps the fades matching. The icon rail is a little deeper than the chat-list panel.
   Desktop <aside> and the phone drawer (z-[110]) share the same two shades. */
html.dark aside[aria-label],
html.dark [class*='z-[110]'] {
  --surface-primary-alt: #121835; /* chat list panel */
}
html.dark aside[aria-label] > div > div:first-child,
html.dark [class*='z-[110]'] > div:first-child {
  --surface-primary-alt: #0a0d1c; /* icon rail */
}
html.dark aside[aria-label] nav {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.04);
}

html:not(.dark) aside[aria-label],
html:not(.dark) [class*='z-[110]'] {
  --surface-primary-alt: #eef0fb; /* chat list panel */
}
html:not(.dark) aside[aria-label] > div > div:first-child,
html:not(.dark) [class*='z-[110]'] > div:first-child {
  --surface-primary-alt: #e1e6f7; /* icon rail */
}

/* Top toolbar of the chat: no colour band and no border. It only fades from the chat colour
   to transparent so messages scrolling underneath it stay readable. */
html.dark div[class*='h-[52px]'][class*='absolute'][class*='z-10'] {
  background-image: linear-gradient(
    180deg,
    #14161d 0%,
    rgba(20, 22, 29, 0.92) 50%,
    rgba(20, 22, 29, 0) 100%
  ) !important;
  border: 0 !important;
  backdrop-filter: none !important;
}
html:not(.dark) div[class*='h-[52px]'][class*='absolute'][class*='z-10'] {
  background-image: linear-gradient(
    180deg,
    #f5f6fb 0%,
    rgba(245, 246, 251, 0.92) 50%,
    rgba(245, 246, 251, 0) 100%
  ) !important;
  border: 0 !important;
  backdrop-filter: none !important;
}

/* ------------------------------------------------------------------------ 2. phone fixes */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Wide content scrolls inside its own box instead of pushing the whole page sideways. */
.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.markdown pre {
  max-width: 100%;
  overflow-x: auto;
}
.markdown img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  /* iOS zooms into any input below 16px and never zooms back out. */
  #prompt-textarea,
  input[type='text'],
  input[type='search'],
  input[type='email'],
  input[type='password'],
  textarea {
    font-size: 16px;
  }

  /* The message box: breathing room at the sides, clear of the iPhone home bar / notch. */
  form:has(#prompt-textarea) {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  /* A long message must not push the input off the screen. */
  #prompt-textarea {
    max-height: 40vh;
  }

  /* Side drawer (chat list) and its footer clear the home bar. */
  nav {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Dialogs (Settings, Agent Builder...) fit the screen with a small margin. */
  [role='dialog'] {
    max-width: calc(100vw - 16px);
  }

  /* The top toolbar scrolls sideways inside itself rather than overflowing the page. */
  div[class*='h-[52px]'][class*='absolute'][class*='z-10'] {
    max-width: 100vw;
  }
}

/* Touch screens: a bit more room to tap. */
@media (pointer: coarse) {
  nav a,
  nav button {
    min-height: 40px;
  }
}

/* ------------------------------------------------------------------ 3. welcome heading */
.noc-welcome {
  margin-bottom: 1.25rem;
  max-width: 34rem;
}
.noc-welcome-title {
  margin: 0;
  font-size: clamp(1.15rem, 0.95rem + 1vw, 1.55rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  background-image: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #a78bfa; /* fallback if text-clip is unsupported */
}
.noc-welcome-sub {
  margin: 0.5rem 0 0;
  font-size: clamp(0.9rem, 0.82rem + 0.3vw, 1rem);
  color: var(--text-secondary, #9ca3af);
}

/* ------------------------------------------------------------ 4. sidebar section headers */
.noc-nav-group-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin-top: 6px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary, #8b93a7);
}
.noc-nav-group-head svg {
  width: 10px;
  height: 10px;
}
.noc-nav-group-head:hover {
  color: var(--text-primary, #fff);
}
.noc-nav-group-head:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 1px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------- 5. sign-in page */
/* Clean and quiet: a soft gradient background, a few introductory lines, and the sign-in form
   with no box around it. */
.noc-auth-root {
  background-color: #f5f6fb;
  background-image:
    radial-gradient(900px 560px at 5% -10%, rgba(59, 130, 246, 0.12), transparent 62%),
    radial-gradient(800px 560px at 100% 105%, rgba(139, 92, 246, 0.1), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
.dark .noc-auth-root {
  background-color: #12141b;
  background-image:
    radial-gradient(900px 560px at 5% -10%, rgba(59, 130, 246, 0.18), transparent 62%),
    radial-gradient(800px 560px at 100% 105%, rgba(139, 92, 246, 0.16), transparent 64%);
}

.noc-auth-main {
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1rem 2.5rem;
}

/* The form: no box, no border, no shadow, no panel colour. */
.noc-auth-card {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* The introduction above the form. No box either. */
.noc-auth-panel {
  width: 100%;
  max-width: 26rem;
  padding: 0 0.5rem;
  text-align: center;
  color: #1e293b;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.dark .noc-auth-panel {
  color: #dbe4f3;
}
.noc-auth-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6366f1;
}
.dark .noc-auth-eyebrow {
  color: #a5b4fc;
}
.noc-auth-title {
  margin: 0;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.noc-auth-lead {
  margin: 0.75rem auto 0;
  font-size: 1rem;
  line-height: 1.65;
  opacity: 0.92;
}

/* Browser-autofilled fields: the floating label stays lifted instead of sitting on top of the
   filled-in value (autofill does not clear the placeholder-shown state the label relies on). */
.noc-auth-root input:-webkit-autofill ~ label,
.noc-auth-root input:autofill ~ label {
  top: 0.375rem;
  transform: translateY(-1rem) scale(0.75);
}

/* Theme button: top-right, a little larger, quiet until hovered. */
.noc-auth-root div.absolute.bottom-0.left-0 {
  top: 0;
  right: 0;
  bottom: auto;
  left: auto;
}
.noc-auth-root div.absolute.bottom-0.left-0 button {
  padding: 0.65rem;
  opacity: 0.75;
  transition:
    opacity 0.25s ease,
    background-color 0.25s ease;
}
.noc-auth-root div.absolute.bottom-0.left-0 button:hover {
  opacity: 1;
}
.noc-auth-root div.absolute.bottom-0.left-0 svg {
  width: 1.4rem;
  height: 1.4rem;
}

/* Soft entrance: the intro and the form fade up a few pixels, one after the other. */
@keyframes noc-auth-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.noc-auth-panel {
  animation: noc-auth-rise 0.6s ease-out both;
}
.noc-auth-card {
  animation: noc-auth-rise 0.6s ease-out 0.12s both;
}
.noc-auth-root button[type='submit'] {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}
.noc-auth-root button[type='submit']:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.18);
}
.noc-auth-root button[type='submit']:active:not(:disabled) {
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .noc-auth-panel,
  .noc-auth-card {
    animation: none;
  }
  .noc-auth-root button[type='submit'] {
    transition: none;
  }
  .noc-auth-root button[type='submit']:hover:not(:disabled) {
    transform: none;
  }
}

/* ------------------------------------------------------------------------- 6. skeletons */
@keyframes noc-skel-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.noc-skel {
  border-radius: 8px;
  background-color: rgba(127, 127, 127, 0.16);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(127, 127, 127, 0.18) 45%,
    rgba(139, 92, 246, 0.14) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: noc-skel-shimmer 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .noc-skel {
    animation: none;
  }
}

/* ------------------------------------------------------------------------ 7. chat glass */
/* Looks only: no element is added, moved out of the page or hidden. Every rule needs the
   class "theme-glassmorphism" on <html>, which apply-patches.sh adds (NOC_GLASS_THEME=on).
   Switch it off there, or delete this section, and the chat is the plain look again.
   LibreChat v0.8.7 marks each message .user-turn (you) or .agent-turn (the AI). */

/* Your question: a right-aligned translucent pill. */
.theme-glassmorphism .user-turn > h2 {
  text-align: right;
}
.theme-glassmorphism .user-turn .message-content {
  width: fit-content;
  max-width: min(85%, 42rem);
  margin-left: auto;
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  overflow-wrap: anywhere;
}
html.dark.theme-glassmorphism .user-turn .message-content {
  background-color: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.3);
  backdrop-filter: blur(12px);
  color: #fff;
}
html:not(.dark).theme-glassmorphism .user-turn .message-content {
  background-color: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.theme-glassmorphism .user-turn > .gap-1 > div:last-child {
  justify-content: flex-end;
}

/* The AI answer: tool steps flow on the background, with a little more space between
   blocks. The answer text itself gets a frosted card in section 8. */
.theme-glassmorphism .agent-turn .text-message {
  gap: 1rem;
}

/* Tables in answers. LibreChat puts each table in .markdown-table-wrapper, which already
   scrolls sideways, so the table itself can fill the full width (header and rows line up
   with the frame). Quiet uppercase header, hairline rows, aligned digits. */
.theme-glassmorphism .markdown .markdown-table-wrapper > table {
  display: table;
  width: 100%;
  margin: 0.25rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.theme-glassmorphism .markdown table th,
.theme-glassmorphism .markdown table td {
  padding: 0.75rem 1rem;
  border: 0;
  text-align: left;
  vertical-align: top;
}
.theme-glassmorphism .markdown table th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.theme-glassmorphism .markdown table tbody tr {
  transition: background-color 0.15s ease;
}
html.dark.theme-glassmorphism .markdown table {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.02);
}
html.dark.theme-glassmorphism .markdown table th {
  color: #94a3b8;
  background-color: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
html.dark.theme-glassmorphism .markdown table tbody tr:not(:last-child) td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
html.dark.theme-glassmorphism .markdown table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}
html:not(.dark).theme-glassmorphism .markdown table {
  border: 1px solid rgba(15, 23, 42, 0.1);
}
html:not(.dark).theme-glassmorphism .markdown table th {
  color: #64748b;
  background-color: rgba(15, 23, 42, 0.03);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}
html:not(.dark).theme-glassmorphism .markdown table tbody tr:not(:last-child) td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
html:not(.dark).theme-glassmorphism .markdown table tbody tr:hover {
  background-color: rgba(15, 23, 42, 0.03);
}

/* The message box: a floating frosted bar, same buttons in the same places. The violet
   temporary-chat colour is left alone so that mode stays easy to spot. */
html.dark.theme-glassmorphism form:has(#prompt-textarea) .rounded-t-3xl.border:not([class*='violet']) {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}
@media (min-width: 640px) {
  .theme-glassmorphism form:has(#prompt-textarea) .rounded-t-3xl.border {
    border-radius: 1rem;
  }
}

/* Sidebar (chat history and icon rail): frosted, so the background glow shows through.
   Only the sidebar's colour variables change (section 1 sets them solid), so everything
   that uses them, buttons and hover states included, follows. The phone drawer (z-[110])
   stays more opaque because the chat sits right behind it. */
html.dark.theme-glassmorphism aside[aria-label] {
  --surface-primary-alt: rgba(18, 24, 53, 0.45);
  --surface-active-alt: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
}
html.dark.theme-glassmorphism aside[aria-label] > div > div:first-child {
  --surface-primary-alt: rgba(10, 13, 28, 0.6);
}
html.dark.theme-glassmorphism [class*='z-[110]'] {
  --surface-primary-alt: rgba(18, 24, 53, 0.85);
  --surface-active-alt: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}
html.dark.theme-glassmorphism [class*='z-[110]'] > div:first-child {
  --surface-primary-alt: rgba(10, 13, 28, 0.9);
}
/* Long chat titles: LibreChat fades their end with a solid-colour overlay, which shows as a
   block on a see-through panel. Fade the title text itself instead. */
.theme-glassmorphism aside[aria-label] nav [class*='bg-gradient-to-l'][class*='from-surface-primary-alt'],
.theme-glassmorphism [class*='z-[110]'] nav [class*='bg-gradient-to-l'][class*='from-surface-primary-alt'] {
  background-image: none;
}
.theme-glassmorphism aside[aria-label] nav .whitespace-nowrap:has(> [class*='bg-gradient-to-l']),
.theme-glassmorphism [class*='z-[110]'] nav .whitespace-nowrap:has(> [class*='bg-gradient-to-l']) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}

/* ------------------------------------------------- 8. answer types: accent bar + label */
/* Each AI answer text sits on a frosted card with a 3px coloured bar on the left and a small
   label on top, so the kind of answer can be told apart at a glance. The kind is read from
   what the answer contains (CSS :has), nothing in the page is changed:
     download link to /files/  -> purple  "Document"
     code block (logs/traces)  -> amber   "Log analysis"
     table                     -> cyan    "Data table"
     anything else             -> emerald "Fleet intelligence"
   When an answer has more than one, the later rule wins (document > logs > table).
   Same switch as section 7: needs the theme-glassmorphism class on <html>. Colour names are
   --noc-* so they never clash with LibreChat's own variables (it already uses --text-primary). */
html.theme-glassmorphism {
  --noc-glass: rgba(255, 255, 255, 0.7);
  --noc-glass-border: rgba(0, 0, 0, 0.06);
  --noc-glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 28px -4px rgba(99, 102, 241, 0.08);
  --noc-emerald: #059669;
  --noc-cyan: #0891b2;
  --noc-amber: #d97706;
  --noc-purple: #7c3aed;
}
html.dark.theme-glassmorphism {
  --noc-glass: rgba(18, 19, 24, 0.65);
  --noc-glass-border: rgba(255, 255, 255, 0.08);
  --noc-glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 32px -4px rgba(0, 0, 0, 0.35);
  --noc-emerald: #10b981;
  --noc-cyan: #06b6d4;
  --noc-amber: #f59e0b;
  --noc-purple: #a855f7;
}

.theme-glassmorphism .agent-turn .markdown.message-content:not(:empty) {
  --noc-accent: var(--noc-emerald);
  --noc-label: 'Fleet intelligence';
  position: relative;
  padding: 2.4rem 1.25rem 1rem 1.4rem;
  border-radius: 1rem;
  border: 1px solid var(--noc-glass-border);
  background-color: var(--noc-glass);
  box-shadow: var(--noc-glass-shadow);
  backdrop-filter: blur(16px) saturate(170%);
}
/* the coloured bar */
.theme-glassmorphism .agent-turn .markdown.message-content:not(:empty)::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  border-radius: 3px;
  background-color: var(--noc-accent);
  pointer-events: none;
}
/* the label */
.theme-glassmorphism .agent-turn .markdown.message-content:not(:empty)::before {
  content: var(--noc-label);
  position: absolute;
  top: 0.7rem;
  left: 1.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: pre;
  color: var(--noc-accent);
  pointer-events: none;
}
.theme-glassmorphism .agent-turn .markdown.message-content:has(table) {
  --noc-accent: var(--noc-cyan);
  --noc-label: 'Data table';
}
.theme-glassmorphism .agent-turn .markdown.message-content:has(pre) {
  --noc-accent: var(--noc-amber);
  --noc-label: 'Log analysis';
}
.theme-glassmorphism .agent-turn .markdown.message-content:has(a[href*='/files/']) {
  --noc-accent: var(--noc-purple);
  --noc-label: 'Document';
}
@media (max-width: 639px) {
  .theme-glassmorphism .agent-turn .markdown.message-content:not(:empty) {
    padding: 2.3rem 0.9rem 0.85rem 1.1rem;
  }
  .theme-glassmorphism .agent-turn .markdown.message-content:not(:empty)::before {
    left: 1.1rem;
  }
}

/* Download / Open links of generated files: plain purple links, no button or box.
   The AI sometimes wraps the two links in a small table; that table loses its frame,
   empty header row and cell padding, so it reads as one line of links. */
.theme-glassmorphism .agent-turn .markdown a[href*='/files/'] {
  font-weight: 500;
  text-decoration: none;
  color: var(--noc-purple);
}
.theme-glassmorphism .agent-turn .markdown a[href*='/files/']:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
html.theme-glassmorphism .agent-turn .markdown table:has(a[href*='/files/']),
html.theme-glassmorphism .agent-turn .markdown table:has(a[href*='/files/']) tbody {
  display: block;
  width: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}
html.theme-glassmorphism .agent-turn .markdown table:has(a[href*='/files/']) thead:not(:has(th:not(:empty))) {
  display: none;
}
html.theme-glassmorphism .agent-turn .markdown table:has(a[href*='/files/']) tbody tr {
  display: flex;
  gap: 1.25rem;
  background: transparent;
}
html.theme-glassmorphism .agent-turn .markdown table:has(a[href*='/files/']) tbody tr td {
  padding: 0;
  border: 0;
}

/* Code blocks (logs, traces) get an amber line on the left; short inline codes (error
   codes, file names) a small mono pill in the answer's colour. */
.theme-glassmorphism .agent-turn .markdown pre {
  border-left: 2px solid var(--noc-amber);
}
.theme-glassmorphism .agent-turn .markdown :not(pre) > code {
  padding: 0.1rem 0.4rem;
  border-radius: 0.375rem;
  font-size: 0.85em;
  background-color: color-mix(in srgb, var(--noc-accent, var(--noc-emerald)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--noc-accent, var(--noc-emerald)) 20%, transparent);
}
.theme-glassmorphism .agent-turn .markdown :not(pre) > code::before,
.theme-glassmorphism .agent-turn .markdown :not(pre) > code::after {
  content: none;
}

/* Tables: cyan-tinted header and soft zebra rows. */
html.theme-glassmorphism .agent-turn .markdown table th {
  color: var(--noc-cyan);
}
html.theme-glassmorphism .agent-turn .markdown table tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--noc-cyan) 4%, transparent);
}

/* Message box in light mode: frosted too (dark mode is in section 7), and a soft glow ring
   while typing, in both modes. */
html:not(.dark).theme-glassmorphism form:has(#prompt-textarea) .rounded-t-3xl.border:not([class*='violet']) {
  background-color: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 12px 32px -12px rgba(99, 102, 241, 0.18);
}
.theme-glassmorphism form:has(#prompt-textarea:focus) .rounded-t-3xl.border:not([class*='violet']) {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--noc-purple) 18%, transparent), 0 20px 40px -12px rgba(0, 0, 0, 0.35);
}

/* ------------------------------------------------------------ 9. starter suggestions */
/* Four quiet pills under the welcome line (see the new-chat patch in apply-patches.sh). A click
   only fills the message box; nothing is sent until the user presses send. */
.noc-starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 34rem;
  animation: noc-starter-rise 0.5s ease-out 0.15s both;
}
.noc-starter {
  padding: 0.4rem 0.85rem;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary, #9ca3af);
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.noc-starter:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
  color: var(--text-primary, #fff);
  border-color: color-mix(in srgb, currentColor 28%, transparent);
}
.noc-starter:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}
@keyframes noc-starter-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .noc-starters {
    animation: none;
  }
  .noc-starter {
    transition: none;
  }
}

/* ------------------------------------------------------------------ 10. admin page frame */
/* Knowledge Bases, LLM Routing and LLM Usage sit inside LibreChat's page area, which is
   overflow-hidden, so anything below the fold was cut off (Sessions fixes this in its own
   markup). .noc-page makes the page itself the scroll container, full width so the scrollbar
   sits at the window edge, and gives all four admin pages the same content width as Sessions. */
.noc-page {
  box-sizing: border-box;
  height: 100%;
  max-width: none !important;
  margin: 0 !important;
  overflow-y: auto;
  padding: 1.5rem max(1.5rem, calc((100% - 72rem) / 2)) 2.5rem !important;
}

/* ---------------------------------------------------------------- 11. sign-in button spinner */
/* While the Continue button is busy (disabled), show a small ring beside its label. Skipped when
   LibreChat has already put its own spinner inside the button. Captcha is not enabled here, so
   the button is only disabled while a sign-in is in progress. */
@keyframes noc-spin {
  to {
    transform: rotate(360deg);
  }
}
.noc-auth-root button[type='submit']:disabled:not(:has(svg))::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.6rem;
  vertical-align: -0.2em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: noc-spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .noc-auth-root button[type='submit']:disabled:not(:has(svg))::after {
    animation: none;
  }
}
