/* ============================================================================
   Product layer — the finishing rules that sit over app.css.

   Principles (deliberately the opposite of the "AI look"):
     • Flat, solid surfaces. No gradients, glows, blur, aurora or gradient text.
     • Hairline borders define structure; shadows exist only on floating layers
       (menus, popovers, dialogs), never on content.
     • One accent, spent on interactive state (primary action, focus, selection, links),
       never on decoration. The user's own messages are a neutral surface.
     • Typography carries the hierarchy: the platform's own UI face, clear headings, tabular
       numbers. Fonts, text sizes and long-form rhythm are typography.css.
   ========================================================================= */

/* ── Typography (chrome) ──────────────────────────────────────────────────
   The font stacks and everything inside an answer are declared in typography.css, which loads
   last. This sets only the interface's base size. */

:where(.sm-root, .sm-scope) {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:where(.sm-root, .sm-scope) :is(h1, h2, h3, h4),
.sm-empty__title,
.sm-header__title,
.sm-approval__title { font-family: var(--font-heading); letter-spacing: -0.01em; }

/* Numbers line up wherever they are compared. */
.sm-prose table, .sm-comparison, .sm-message__meta, .sm-session__meta,
.sm-usage, .sm-approval__expiry, .sm-sidebar__count { font-variant-numeric: tabular-nums; }

:where(.sm-root, .sm-scope) :is(code, pre, kbd), .sm-approval__code, .sm-approval__pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

/* ── Chrome: solid, hairline-separated ────────────────────────────────── */

.sm-root { background: var(--background); }

.sm-header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sm-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sm-sidebar__brand { border-bottom-color: var(--sidebar-border); }

/* Monogram mark: a solid square carrying the product initial. */
.sm-sidebar__brand-mark {
  background: var(--foreground);
  color: var(--background);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  box-shadow: none;
}
.sm-profile__avatar { background: var(--muted); color: var(--foreground); border: 1px solid var(--border); }

/* ── Composer ─────────────────────────────────────────────────────────── */

.sm-composer {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  backdrop-filter: none;
}
.sm-composer:focus-within {
  border-color: color-mix(in srgb, var(--foreground) 28%, var(--border));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
.sm-composer--busy { border-color: var(--border); }

.sm-composer__send:not(.sm-composer__send--stop) {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: none;
}
.sm-composer__send:disabled { background: var(--muted); color: var(--muted-foreground); opacity: 1; }
.sm-composer__send:not(:disabled):hover { transform: none; filter: brightness(0.94); }
.sm-composer__send--stop { background: var(--foreground); color: var(--background); }

.sm-button--primary { background: var(--primary); color: var(--primary-foreground); box-shadow: none; }
.sm-button--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 90%, var(--foreground)); }

/* ── Messages ─────────────────────────────────────────────────────────── */

/* The user's turn is a quiet neutral surface, not a brand-coloured bubble. */
.sm-bubble-user {
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: none;
}

/* Answers read as full-width text: no avatar column. */
.sm-row--assistant { gap: 0; }
.sm-row--assistant .sm-message { max-width: 100%; }

.sm-caret { display: none; }

.sm-thinking__pulse { background: var(--muted-foreground); }
.sm-thinking__pulse::after { display: none; }
.sm-thinking__pulse { animation: sm-pulse 1.2s ease-in-out infinite; }

/* ── Content surfaces: border only ────────────────────────────────────── */

/* Rich blocks in an answer (artifacts and charts, diagrams, code, tables) share one frame so they
   read as part of the text, not widgets on top of it: the table's radius, a hairline, no shadow,
   no hover reaction. Charts and diagrams sit on the message background; code keeps its well and
   tables their header row. style-studio.css swaps the radius. */
:root { --block-radius: calc(var(--radius) + 2px); --block-border: var(--border); }

.sm-artifact,
.sm-code,
.sm-mermaid,
.sm-prose__table-wrap {
  border: 1px solid var(--block-border);
  border-radius: var(--block-radius);
  box-shadow: none;
  transform: none;
}
.sm-artifact,
.sm-mermaid { background: transparent; }
/* A collapsed table cannot round its corners: the wrapper carries the frame and clips. */
.sm-prose__table-wrap table { border: 0; border-radius: 0; }
.sm-approval { background: var(--card); border: 1px solid var(--border); box-shadow: none; transform: none; }

/* Floating layers are the only elevated elements. */
.sm-menu,
.sm-theme-panel,
.sm-usage__panel {
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.10);
}
html.dark .sm-menu,
html.dark .sm-theme-panel,
html.dark .sm-usage__panel { box-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45); }

.sm-scroll-bottom { box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 12px rgb(0 0 0 / 0.08); }

/* ── Welcome ──────────────────────────────────────────────────────────── */

.sm-empty { align-items: flex-start; text-align: left; max-width: 44rem; padding-top: 18vh; }
.sm-empty__mark { display: none; }
.sm-empty__title { font-size: 1.625rem; font-weight: 600; color: var(--foreground); background: none; }
.sm-empty__body { margin-top: 0.4rem; font-size: 0.9375rem; }
.sm-empty__suggestions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem;
  width: 100%; max-width: none; margin-top: 1.75rem; justify-content: stretch;
}
.sm-suggestion {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); box-shadow: none; backdrop-filter: none;
  text-align: left; font-size: 0.8125rem; color: var(--foreground);
}
.sm-suggestion svg { flex-shrink: 0; color: var(--muted-foreground); }
.sm-suggestion:hover { transform: none; background: var(--muted); border-color: var(--border); box-shadow: none; }
@media (max-width: 640px) { .sm-empty__suggestions { grid-template-columns: 1fr; } }

/* ── Sidebar ──────────────────────────────────────────────────────────────
   The chat-history idiom (ChatGPT, Claude, Linear): 32px rows carrying the title only, sentence-
   case recency headings, a ghost row for New chat with its shortcut, actions that overlay the end
   of the title on hover instead of permanently reserving space, and a brand row that lines up
   with the 56px header so the two hairlines meet. */

.sm-sidebar { --sm-sidebar-width: 16.5rem; --sm-sidebar-width-collapsed: 3.25rem; color: var(--sidebar-foreground, var(--foreground)); }
.sm-sidebar__brand { height: 3.5rem; padding: 0 0.5rem 0 0.75rem; gap: 0.6rem; border-bottom: 1px solid var(--sidebar-border); }
.sm-sidebar__brand-mark { width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }
.sm-sidebar__brand-title { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.sm-sidebar__brand-subtitle { font-size: 0.75rem; line-height: 1.3; }
.sm-sidebar--collapsed .sm-sidebar__brand { justify-content: center; padding: 0; }
.sm-sidebar--collapsed .sm-sidebar__brand-mark { display: none; }
.sm-sidebar--collapsed .sm-icon-button--push { margin: 0; }

.sm-sidebar__toolbar { gap: 0.25rem; padding: 0.625rem 0.5rem 0.25rem; }
.sm-sidebar__toolbar--flush { padding-top: 0.125rem; padding-bottom: 0.5rem; }
.sm-sidebar--collapsed .sm-sidebar__toolbar { justify-content: center; padding: 0.625rem 0 0.125rem; }

.sm-sidebar__new-chat {
  display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; height: 2.125rem; padding: 0 0.6rem;
  border: 0; border-radius: calc(var(--radius) - 2px); background: transparent;
  color: var(--foreground); font-size: 0.8125rem; font-weight: 500; cursor: pointer;
  transition: background-color 120ms ease;
}
.sm-sidebar__new-chat:hover { background: var(--sidebar-accent); }
.sm-sidebar__new-chat:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sm-sidebar__new-chat .sm-kbd { margin-left: auto; opacity: 0; transition: opacity 120ms ease; }
.sm-sidebar__new-chat:hover .sm-kbd,
.sm-sidebar__new-chat:focus-visible .sm-kbd { opacity: 1; }
.sm-sidebar--collapsed .sm-sidebar__new-chat { flex: 0 0 auto; width: 2.25rem; height: 2.25rem; padding: 0; justify-content: center; }
.sm-sidebar__toolbar .sm-icon-button--lg { width: 2.125rem; height: 2.125rem; border: 0; background: transparent; }
.sm-sidebar__toolbar .sm-icon-button--lg:hover { background: var(--sidebar-accent); }

.sm-sidebar__search {
  height: 2rem; padding: 0 0.4rem 0 0.6rem; gap: 0.45rem;
  border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--sidebar-accent) 70%, transparent); color: var(--muted-foreground);
}
.sm-sidebar__search:focus-within { border-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); background: var(--background); box-shadow: none; }
.sm-sidebar__search input { font-size: 0.8125rem; }
.sm-sidebar__search input::placeholder { color: var(--muted-foreground); }
.sm-sidebar__search input:focus-visible { outline: none; }
.sm-sidebar__search input::-webkit-search-cancel-button { display: none; }

.sm-kbd {
  display: inline-flex; align-items: center; height: 1.125rem; padding: 0 0.3rem; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 4px; background: var(--background);
  color: var(--muted-foreground); font-family: var(--font-sans); font-size: 0.6875rem; font-weight: 500;
  line-height: 1; white-space: nowrap;
}

.sm-sidebar__rail { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0 0 0.5rem; }
.sm-icon-button--rail { width: 2.25rem; height: 2.25rem; }
.sm-icon-button--rail:hover { background: var(--sidebar-accent); }

.sm-sidebar__scroll { padding: 0.25rem 0.5rem 0.75rem; overflow-x: hidden; }
.sm-sidebar__section + .sm-sidebar__section { margin-top: 0.875rem; }
.sm-sidebar__heading {
  margin: 0; padding: 0.25rem 0.6rem 0.3rem;
  font-family: var(--font-sans); font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--muted-foreground);
}
.sm-sidebar__list { margin: 0; padding: 0; list-style: none; }
.sm-sidebar__list--nested { padding-left: 0.75rem; }

.sm-sidebar__group-head { padding: 0; gap: 0; }
.sm-sidebar__group-toggle {
  gap: 0.5rem; height: 2rem; padding: 0 0.6rem; border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--foreground);
}
.sm-sidebar__group-toggle:hover { background: var(--sidebar-accent); }
.sm-sidebar__group-toggle svg { flex-shrink: 0; color: var(--muted-foreground); }
.sm-sidebar__count { margin-left: auto; font-size: 0.75rem; font-weight: 400; color: var(--muted-foreground); opacity: 1; }
.sm-sidebar__group-head .sm-session__actions { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); }
.sm-sidebar__group-head:hover .sm-sidebar__count,
.sm-sidebar__group-head:focus-within .sm-sidebar__count { visibility: hidden; }
.sm-sidebar__empty { margin: 0.5rem 0.6rem; font-size: 0.8125rem; }
.sm-sidebar__empty--group { margin: 0.1rem 0.6rem 0.4rem 1.35rem; font-size: 0.75rem; font-style: normal; }

.sm-session {
  position: relative; display: flex; align-items: center; gap: 0; height: 2rem; padding: 0;
  border: 0; border-radius: calc(var(--radius) - 2px); background: transparent;
}
.sm-session + .sm-session { margin-top: 1px; }
.sm-session__select { height: 100%; padding: 0 0.6rem; gap: 0.5rem; border-radius: inherit; }
.sm-session__select:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sm-session__title {
  display: block; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: clip;
  font-size: 0.8125rem; font-weight: 400; line-height: 1.25; color: color-mix(in srgb, var(--foreground) 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
}
.sm-session:not(.sm-session--active):hover { background: color-mix(in srgb, var(--sidebar-accent) 70%, transparent); }
.sm-session--active { background: var(--sidebar-accent); border-color: transparent; }
.sm-session--active::before { display: none; }
.sm-session--active .sm-session__title { color: var(--foreground); font-weight: 500; }

/* Hover / focus / open menu: the actions sit over the end of the title, which fades out under them. */
.sm-session__actions {
  position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 0.125rem; opacity: 0; pointer-events: none;
}
.sm-session:hover .sm-session__actions,
.sm-session:focus-within .sm-session__actions,
.sm-session--engaged .sm-session__actions,
.sm-session--running .sm-session__actions,
.sm-session--suspended .sm-session__actions { opacity: 1; pointer-events: auto; }
.sm-session:hover .sm-session__title,
.sm-session:focus-within .sm-session__title,
.sm-session--running .sm-session__title,
.sm-session--suspended .sm-session__title {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 3.25rem), transparent calc(100% - 1.75rem));
  mask-image: linear-gradient(to right, #000 calc(100% - 3.25rem), transparent calc(100% - 1.75rem));
}
.sm-session--engaged .sm-session__title {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 7rem), transparent calc(100% - 5.5rem));
  mask-image: linear-gradient(to right, #000 calc(100% - 7rem), transparent calc(100% - 5.5rem));
}
.sm-session .sm-icon-button { width: 1.5rem; height: 1.5rem; }
.sm-session .sm-icon-button:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); }

/* The row's "…" is also its run indicator. Idle it is a plain menu trigger. While the session runs
   it shows an 8px 3×3 matrix (the size of a status dot) with a lit band sweeping diagonally across
   it, assistant-ui's GenerationLoader in miniature; while it waits for an approval the matrix holds
   still in amber. Hover, keyboard focus or an open menu turn it back into the "…" trigger, in place,
   so nothing ever overlaps it. Only keyboard focus (:focus-visible), not :focus-within: clicking a
   row leaves focus on it, and the selected session must keep showing its run. */
.sm-dots { display: inline-flex; align-items: center; gap: 2px; }
.sm-dots > span { width: 3px; height: 3px; border-radius: 999px; background: currentColor; }
.sm-run-indicator { display: inline-grid; flex-shrink: 0; grid-template-columns: repeat(3, 2px); grid-auto-rows: 2px; gap: 1px; }
.sm-run-indicator > span { border-radius: 0.5px; background: currentColor; }
.sm-run-indicator--running { color: var(--foreground); }
.sm-run-indicator--suspended { color: hsl(38 92% 50%); }
.sm-run-indicator--running > span { animation: sm-matrix-band 720ms step-end infinite; }
.sm-run-indicator--running > span:is(:nth-child(2), :nth-child(4)) { animation-delay: -600ms; }
.sm-run-indicator--running > span:is(:nth-child(3), :nth-child(5), :nth-child(7)) { animation-delay: -480ms; }
.sm-run-indicator--running > span:is(:nth-child(6), :nth-child(8)) { animation-delay: -360ms; }
.sm-run-indicator--running > span:nth-child(9) { animation-delay: -240ms; }
/* In a session row the matrix replaces the "…" only while the row is at rest (rules below). */
.sm-session .sm-matrix { display: none; }
.sm-session--running:not(:hover):not(:has(:focus-visible)):not(.sm-session--engaged) .sm-dots,
.sm-session--suspended:not(:hover):not(:has(:focus-visible)):not(.sm-session--engaged) .sm-dots { display: none; }
.sm-session--running:not(:hover):not(:has(:focus-visible)):not(.sm-session--engaged) .sm-matrix,
.sm-session--suspended:not(:hover):not(:has(:focus-visible)):not(.sm-session--engaged) .sm-matrix { display: grid; }
/* The band: one 120 ms step per diagonal (row + column = 0…4), six steps per sweep, so each cell
   is lit, then fades over two steps, then rests. Negative delays start every cell mid-sweep. */
@keyframes sm-matrix-band {
  0% { opacity: 1; }
  16.666% { opacity: 0.55; }
  33.333% { opacity: 0.28; }
  50% { opacity: 0.14; }
}
/* Reduced motion: the matrix stands still and keeps its colour. */
@media (prefers-reduced-motion: reduce) {
  .sm-run-indicator > span { animation: none !important; }
}
.sm-session .sm-session__rename { height: 1.75rem; margin: 0 0.15rem; }
.sm-session .sm-menu { top: calc(100% + 2px); right: 0; }
.sm-session .sm-menu[data-side="top"] { top: auto; bottom: calc(100% + 2px); }

.sm-sidebar__footer { padding: 0.5rem; border-top: 1px solid var(--sidebar-border); }
.sm-profile { gap: 0.6rem; padding: 0.35rem 0.4rem; border-radius: calc(var(--radius) - 2px); }
.sm-profile__avatar { width: 1.75rem; height: 1.75rem; font-size: 0.6875rem; font-weight: 600; border-radius: 999px; }
.sm-profile__name { font-size: 0.8125rem; font-weight: 500; line-height: 1.25; }
.sm-profile__role { font-size: 0.75rem; line-height: 1.3; }
.sm-sidebar--collapsed .sm-profile { justify-content: center; padding: 0.35rem 0; }

/* ── Small finishing rules ────────────────────────────────────────────── */

:where(.sm-root, .sm-scope) ::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }

.sm-thread,
.sm-sidebar__scroll { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted-foreground) 30%, transparent) transparent; }

.sm-prose a { color: var(--foreground); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent); text-underline-offset: 3px; }
.sm-prose a:hover { text-decoration-color: var(--foreground); }

.sm-approval--pending .sm-approval__head { background: color-mix(in srgb, var(--approval-accent) 6%, var(--card)); }
.sm-approval__icon { background: var(--muted); color: var(--muted-foreground); }
.sm-approval--pending .sm-approval__icon { background: color-mix(in srgb, var(--approval-accent) 14%, transparent); color: var(--approval-accent); }
.sm-approval--completed .sm-approval__icon { background: var(--muted); color: var(--foreground); }

/* Theme switches cross-fade instead of snapping (class set by applyTheme in semantik-chat.js). */
html.sm-theme-transition,
html.sm-theme-transition *,
html.sm-theme-transition *::before,
html.sm-theme-transition *::after {
  transition: background-color 250ms ease, border-color 250ms ease, color 250ms ease, fill 250ms ease !important;
}

@media (prefers-reduced-motion: reduce) {
  html.sm-theme-transition,
  html.sm-theme-transition * { transition: none !important; }
  .sm-thinking__pulse { animation: none; }
}

/* ── Appearance panel (ThemeSwitcher.razor) ───────────────────────────── */

.sm-theme { position: relative; }
.sm-theme-panel {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 50;
  width: min(23rem, calc(100vw - 1.5rem)); padding: 0.85rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--popover); color: var(--popover-foreground);
}
.sm-theme-panel[hidden] { display: none; }
.sm-theme-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.sm-theme-panel__title { font-size: 0.8125rem; font-weight: 600; }
.sm-theme-panel__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.sm-segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--muted); }
.sm-segmented__item {
  display: inline-flex; align-items: center; gap: 0.3rem; height: 1.6rem; padding: 0 0.65rem;
  border: 0; border-radius: calc(var(--radius) - 4px); background: transparent; color: var(--muted-foreground);
  font-size: 0.75rem; font-weight: 500; cursor: pointer;
}
.sm-segmented__item--active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.sm-segmented__item:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

.sm-theme-card {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.4rem 0.4rem 0.55rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); text-align: left; cursor: pointer;
  transition: border-color 150ms ease;
}
.sm-theme-card:hover { border-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); }
.sm-theme-card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sm-theme-card--active { border-color: var(--foreground); }
.sm-theme-card__preview {
  position: relative; display: block; height: 3.4rem; margin-bottom: 0.35rem; padding: 0.45rem;
  border-radius: calc(var(--radius) - 2px); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgb(128 128 128 / 0.2);
}
.sm-theme-card__surface {
  display: flex; align-items: center; gap: 0.35rem; width: 78%; padding: 0.3rem;
  border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / 0.18);
}
.sm-theme-card__mark { width: 0.8rem; height: 0.8rem; flex-shrink: 0; border-radius: 3px; }
.sm-theme-card__lines { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.sm-theme-card__lines span { display: block; height: 3px; border-radius: 2px; background: rgb(128 128 128 / 0.35); }
.sm-theme-card__lines span:first-child { width: 70%; }
.sm-theme-card__dots { position: absolute; right: 0.45rem; bottom: 0.45rem; display: flex; gap: 3px; }
.sm-theme-card__dots span { width: 0.5rem; height: 0.5rem; border-radius: 2px; }
.sm-theme-card__name { display: flex; align-items: center; justify-content: space-between; padding: 0 0.2rem; font-size: 0.8125rem; font-weight: 600; color: var(--foreground); }
.sm-theme-card__desc { padding: 0 0.2rem; font-size: 0.6875rem; line-height: 1.35; color: var(--muted-foreground); }
.sm-theme-card__check {
  display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem;
  border-radius: 999px; background: var(--foreground); color: var(--background);
}

/* ── Chart cards ──────────────────────────────────────────────────────── */

/* A figure in the answer, unframed like a figure in a document: its title, axes, grid and legend
   already bound it, while data blocks (tables, code, diagrams) keep the hairline frame (see
   Content surfaces). A compact title and muted description at the table header's weight, aligned
   with the text column, the plot below, and the download action only on hover or focus (always on
   touch screens). The doubled class outranks style-studio's head padding. */
.sm-artifact.sm-artifact--chart { border: 0; border-radius: 0; overflow: visible; margin: 1.25rem 0; }
.sm-artifact.sm-artifact--chart .sm-artifact__head { padding: 0; border-bottom: 0; }
.sm-artifact--chart .sm-artifact__title { display: block; min-width: 0; font-size: 0.875rem; font-weight: 600; line-height: 1.35; }
.sm-artifact--chart .sm-artifact__subtitle { margin-top: 0.1rem; font-size: 0.75rem; line-height: 1.4; }
.sm-artifact--chart .sm-artifact__actions { margin: -0.3rem -0.45rem 0 0; opacity: 0; transition: opacity 120ms ease; }
.sm-artifact--chart:hover .sm-artifact__actions,
.sm-artifact--chart:focus-within .sm-artifact__actions { opacity: 1; }
@media (hover: none) { .sm-artifact--chart .sm-artifact__actions { opacity: 1; } }
.sm-artifact--chart .sm-icon-button { color: var(--muted-foreground); }
.sm-artifact--chart .sm-chart { padding: 0.5rem 0 0; }
.sm-artifact--chart .sm-echart { height: 280px; }
@media (max-width: 768px) { .sm-artifact--chart .sm-echart { height: 240px; } }

/* Lists: the Tailwind preflight strips list-style, so markers are restored here. Indent, item
   spacing and marker colour are typography.css. */
.sm-prose ul { list-style: disc; }
.sm-prose ol { list-style: decimal; }
.sm-prose li { display: list-item; }
/* ── Code blocks ──────────────────────────────────────────────────────────
   A copy of the React SDK v4 CodeBlock (src/components/CodeBlock.tsx), value for value:
     section  my-4 overflow-hidden rounded-xl border bg-background shadow-sm
     header   border-b bg-muted/40 px-3 py-2, label font-mono 11px medium muted
     button   rounded-md px-2 py-1 text-xs muted, hover bg-accent + foreground, 13px icon
     code     padding 1rem, 0.8125rem / 1.6, background transparent,
              'JetBrains Mono', 'Consolas', ui-monospace, monospace
   Token colours (vs / vscDarkPlus, plain text #393A34 / #d4d4d4) are in prism-theme.css. */

.sm-code {
  margin: 1rem 0; overflow: hidden;
  border: 1px solid var(--block-border); border-radius: var(--block-radius);
  background: var(--background);
}
.sm-code__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  height: auto; padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  text-transform: none; letter-spacing: 0;
}
.sm-code__lang {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--muted-foreground);
}
.sm-code__actions { display: flex; align-items: center; gap: 0.125rem; }
.sm-code__copy {
  display: inline-flex; align-items: center; gap: 0.375rem; height: auto; padding: 0.25rem 0.5rem;
  border: 0; border-radius: calc(var(--radius) - 2px); background: transparent;
  color: var(--muted-foreground); font-family: var(--font-sans); font-size: 0.75rem; font-weight: 400;
  line-height: 1rem; cursor: pointer; transition: background-color 150ms ease, color 150ms ease;
}
.sm-code__copy svg { width: 13px; height: 13px; }
.sm-code__copy:hover { background: var(--accent); color: var(--foreground); }
.sm-code__copy[aria-pressed="true"] { background: var(--accent); color: var(--foreground); }
.sm-code__icon { padding: 0.25rem; }

.sm-code pre {
  margin: 0; padding: 1rem; overflow-x: auto;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.8125rem; line-height: 1.6; font-weight: 400; tab-size: 4;
  white-space: pre; text-shadow: none;
  -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted-foreground) 35%, transparent) transparent;
}
.sm-code pre:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sm-code--wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sm-code code { font: inherit; background: none; border: 0; padding: 0; }

/* Inline code in prose: typography.css. */

/* ── Diagrams ─────────────────────────────────────────────────────────── */

.sm-mermaid {
  position: relative; margin: 1rem 0; overflow: hidden;
  border: 1px solid var(--block-border); border-radius: var(--block-radius); background: transparent;
}
.sm-mermaid__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  height: 2.25rem; padding: 0 0.35rem 0 0.9rem; border-bottom: 1px solid var(--border);
  font-family: var(--font-sans); text-transform: none; letter-spacing: 0;
}
.sm-mermaid__body { position: relative; }
.sm-mermaid__body[hidden] { display: none; }
.sm-mermaid__canvas { display: flex; justify-content: center; padding: 1.25rem 1rem; overflow-x: auto; min-height: 0; }
.sm-mermaid__canvas:empty { padding: 0; }
.sm-mermaid__canvas svg { max-width: 100%; height: auto; }
.sm-mermaid__placeholder {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 9rem;
  color: var(--muted-foreground); font-size: 0.8125rem;
}
.sm-mermaid__canvas:not(:empty) + .sm-mermaid__placeholder { display: none; }
.sm-mermaid__pulse { width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor; animation: sm-pulse 1.2s ease-in-out infinite; }
.sm-mermaid__source {
  margin: 0; padding: 0.875rem 1rem; overflow-x: auto; background: var(--background);
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.65; color: var(--foreground); white-space: pre;
}
.sm-mermaid__error {
  padding: 0.55rem 0.9rem; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 50%, var(--card));
  color: var(--muted-foreground); font-size: 0.75rem;
}
.sm-mermaid:focus { outline: none; }

.sm-mermaid__backdrop { position: fixed; inset: 0; z-index: 69; background: rgb(0 0 0 / 0.45); }
.sm-mermaid--expanded {
  position: fixed; inset: 4vh 4vw; z-index: 70; margin: 0;
  display: flex; flex-direction: column;
  background: var(--card); /* a dialog, not a block in the flow: it needs its own surface */
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 24px 64px rgb(0 0 0 / 0.25);
}
.sm-mermaid--expanded .sm-mermaid__body { flex: 1; min-height: 0; overflow: auto; }
.sm-mermaid--expanded .sm-mermaid__canvas { height: 100%; align-items: center; padding: 2rem; }
.sm-mermaid--expanded .sm-mermaid__canvas svg { max-width: 100% !important; max-height: 100%; width: 100%; height: 100%; }

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

/* Account menu (sidebar footer). */
.sm-sidebar__footer { position: relative; }
.sm-profile--button {
  display: flex; width: 100%; align-items: center; border: 0; background: transparent;
  color: inherit; text-align: left; cursor: pointer; transition: background-color 120ms ease;
}
.sm-profile--button:hover, .sm-profile--button[aria-expanded="true"] { background: var(--sidebar-accent); }
.sm-profile--button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sm-profile--button > svg { margin-left: auto; flex-shrink: 0; color: var(--muted-foreground); }
.sm-profile__text { display: flex; flex-direction: column; flex: 1; }
.sm-profile__avatar { flex-shrink: 0; }
.sm-sidebar__footer .sm-menu--account { top: auto; bottom: calc(100% - 0.25rem); left: 0.5rem; right: 0.5rem; max-width: none; min-width: 0; }
.sm-sidebar--collapsed .sm-menu--account { right: auto; min-width: 13rem; }
.sm-menu__identity { display: flex; flex-direction: column; padding: 0.4rem 0.55rem 0.35rem; min-width: 0; }
.sm-menu__identity-name { font-size: 0.8125rem; font-weight: 500; }
.sm-menu__identity-detail { font-size: 0.75rem; color: var(--muted-foreground); }
.sm-menu__label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* Header: chat title, context pills, appearance. */
.sm-header__title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.012em; }
.sm-header__subtitle { font-size: 0.75rem; }
@media (min-width: 769px) { .sm-header--sidebar-open .sm-header__toggle { display: none; } }
.sm-header .sm-pill { height: 1.875rem; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.sm-header .sm-button { white-space: nowrap; }

/* One reading column: transcript, approval tray, error and composer share a width and gutter,
   so their edges line up. The width (--thread-width) follows the text size: typography.css. */
.sm-thread { padding-inline: 1.25rem; }
.sm-thread__inner,
.sm-thread__loading,
.sm-composer,
.sm-approval-tray,
.sm-dock > .sm-error { max-width: var(--thread-width); margin-inline: auto; }
.sm-dock { padding-inline: 1.25rem; }
@media (max-width: 768px) { .sm-thread, .sm-dock { padding-inline: 0.85rem; } }

/* HTML artifact frame: transparent over the card (the frame document carries the app's colour
   scheme, see HtmlArtifactDocument), with a hairline instead of a hard white block. */
.sm-artifact__frame { background: transparent; border: 1px solid var(--border); height: 320px; }

/* ── Files, images, galleries (v4 parity) ────────────────────────────────── */

/* File card: the name leads, the type reads as words, one primary action. */
.sm-file {
  display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; padding: 0.75rem 0.875rem;
  border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card);
  transition: border-color 150ms ease;
}
.sm-file:hover { border-color: color-mix(in srgb, var(--foreground) 16%, var(--border)); }
.sm-file__icon {
  display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.5rem;
  background: var(--muted); color: var(--foreground);
}
.sm-file__text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 0.125rem; }
.sm-file__name { overflow: hidden; font-size: 0.875rem; font-weight: 500; color: var(--foreground); text-overflow: ellipsis; white-space: nowrap; }
.sm-file__meta { font-size: 0.75rem; color: var(--muted-foreground); }
.sm-file__download {
  display: inline-flex; flex-shrink: 0; align-items: center; gap: 0.375rem; height: 2rem; padding: 0 0.75rem;
  border-radius: calc(var(--radius) - 2px); background: var(--primary); color: var(--primary-foreground);
  font-size: 0.75rem; font-weight: 500; text-decoration: none; transition: opacity 150ms ease;
}
.sm-file__download:hover { opacity: 0.9; }
.sm-file__download:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Image figure: full width in the flow, a fixed tile in a gallery strip. */
.sm-image {
  position: relative; margin: 1rem 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card);
}
.sm-image__open { display: block; width: 100%; padding: 0; border: 0; background: var(--muted); cursor: zoom-in; }
.sm-image__open img { display: block; width: 100%; max-height: 28rem; object-fit: contain; }
.sm-image__open:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sm-image__download {
  position: absolute; top: 0.5rem; right: 0.5rem; display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border: 1px solid var(--border); border-radius: 0.5rem;
  background: color-mix(in srgb, var(--background) 88%, transparent); color: var(--foreground);
  opacity: 0; transition: opacity 150ms ease;
}
.sm-image:hover .sm-image__download, .sm-image__download:focus-visible { opacity: 1; }
.sm-image__caption { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.5rem 0.75rem; border-top: 1px solid var(--border); }
.sm-image__title { font-size: 0.8125rem; font-weight: 500; color: var(--foreground); }
.sm-image__text { font-size: 0.75rem; color: var(--muted-foreground); }
.sm-image__missing {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; height: 9rem;
  background: var(--muted); color: var(--muted-foreground); font-size: 0.75rem;
}
.sm-image--tile { flex: 0 0 auto; width: 17rem; margin: 0; scroll-snap-align: start; }
.sm-image--tile .sm-image__open img { height: 11rem; max-height: none; object-fit: cover; }
.sm-image--tile .sm-image__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sm-gallery-strip {
  display: flex; gap: 0.75rem; margin: 1rem 0; padding-bottom: 0.25rem;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.sm-gallery-block { margin: 1rem 0; }
.sm-gallery-block .sm-gallery-strip { margin: 0.5rem 0 0; }
.sm-gallery-block__head { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 500; }
.sm-gallery-block__count { color: var(--muted-foreground); font-weight: 400; }

/* Lightbox: the one elevated layer for images, same grammar as the diagram dialog. */
.sm-lightbox__backdrop { position: fixed; inset: 0; z-index: 69; background: rgb(0 0 0 / 0.55); }
.sm-lightbox {
  position: fixed; inset: 4vh 4vw; z-index: 70; display: flex; flex-direction: column;
  overflow: hidden; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 24px 64px rgb(0 0 0 / 0.25);
}
.sm-lightbox:focus { outline: none; }
.sm-lightbox__bar { display: flex; align-items: center; gap: 0.25rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.sm-lightbox__title { flex: 1; min-width: 0; overflow: hidden; font-size: 0.8125rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sm-lightbox__stage { display: flex; flex: 1; min-height: 0; align-items: center; justify-content: center; padding: 1.5rem; background: var(--muted); cursor: zoom-out; }
.sm-lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: default; }

/* Link / result cards: the whole card is the link; optional image on top. */
.sm-card--link { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; color: inherit; text-decoration: none; }
.sm-card--link .sm-card__content { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem 0.85rem; }
.sm-card--link:not([href]) { cursor: default; }
.sm-card__media { display: block; width: 100%; height: 8rem; object-fit: cover; background: var(--muted); border-bottom: 1px solid var(--border); }
.sm-card--link .sm-card__snippet { display: -webkit-box; margin-top: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.sm-artifact__lead { margin: 0; padding: 0.75rem 1rem 0; font-size: 0.8125rem; color: var(--muted-foreground); }

/* Artifact bodies */
.sm-artifact__body--flush { padding: 0; }
.sm-artifact__body--flush .sm-code { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.sm-artifact__body--prose { color: var(--foreground); font-size: 0.875rem; }
.sm-artifact__text { margin: 0; font-family: var(--font-sans); font-size: 0.8125rem; line-height: 1.7; color: var(--foreground); white-space: pre-wrap; }
.sm-artifact__error { color: var(--muted-foreground); }
.sm-artifact--pending .sm-artifact__body { font-size: 0.8125rem; }

/* Markdown extras: images, nested and task lists, masked privacy tokens. */
.sm-prose .sm-md-img { display: block; max-width: 100%; max-height: 28rem; margin: 0.5rem 0; border: 1px solid var(--border); border-radius: 0.5rem; }
.sm-prose li > ul, .sm-prose li > ol { margin-top: 0.3rem; }
.sm-prose ul ul { list-style-type: circle; }
.sm-prose ul ul ul { list-style-type: square; }
.sm-task {
  display: inline-block; width: 0.875rem; height: 0.875rem; margin-right: 0.45rem; vertical-align: -0.1rem;
  border: 1.5px solid color-mix(in srgb, var(--foreground) 45%, transparent); border-radius: 0.25rem;
}
.sm-task--done {
  border-color: var(--foreground); background: var(--foreground)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E") center / 80% no-repeat;
}
html.dark .sm-task--done {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E");
}
.sm-prose li:has(> .sm-task) { list-style: none; margin-left: -1.25em; }
.sm-masked {
  display: inline-flex; align-items: center; gap: 0.25rem; height: 1.25rem; padding: 0 0.45rem; vertical-align: 0.05rem;
  border: 1px dashed color-mix(in srgb, var(--foreground) 30%, transparent); border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); font-size: 0.75em; font-weight: 500; white-space: nowrap;
}

/* ── Long user turns: clamped with a fade, expandable ─────────────────── */
/* Words wrap whole; only a token longer than the line (a URL, a hash) breaks. `anywhere` also
   broke inside ordinary words, because it lets the bubble shrink to a single character. Pasted
   code and logs are mostly long unbroken lines, so they keep breaking anywhere. */
.sm-bubble-user { white-space: pre-wrap; overflow-wrap: break-word; }
.sm-bubble-user--code { font-family: var(--font-mono); line-height: 1.6; overflow-wrap: anywhere; }
.sm-bubble-user--clamped {
  max-height: 15rem; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 4rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 4rem), transparent);
}
.sm-bubble-toggle {
  display: inline-flex; align-items: center; gap: 0.25rem; height: 1.75rem; padding: 0 0.6rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted-foreground);
  font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: background-color 120ms ease, color 120ms ease;
}
.sm-bubble-toggle:hover { background: var(--accent); color: var(--foreground); }
.sm-bubble-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* ── Appearance: style picker ─────────────────────────────────────────────
   Two cards sketching each style's shape language (bubble, answer lines, composer), drawn with
   literal shapes so both previews are accurate whichever style is active. */
.sm-theme-panel__label {
  margin: 0.25rem 0 0.4rem; font-size: 0.6875rem; font-weight: 500; color: var(--muted-foreground);
}
.sm-theme-panel__label + .sm-theme-panel__grid { margin-bottom: 0; }
/* A labelled single-line control (text size): label left, segmented control right. */
.sm-theme-panel__row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.sm-theme-panel__row > .sm-theme-panel__label { margin: 0; }
.sm-style-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.85rem; }
.sm-style-card {
  display: flex; flex-direction: column; gap: 0.35rem; padding: 0.35rem 0.35rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  color: inherit; text-align: left; cursor: pointer; transition: border-color 150ms ease;
}
.sm-style-card:hover { border-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); }
.sm-style-card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sm-style-card--active { border-color: var(--foreground); }
.sm-style-card__preview {
  position: relative; display: flex; flex-direction: column; gap: 4px; height: 4.25rem; padding: 0.45rem;
  overflow: hidden; border-radius: calc(var(--radius) - 3px); background: var(--muted);
}
.sm-style-card__bubble { align-self: flex-end; width: 42%; height: 9px; background: color-mix(in srgb, var(--foreground) 18%, transparent); }
.sm-style-card__line { width: 80%; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--foreground) 30%, transparent); }
.sm-style-card__line--short { width: 55%; }
.sm-style-card__composer {
  position: absolute; left: 0.45rem; right: 0.45rem; bottom: 0.4rem; display: flex; justify-content: flex-end; align-items: center;
  height: 13px; padding: 0 2px; background: var(--card); border: 1px solid color-mix(in srgb, var(--foreground) 22%, transparent);
}
.sm-style-card__composer span { width: 9px; height: 9px; background: var(--primary); }
/* Enterprise: tight corners, docked full-width composer with a square action. */
.sm-style-card--enterprise .sm-style-card__bubble { border-radius: 3px; }
.sm-style-card--enterprise .sm-style-card__composer { left: 0; right: 0; bottom: 0; height: 15px; border-width: 1px 0 0; border-radius: 0; }
.sm-style-card--enterprise .sm-style-card__composer span { border-radius: 2px; margin-right: 4px; }
/* Studio: pill bubble, floating pill composer with a round send. */
.sm-style-card--studio .sm-style-card__bubble { border-radius: 999px; }
.sm-style-card--studio .sm-style-card__composer { left: 0.9rem; right: 0.9rem; border-radius: 999px; box-shadow: 0 2px 6px rgb(0 0 0 / 0.12); }
.sm-style-card--studio .sm-style-card__composer span { border-radius: 999px; }

/* ── Math (KaTeX) ─────────────────────────────────────────────────────── */

/* Placeholders read as quiet TeX until KaTeX typesets them (semantik-chat.js typesetMath), and
   stay that way if it cannot load. Display formulas get their own line, centred, scrolling
   sideways instead of overflowing the column on a phone. */
.sm-math:not([data-typeset]) { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted-foreground); white-space: pre-wrap; }
.sm-math .katex { font-size: 1.08em; }
.sm-math--display { display: block; margin: 0.85rem 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.sm-math--display .katex-display { margin: 0; }
.sm-math--display:not([data-typeset]) { text-align: left; }
