/* ==========================================================================
   AORI — Components
   Flat surfaces, hairline borders, one accent. No gradients, no glow.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Panel — the single surface primitive
   -------------------------------------------------------------------------- */

.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease-out);
}

[data-theme="light"] .panel { box-shadow: var(--shadow-1); }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.panel__title .icon { color: var(--fg-3); }

.panel__body { padding: var(--s-4); }
.panel__foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
}

/* Inline icons never stretch: fixed size, aligned to the text. */
.icon { flex-shrink: 0; }
.empty .icon { width: 28px; height: 28px; }

/* --------------------------------------------------------------------------
   Top bar / navigation
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--nav-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
  transition: box-shadow var(--dur) var(--ease-out);
}
.topbar.is-stuck { box-shadow: var(--shadow-1); }

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  height: var(--topbar-h);
}

.brandmark { display: flex; align-items: center; gap: var(--s-2); }

.brandmark__glyph {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.brandmark__glyph svg { width: 15px; height: 15px; }

.brandmark__text {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.brandmark__sub {
  display: block;
  margin-top: -2px;
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Nav with an indicator that slides between links */
.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav__pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: var(--r-sm);
  background: var(--surface-hover);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.nav__link {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav__link svg { width: 15px; height: 15px; opacity: 0.8; }
.nav__link:hover { color: var(--fg); }
.nav__link.is-active { color: var(--fg); font-weight: 600; }
.nav__link.is-active svg { color: var(--accent); opacity: 1; }

.topbar__actions { display: flex; align-items: center; gap: var(--s-2); }

/* Theme toggle — a two-state segmented control */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
}

.theme-toggle__knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 26px; height: 22px;
  border-radius: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--stroke);
  transform: translateX(0);
  transition: transform var(--dur) var(--ease-out);
  z-index: 0;
}
[data-theme="dark"] .theme-toggle__knob { transform: translateX(26px); }

.theme-toggle__icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px; height: 22px;
  color: var(--fg-3);
  transition: color var(--dur) var(--ease-out);
}
.theme-toggle__icon svg { width: 13px; height: 13px; }
.theme-toggle__icon--sun { color: var(--fg); }
[data-theme="dark"] .theme-toggle__icon--sun { color: var(--fg-3); }
[data-theme="dark"] .theme-toggle__icon--moon { color: var(--fg); }

@media (max-width: 760px) {
  .nav__label { display: none; }
  .nav__link { padding: 7px 9px; }
  .brandmark__sub { display: none; }
  .brandmark__text { font-size: var(--fs-md); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-hover); border-color: var(--stroke-strong); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn--primary {
  color: var(--accent-fg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--fg); border-color: var(--stroke); }

.btn--danger { color: var(--err); border-color: var(--stroke); }
.btn--danger:hover { background: var(--err-soft); border-color: var(--err); }
.btn--danger-solid { color: #fff; background: var(--err); border-color: var(--err); font-weight: 600; }
.btn--danger-solid:hover { background: var(--err); filter: brightness(0.94); }

.btn--warn { color: var(--warn); border-color: var(--stroke); }
.btn--warn:hover { background: var(--warn-soft); border-color: var(--warn); }

.btn--sm { padding: 4px 9px; font-size: var(--fs-sm); }
.btn--sm svg { width: 14px; height: 14px; }
.btn--icon { padding: 5px; }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   Status badge
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  text-transform: capitalize;
  color: var(--st-fg, var(--fg-2));
  background: var(--st-bg, var(--surface-sunken));
  border: 1px solid var(--hairline);
}

.badge__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge--pending        { --st-fg: var(--st-pending-fg);        --st-bg: var(--st-pending-bg); }
.badge--queued         { --st-fg: var(--st-queued-fg);         --st-bg: var(--st-queued-bg); }
.badge--running        { --st-fg: var(--st-running-fg);        --st-bg: var(--st-running-bg); }
.badge--awaiting_input { --st-fg: var(--st-awaiting_input-fg); --st-bg: var(--st-awaiting_input-bg); }
.badge--success        { --st-fg: var(--st-success-fg);        --st-bg: var(--st-success-bg); }
.badge--answered       { --st-fg: var(--st-answered-fg);       --st-bg: var(--st-answered-bg); }
.badge--failed         { --st-fg: var(--st-failed-fg);         --st-bg: var(--st-failed-bg); }
.badge--error          { --st-fg: var(--st-error-fg);          --st-bg: var(--st-error-bg); }
.badge--timeout        { --st-fg: var(--st-timeout-fg);        --st-bg: var(--st-timeout-bg); }
.badge--cancelled      { --st-fg: var(--st-cancelled-fg);      --st-bg: var(--st-cancelled-bg); }
.badge--unknown        { --st-fg: var(--st-unknown-fg);        --st-bg: var(--st-unknown-bg); }

/* In-flight states get a slow, low-contrast blink — enough to read as live. */
.badge--running .badge__dot,
.badge--queued .badge__dot,
.badge--pending .badge__dot,
.badge--awaiting_input .badge__dot {
  animation: dot-fade 2.4s ease-in-out infinite;
}

@keyframes dot-fade {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-2);
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
}
.chip--neutral { color: var(--fg-3); }

.tool-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }

.field__label { font-size: var(--fs-md); font-weight: 500; color: var(--fg); }
.field__hint { font-size: var(--fs-xs); color: var(--fg-3); }

.input,
.select,
.textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  font-size: var(--fs-md);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--stroke-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
.textarea--mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238a8a8a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  cursor: pointer;
}
.select option { background: var(--surface-solid); color: var(--fg); }

/* Switch (checkbox) */
.switch { display: inline-flex; align-items: flex-start; gap: var(--s-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch__track {
  position: relative;
  flex-shrink: 0;
  width: 36px; height: 20px;
  margin-top: 1px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--stroke-strong);
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--accent-fg); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.table { font-size: var(--fs-md); }

.table thead th {
  padding: 8px var(--s-4);
  text-align: left;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.table tbody td {
  padding: 9px var(--s-4);
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr {
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.table tbody tr:hover { background: var(--surface-hover); }

.table .cell-actions { text-align: right; white-space: nowrap; }

.id-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg-2);
}
a.id-pill:hover { color: var(--accent); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-4);
  text-align: center;
  color: var(--fg-3);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--stroke);
  background: var(--surface-2);
}

/* --------------------------------------------------------------------------
   Stat tile
   -------------------------------------------------------------------------- */

.stat { padding: var(--s-4); }

.stat__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }

.stat__icon { color: var(--fg-3); }
.stat__icon svg { width: 16px; height: 16px; }

.stat__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-3);
}

.stat__value {
  margin-top: 6px;
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--fg));
  line-height: 1.1;
}

.stat__foot { margin-top: 4px; font-size: var(--fs-xs); color: var(--fg-3); }

/* Linear meter */
.meter {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--tone, var(--accent));
  transition: width var(--dur-slow) var(--ease-out);
}

/* Small metric block used in dense grids */
.metric {
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.metric__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-3);
}
.metric__value {
  margin-top: 3px;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.metric--accent .metric__label { color: var(--accent); }
.metric--ok .metric__label { color: var(--ok); }

/* --------------------------------------------------------------------------
   Action timeline
   -------------------------------------------------------------------------- */

.timeline { display: flex; flex-direction: column; }

.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;   /* keeps the thumbnail from stretching when a
                                disclosure below it expands */
  gap: var(--s-3);
  padding: var(--s-3) 0 var(--s-3) var(--s-5);
}
.tl-item:first-child { padding-top: 0; }
.tl-item:last-child { padding-bottom: 0; }

.tl-item::before {  /* node */
  content: "";
  position: absolute;
  left: 2px;
  top: var(--s-3);
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 1;
}
.tl-item:first-child::before { top: 5px; }

.tl-item::after {  /* rail */
  content: "";
  position: absolute;
  left: 5px;
  top: calc(var(--s-3) + 12px);
  bottom: -2px;
  width: 1px;
  background: var(--stroke);
}
.tl-item:first-child::after { top: 17px; }
.tl-item:last-child::after { display: none; }

.tl-item--err::before { background: var(--err); }

.tl-shot {
  flex: 0 0 auto;
  align-self: flex-start;    /* never grows with the row */
  width: 116px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--stroke);
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.tl-shot:hover { border-color: var(--accent); }
.tl-shot img { width: 100%; height: 72px; object-fit: cover; object-position: top; display: block; }

.disclose {
  margin-top: var(--s-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.disclose > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-2);
  transition: color var(--dur-fast) var(--ease-out);
}
.disclose > summary:hover { color: var(--fg); }
.disclose > summary::before {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out);
}
.disclose[open] > summary::before { transform: rotate(90deg); }
.disclose__body { padding: 0 9px 9px; }
.disclose--info > summary { color: var(--info); }

/* --------------------------------------------------------------------------
   Code / JSON
   -------------------------------------------------------------------------- */

.code {
  margin: 0;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--fg-2);
  overflow: auto;
  max-height: 280px;
}
.code--wrap { white-space: pre-wrap; word-break: break-word; }

/* API key reveal (profile page) */
.panel__key-reveal {
  margin: 0 var(--s-4) var(--s-4);
  padding: var(--s-3) var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}
.key-reveal {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.key-reveal__value {
  flex: 1;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg);
  overflow: auto;
  white-space: nowrap;
}
.key-prefix {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--fg-2);
}

kbd, .kbd {
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  background: var(--surface-sunken);
  border: 1px solid var(--stroke);
}

/* --------------------------------------------------------------------------
   Notes
   -------------------------------------------------------------------------- */

.note {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--tone, var(--info));
  background: var(--surface-2);
}
.note svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--tone, var(--info)); }
.note--err  { --tone: var(--err); }
.note--ok   { --tone: var(--ok); }
.note--warn { --tone: var(--warn); }

/* --------------------------------------------------------------------------
   Screenshots (live strip + lightbox targets)
   -------------------------------------------------------------------------- */

.shot {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.shot:hover { border-color: var(--accent); }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--s-6);
}
.modal[hidden] { display: none; }

.modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
}

.modal__panel {
  position: relative;
  z-index: 1;
  max-width: min(1080px, 100%);
  max-height: 88vh;
  opacity: 0;
}

/* A definite width keeps the shrink-to-fit panel from sizing itself to the
   paragraph's max-content width and leaving this card flush left inside it.
   (`min(420px, 100%)` makes the contribution indefinite during that sizing.) */
.modal__card {
  width: 420px;
  max-width: 100%;
  margin-inline: auto;
  padding: var(--s-5);
  background: var(--surface-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
}

.modal__img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke-strong);
  object-fit: contain;
}

.modal__close {
  position: absolute;
  top: -38px; right: 0;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.modal__close:hover { background: rgba(255, 255, 255, 0.22); }
.modal__caption {
  margin-top: var(--s-2);
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  min-width: 260px;
  max-width: 360px;
  padding: var(--s-3);
  font-size: var(--fs-md);
  border-radius: var(--r-sm);
  background: var(--surface-solid);
  border: 1px solid var(--stroke);
  border-left: 2px solid var(--tone, var(--info));
  box-shadow: var(--shadow-2);
  pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; color: var(--tone, var(--info)); flex-shrink: 0; }
.toast--err { --tone: var(--err); }
.toast--ok  { --tone: var(--ok); }

/* --------------------------------------------------------------------------
   Loading states
   -------------------------------------------------------------------------- */

.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--stroke-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-flex; }

.skeleton {
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}

/* Live indicator dot */
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tone, var(--accent));
  flex-shrink: 0;
  animation: dot-fade 2.4s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Prose (rendered markdown)
   -------------------------------------------------------------------------- */

.prose { color: var(--fg-2); font-size: var(--fs-md); line-height: 1.65; }
.prose > * + * { margin-top: var(--s-3); }
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-top: var(--s-4);
}
.prose h1 { font-size: var(--fs-xl); }
.prose h2 { font-size: var(--fs-lg); }
.prose h3 { font-size: var(--fs-md); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose ul, .prose ol { padding-left: var(--s-5); }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose li::marker { color: var(--fg-3); }
.prose li + li { margin-top: 2px; }
.prose code {
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.9em;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  color: var(--fg);
}
.prose pre {
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  overflow-x: auto;
}
.prose pre code { padding: 0; background: none; border: 0; }
.prose blockquote {
  padding-left: var(--s-3);
  border-left: 2px solid var(--stroke-strong);
  color: var(--fg-3);
}
.prose table { font-size: var(--fs-sm); }
.prose th, .prose td { padding: 5px 9px; border: 1px solid var(--hairline); text-align: left; }

/* --------------------------------------------------------------------------
   User menu (topbar)
   -------------------------------------------------------------------------- */

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.user-menu__email {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
