/* ============================================================
   Allmode.ai — Theme-aligned styles
   Colors matched to /frontend/styles/brands/allmode/theme.css
   ============================================================ */

:root {
  /* ── Surfaces & ink — light mode (default) ─────────────────────────── */
  --bg-000: #ffffff;       /* deepest surface (sidebar, dropdowns, login) */
  --bg-100: #ffffff;       /* primary canvas */
  --bg-200: #f5f5f5;       /* hover / subtle fill */
  --bg-300: #fafafa;       /* table-header / nested fill */
  --bg-400: #ebebeb;       /* pressed / muted control */
  --text-000: #1a1a1a;
  --text-100: #1a1a1a;
  --text-200: #333333;
  --text-300: #333333;
  --text-400: #888888;
  --border-100: #e5e5e5;
  --border-200: #d9d9d9;
  --border-300: #cccccc;

  /* ── Accent — provider-derived, set inline by theme.ts ─────────────── */
  /*   --accent-main:  text + focus rings + active-state ink
   *   --accent-bg:    solid send button + avatar bg
   *   --accent-soft:  translucent glyph backgrounds + welcome halo */
  --accent-main: #171513;
  --accent-bg:   #171513;
  --accent-soft: rgba(23, 21, 19, 0.06);

  /* ── Mode-dependent semantic helpers — overridden in dark below ────── */
  --shadow-card:   0 4px 16px -4px rgba(0, 0, 0, 0.08);
  --shadow-pop:    0 8px 32px rgba(0, 0, 0, 0.10);
  --overlay-scrim: rgba(0, 0, 0, 0.30);
  --code-fill:     rgba(0, 0, 0, 0.04);
  --scroll-thumb:  rgba(0, 0, 0, 0.18);
  --scroll-thumb-hover: rgba(0, 0, 0, 0.30);
}

/* ── Dark mode — flips surface + ink only. Accent comes from theme.ts. ── */
:root[data-theme="dark"] {
  --bg-000: #0e0e0e;       /* sidebar / login / dropdown floor */
  --bg-100: #161616;       /* primary canvas */
  --bg-200: #202020;       /* hover fill */
  --bg-300: #1a1a1a;       /* nested fill */
  --bg-400: #2a2a2a;       /* pressed */
  --text-000: #f1f1f1;
  --text-100: #e4e4e4;
  --text-200: #cfcfcf;
  --text-300: #bdbdbd;
  --text-400: #8a8a8a;
  --border-100: #2a2a2a;
  --border-200: #353535;
  --border-300: #454545;

  /* Neutral fallback accent (in case theme.ts hasn't set one yet) */
  --accent-main: #f5f5f5;
  --accent-bg:   #2a2a2a;
  --accent-soft: rgba(255, 255, 255, 0.08);

  --shadow-card:   0 4px 16px -4px rgba(0, 0, 0, 0.40);
  --shadow-pop:    0 8px 32px rgba(0, 0, 0, 0.50);
  --overlay-scrim: rgba(0, 0, 0, 0.60);
  --code-fill:     rgba(255, 255, 255, 0.04);
  --scroll-thumb:  rgba(255, 255, 255, 0.16);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.28);
}

html, body {
  font-family:
    "Segoe UI Variable Text",
    "Segoe UI",
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    system-ui,
    sans-serif;
}

code, pre, .tool-detail-code, .attachment-preview {
  font-family:
    "Cascadia Code",
    "SF Mono",
    "Consolas",
    "Menlo",
    monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #root {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

body {
  /* font-family lives in the html, body declaration above */
  font-size: 14px;
  color: var(--text-000);
  background: var(--bg-200);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Loading ---- */
.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
  background: var(--bg-200);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-200);
  border-top-color: var(--text-000);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.app-loading p {
  color: var(--text-400);
  font-size: 13px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- App Layout ---- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: var(--bg-100);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  /* No hard border-bottom — Claude-style soft edge. Header sits in a faint
   * top-tinted band that fades to the page bg below. */
  border-bottom: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.035) 0%,
      rgba(0, 0, 0, 0.018) 55%,
      rgba(0, 0, 0, 0) 100%
    ),
    var(--bg-100);
  flex-shrink: 0;
}

:root[data-theme="dark"] .app-header {
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.045) 0%,
      rgba(255, 255, 255, 0.020) 55%,
      rgba(255, 255, 255, 0) 100%
    ),
    var(--bg-100);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  gap: 2px;
}
/* Left/right header slots share a minimum so the centered title stays
   visually balanced even when right grows to fit multiple buttons. */
.header-left { min-width: 28px; }
.header-right { min-width: 28px; }

/* ── Hamburger button (left) ── */
.header-logo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  /* Explicit color — without this, the SVG falls back to the UA button
     color (often near-black system grey) which disappears on dark surface. */
  color: var(--text-200);
  transition: background 0.15s, color 0.15s;
}

.header-logo-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

/* ── Sidebar overlay + panel ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  z-index: 200;
  animation: sidebar-fade-in 0.2s ease;
}

@keyframes sidebar-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-000);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
}

.sidebar.sidebar-open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  /* No hard border — same Claude-style soft edge as .app-header.
   * Sidebar bg is --bg-000, so the gradient overlay tints the top and
   * fades to transparent so it blends into the list below. */
  border-bottom: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.035) 0%,
      rgba(0, 0, 0, 0.018) 55%,
      rgba(0, 0, 0, 0) 100%
    );
  flex-shrink: 0;
}

:root[data-theme="dark"] .sidebar-header {
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.045) 0%,
      rgba(255, 255, 255, 0.020) 55%,
      rgba(255, 255, 255, 0) 100%
    );
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-000);
  letter-spacing: -0.02em;
}

.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-400);
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-close-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section {
  padding: 4px 8px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-100);
  margin: 4px 16px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 13px;
  color: var(--text-300);
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-item:hover svg:first-child {
  color: var(--text-200);
}

.sidebar-item > span {
  flex: 1;
  min-width: 0;
}

.sidebar-item svg:first-child {
  flex-shrink: 0;
  color: var(--text-400);
}

.sidebar-item-arrow {
  flex-shrink: 0;
  color: var(--text-400);
  margin-left: auto;
}

.sidebar-item-hint {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-400);
  white-space: nowrap;
  margin-left: auto;
}

/* Referral item gradient highlight */
.sidebar-item-referral {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(6, 182, 212, 0.06));
}

.sidebar-item-referral:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.12));
}

/* Language floating dropdown — positioned via fixed in JSX */
.sidebar-lang-dropdown {
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.sidebar-lang-dropdown::-webkit-scrollbar {
  width: 4px;
}

.sidebar-lang-dropdown::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 2px;
}

.sidebar-lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-300);
  transition: background 0.15s, color 0.15s;
}

.sidebar-lang-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-lang-item-active {
  color: var(--text-000);
  font-weight: 500;
  background: var(--bg-200);
}

.sidebar-lang-item-active svg {
  color: var(--accent-main);
}

/* Sign-out danger item */
.sidebar-item-danger {
  color: var(--text-400);
}

.sidebar-item-danger:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.06);
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border-100);
  padding: 8px;
  flex-shrink: 0;
}

/* ── Title dropdown ── */
.header-title-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.header-title-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  max-width: 200px;
  color: var(--text-000);
  transition: background 0.15s;
}

.header-title-btn:hover {
  background: var(--bg-200);
}

.header-title-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-title-chevron {
  flex-shrink: 0;
  color: var(--text-400);
  transition: transform 0.2s;
}

.header-title-chevron-open {
  transform: rotate(180deg);
}

.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-height: 420px;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.header-dropdown-list {
  overflow-y: auto;
  max-height: 280px;
}

.header-dropdown-list::-webkit-scrollbar {
  width: 4px;
}

.header-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 2px;
}

.header-menu-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-400);
  text-align: center;
}

.header-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--text-100);
}

.header-menu-item:hover {
  background: var(--bg-200);
}

.header-menu-item-active {
  background: var(--bg-200);
}

.header-menu-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-menu-item-delete {
  display: none;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-400);
  border-radius: 4px;
  flex-shrink: 0;
}

.header-menu-item:hover .header-menu-item-delete {
  display: flex;
}

.header-menu-item-delete:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.header-menu-divider {
  height: 1px;
  background: var(--border-100);
  margin: 4px 0;
}

.header-menu-item-danger {
  color: var(--text-400);
}

.header-menu-item-danger:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.06);
}

.panel-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-100);
}

/* ---- Login Panel ---- */
.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
  background: var(--bg-200);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text-000);
  letter-spacing: -0.02em;
}

.login-header p {
  color: var(--text-400);
  font-size: 14px;
}

.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--bg-000);
  border: 0.5px solid var(--border-100);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
}

.login-form {
  width: 100%;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-200);
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-000);
  border: 1px solid var(--border-100);
  border-radius: 10px;
  color: var(--text-000);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:hover {
  border-color: var(--border-200);
}

.form-input:focus {
  border-color: var(--border-300);
}

.form-input::placeholder {
  color: var(--text-400);
  font-size: 13px;
  letter-spacing: normal;
}

.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-400);
  display: flex;
  align-items: center;
}

.password-toggle:hover {
  color: var(--text-000);
}

.login-error {
  color: #ef4444;
  font-size: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.login-button {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  background: var(--accent-bg);
  color: var(--bg-000);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.165,0.85,0.45,1), opacity 0.15s;
  position: relative;
  overflow: hidden;
}

.login-button:hover {
  transform: scaleY(1.015) scaleX(1.005);
}

.login-button:active {
  transform: scale(0.985);
}

.login-button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.login-button-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-400);
}

.login-footer a {
  color: var(--text-200);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-footer a:hover {
  color: var(--text-000);
}

/* ---- Chat Panel ---- */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-100);
}

.chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  position: relative;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 24px;
}

.chat-empty-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-000);
  letter-spacing: -0.01em;
}

.chat-empty-desc {
  font-size: 13px;
  color: var(--text-400);
  line-height: 1.6;
}

/* ── Skill capsule pills (empty state) ────────────────────────────── */
.chat-empty-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  width: 100%;
  max-width: 360px;
}
.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border-200);
  border-radius: 999px;
  background: var(--bg-000);
  color: var(--text-100);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font: inherit;
  font-size: 12px;
  position: relative;
}
.skill-pill:hover:not(:disabled) {
  background: var(--bg-200);
  border-color: var(--border-300);
}
.skill-pill:disabled { opacity: 0.5; cursor: not-allowed; }
.skill-pill-slash {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  font-size: 12px;
}

/* CSS-only hover tooltip: a single card appears below the pill on hover. */
.skill-pill::after {
  content: attr(data-tooltip-desc);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translate(-50%, -4px);
  background: var(--bg-000);
  color: var(--text-200);
  font-size: 11px;
  line-height: 1.4;
  border: 1px solid var(--border-200);
  border-radius: 8px;
  padding: 6px 10px;
  width: max-content;
  max-width: 260px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 32;
}
.skill-pill:hover:not(:disabled)::after,
.skill-pill:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Plus menu popover ─────────────────────────────────────────────── */
.plus-menu-wrapper { position: relative; display: inline-flex; }
.plus-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 30;
}
.plus-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
  color: var(--text-100);
}
.plus-menu-item:hover { background: var(--bg-200); }
.plus-menu-divider {
  height: 1px;
  background: var(--border-100);
  margin: 4px 6px;
}

/* ── Skills submenu — hover-cascading panel ──────────────────────────
 * Mirrors the web composer pattern (left-full top-0 ml-1): hovering the
 * "Skills" row opens a separate floating panel to the right of the plus
 * menu. The wrapper is the hover target so the panel stays open while
 * the user moves the cursor across to make a selection. */
.plus-menu-skills-wrapper {
  position: relative;
}
.plus-menu-skills-trigger {
  justify-content: flex-start;
}
.plus-menu-skills-label {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.plus-menu-skills-chevron {
  color: var(--text-400);
  flex-shrink: 0;
}

/* Cascade UPWARD instead of right — Excel task panes are too narrow for
 * `left: 100%` (the panel would overflow the iframe's right edge). Anchored
 * to the Skills row's top, full plus-menu width, so there is no horizontal
 * overflow regardless of task pane size. Slides in from below. */
.plus-menu-skills-list {
  position: absolute;
  bottom: calc(100% + 6px);   /* float above the Skills trigger row */
  left: -4px;                  /* hug plus menu's outer-left edge */
  right: -4px;                 /* match plus menu's outer-right edge */
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 31;                /* above .plus-menu (z-30) */
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: plus-menu-skills-slide 0.18s ease-out;
}
/* Invisible "bridge" pseudo-element that fills the 6px gap between the
 * submenu and the Skills row. Without it, moving the cursor across the
 * gap would briefly land outside any descendant of the wrapper, firing
 * mouseleave on the wrapper and closing the menu mid-transition. The
 * bridge belongs to a DOM descendant (the submenu) so it keeps the
 * wrapper's "over a descendant" check satisfied. */
.plus-menu-skills-list::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px;
}
@keyframes plus-menu-skills-slide {
  from { opacity: 0; transform: translate(0, 4px); }
  to   { opacity: 1; transform: translate(0, 0);   }
}

.plus-menu-skills-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-400);
}

.plus-menu-skill-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  font: inherit;
  transition: background 0.12s ease;
}
.plus-menu-skill-row:hover { background: var(--bg-200); }
.plus-menu-skill-name {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-100);
  line-height: 1.2;
}
.plus-menu-skill-desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-400);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.plus-menu-section-label {
  font-size: 11px;
  color: var(--text-400);
  padding: 6px 10px 2px;
}
.plus-menu-slash {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  min-width: 56px;
  color: var(--text-100);
}
.plus-menu-desc { color: var(--text-300); }
.plus-menu-footer {
  font-size: 11px;
  color: var(--text-400);
  padding: 6px 10px;
  text-align: center;
}

/* ── Plus menu — Skills nested submenu ─────────────────────────────── */
.plus-menu-skills-wrapper { position: relative; }
.plus-menu-item-has-submenu .plus-menu-chevron {
  margin-left: auto;
  color: var(--text-400);
  transition: transform 0.12s ease;
}
.plus-menu-item-has-submenu[aria-expanded="true"] .plus-menu-chevron {
  color: var(--text-100);
}
.plus-menu-skills-label { flex: 1; }
.plus-submenu {
  position: absolute;
  left: calc(100% + 4px);
  top: 0;
  min-width: 260px;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  padding: 4px;
  z-index: 31;
}

/* If the submenu would overflow the right edge of the taskpane (taskpane
   is narrow ~320px), fall back to opening leftward. */
@media (max-width: 420px) {
  .plus-submenu {
    left: auto;
    right: calc(100% + 4px);
  }
}

/* ---- Message Bubbles ---- */
.message-row {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* User message — right-aligned like web /chat */
.message-row.message-user {
  align-items: flex-end;
}

.message-user-bubble {
  display: inline-block;
  background: var(--bg-200);
  border-radius: 12px;
  padding: 10px 16px;
  max-width: 95%;
}

.message-user-text {
  font-size: 0.9375rem;
  line-height: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text-000);
  word-break: break-word;
  white-space: pre-wrap;
}

/* Assistant message — matches ai-conversation.tsx */
.message-row.message-assistant {
  align-items: flex-start;
}

.message-assistant-content {
  position: relative;
  letter-spacing: -0.015em;
  padding-bottom: 4px;
  padding-left: 2px;
  padding-right: 2px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.message-assistant-content .message-content {
  font-size: 0.9375rem;
  line-height: 1.65rem;
  color: var(--text-000);
}

/* ---- Markdown content ----
 * Don't set overflow on the root — pre / table have their own overflow-x.
 * A root overflow-x:auto here was causing a phantom vertical scrollbar in
 * Edge WebView2 when the markdown contained <h2>/<ol> blocks. */
.message-content {
  overflow: visible;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.message-content p {
  margin: 0 0 8px;
}

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

.message-content pre {
  background: var(--bg-200);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
  border: 1px solid var(--border-100);
  max-width: 100%;
  box-sizing: border-box;
}

.message-content code {
  background: var(--bg-200);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  color: var(--text-200);
}

.message-content pre code {
  background: none;
  padding: 0;
  color: var(--text-100);
  white-space: pre-wrap;
  word-break: break-all;
}

.message-content table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
  width: 100%;
  display: block;
  overflow-x: auto;
}

.message-content th,
.message-content td {
  border: 1px solid var(--border-200);
  padding: 6px 10px;
  text-align: left;
}

.message-content th {
  background: var(--bg-300);
  font-weight: 600;
  color: var(--text-200);
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  color: var(--text-000);
  margin: 12px 0 6px;
  font-weight: 600;
}

.message-content h1 { font-size: 1.25rem; }
.message-content h2 { font-size: 1.125rem; }
.message-content h3 { font-size: 1rem; }

.message-content blockquote {
  border-left: 3px solid var(--border-200);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-300);
}

.message-content strong {
  color: var(--text-000);
  font-weight: 600;
}

.message-content a {
  color: var(--text-200);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: var(--text-000);
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-100);
  margin: 12px 0;
}

/* Images in user message */
.message-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.message-image-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-100);
}

/* Attachment in user message */
.message-attachment {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--code-fill);
  border-radius: 6px;
  border: 1px solid var(--border-100);
}

.attachment-label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.attachment-preview {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 11px;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
  color: var(--text-300);
}

/* VibingLoader — pulse dots + text + timer (during streaming, matches web) */
.vibing-loader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 4px;
  color: var(--text-400);
}

.vibing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.vibing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-main);
  animation: vibing-pulse 1.4s ease-in-out infinite;
}

.vibing-dot:nth-child(1) { animation-delay: -0.32s; }
.vibing-dot:nth-child(2) { animation-delay: -0.16s; }
.vibing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes vibing-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.vibing-text {
  font-size: 13px;
  font-weight: 500;
}

.vibing-time {
  font-size: 11px;
  color: var(--text-400);
  opacity: 0.7;
}

/* ---- Attachment Bar ---- */
.attachment-bar {
  display: flex;
  align-items: center;
  padding: 0 14px 6px;
  flex-shrink: 0;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-100);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-200);
  position: relative;
  max-width: 100%;
}

.attachment-pill:hover .attachment-remove {
  opacity: 1;
  pointer-events: auto;
}

.attachment-pill svg {
  flex-shrink: 0;
  color: var(--text-400);
}

.attachment-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-400);
  padding: 2px;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.attachment-remove:hover {
  color: #ef4444;
}

/* ---- Chat Input Area — matches web ai-chat.tsx sidebar mode ---- */
.chat-input-area {
  flex-shrink: 0;
  padding: 0 12px 12px 12px;
}

/* Outer wrapper: shows border normally, gradient border on focus */
.chat-input-box {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  transition: all 0.2s;
}

.chat-input-box:focus-within {
  /* Soft glow only — no darkening of the border itself.
   * Previously we promoted border-color to --accent-main (#171513 in light
   * mode), which read as a hard black outline. Keep the static gray border
   * and let a subtle 4px ring carry the focus signal. */
  border-color: var(--border-200);
  box-shadow:
    0 0 0 4px rgba(23, 21, 19, 0.08),
    0 0 12px 2px rgba(23, 21, 19, 0.06);
}

:root[data-theme="dark"] .chat-input-box:focus-within {
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.10),
    0 0 12px 2px rgba(255, 255, 255, 0.06);
}

/* Inner container: covers the gradient, leaving it visible as a border */
.chat-input-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg-100);
  border-radius: 10px;
}

.chat-input-inner {
  border-radius: 11px;
}

.chat-textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-000);
  font-size: 14px;
  line-height: 1.5rem;
  letter-spacing: -0.025em;
  font-family: inherit;
  padding: 8px;
}

.chat-textarea::placeholder {
  color: var(--text-400);
  font-size: 13px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-400);
  cursor: pointer;
  transition: all 0.15s;
}

.chat-action-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.chat-action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Send button — square icon button matching web light mode (bg-black text-white) */
.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: none;
  background: var(--accent-main);
  color: var(--bg-000);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.chat-send-btn:hover {
  opacity: 0.9;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Stop/loading button — same square size, with breathing animation */
.chat-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-300);
  background: transparent;
  color: var(--text-200);
  cursor: pointer;
  transition: all 0.15s;
}

.chat-stop-btn:hover {
  background: var(--bg-200);
}

/* ---- Uploaded Image Previews ---- */
.uploaded-images-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.uploaded-image-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-100);
}

.uploaded-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploaded-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0;
}

.uploaded-image-thumb:hover .uploaded-image-remove {
  opacity: 1;
}

/* ---- Model Selector ---- */
.model-selector-wrapper {
  position: relative;
}

.model-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.model-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-400);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.model-selector-btn:hover {
  color: var(--text-000);
  background: var(--bg-200);
}

.model-selector-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.model-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-000);
  border: 1px solid var(--border-100);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow-pop);
  z-index: 100;
}

.model-menu::-webkit-scrollbar {
  width: 4px;
}

.model-menu::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 2px;
}

.model-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-300);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.model-menu-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.model-menu-item.active {
  color: var(--text-000);
}

.model-menu-item.active svg {
  color: var(--accent-main);
}

.model-menu-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.model-menu-item-name .model-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.model-menu-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.model-price-multiplier {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-400);
}

.model-recommended-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  flex-shrink: 0;
}

/* "New" — solid accent fill, mirrors web `bg-theme-accent text-white` chip. */
.model-new-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--accent-main);
  color: #fff;
  flex-shrink: 0;
}

/* "Image" — neutral surface chip, mirrors web image-gen badge. */
.model-image-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-200);
  color: var(--text-300);
  border: 1px solid var(--border-300);
  flex-shrink: 0;
}

/* Breathing animation — matches web ai-breathing */
@keyframes ai-breathing {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-breathing {
  animation: ai-breathing 2s ease-in-out infinite;
}

/* ---- Quick Actions (empty state) ---- */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.chat-quick-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-200);
  background: transparent;
  color: var(--text-200);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-quick-btn:hover {
  background: var(--bg-200);
  border-color: var(--border-300);
  color: var(--text-000);
}

/* ---- Content Blocks (interleaved text + tools) ---- */
.content-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---- Tool Call Group (Claude-style collapsible list) ---- */
.tcg-group {
  margin: 8px 0;
}

/* Inside the tree, .tt-step already supplies its own 8px top/bottom spacer
 * via padding — the group's own margin would double that and visibly push
 * the title down so it no longer baselines with the rail icon. */
.tcg-group-in-tree {
  margin: 0;
}

.tcg-group-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-300);
  padding: 4px 0;
  user-select: none;
}

.tcg-group-header:hover {
  color: var(--text-100);
}

.tcg-group-label {
  line-height: 1.4;
}

.tcg-group-items {
  margin-top: 2px;
  /* tree-line now drawn explicitly on each .tt-step-rail; no border-left here */
}

.tcg-item {
  position: relative;
  display: flex;
  flex-direction: column;       /* header on top, details card below */
  min-width: 0;
}

.tcg-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;                   /* tight, Claude px-2.5 py-1 ish */
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-500, var(--text-400));
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;  /* Claude duration-200, color-led */
  flex: 1;
  min-width: 0;
}

.tcg-item-clickable {
  cursor: pointer;
}

/* Progressive brighten on hover, mirrors Claude's hover:text-text-200 hover:text-text-000 */
.tcg-item-clickable:hover {
  color: var(--text-200);
}
.tcg-item-clickable:hover .tcg-item-summary {
  color: var(--text-100);
}

.tcg-item-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-500, var(--text-400));
  transition: color 0.2s;
}

/* Error state — recolor the rail icon red instead of using a status dot.
 * Claude doesn't use status dots; the icon's color carries the signal. */
.tt-step.tt-step-error .tt-step-icon { color: var(--danger-100, #ef4444); }

/* Status dots — kept for legacy non-tree contexts (none currently render),
 * but suppressed inside the tree so we match Claude's icon-only style. */
.tcg-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tcg-status-success { background: #22c55e; }
.tcg-status-error   { background: #ef4444; }
.tcg-status-pending { background: var(--text-400); }
.tcg-group-in-tree .tcg-status-dot { display: none; }

/* Spinner for pending items */
.tcg-spinner {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-400);
}

/* Expanded item details — Claude wraps everything in a single rounded
 * bordered card (`rounded-lg border-[0.5px] border-border-300 bg-bg-000`)
 * with internal `p-2 flex flex-col gap-2 max-h-[200px] overflow-y-auto`. */
.tcg-item-details {
  margin: 4px 10px 8px 10px;
  border-radius: 8px;
  border: 0.5px solid var(--border-300, var(--border-200));
  background: var(--bg-000);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

/* Each section (Parameters / Result) becomes a Claude `bg-bg-100 rounded-md p-3`
 * sub-card with a small label header inside it. */
.tcg-detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--bg-100);
  border-radius: 6px;
}

.tool-detail-label {
  font-size: 11px;          /* Claude text-[0.6875rem] */
  font-weight: 500;
  font-family: var(--font-mono, 'SF Mono', Menlo, monospace);
  color: var(--text-400);
  margin: 0;
  line-height: 1;
  letter-spacing: 0.01em;
}

.tool-detail-result-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-400);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-200, #e0e0e0);
  background: var(--bg-100);
  width: fit-content;
  user-select: none;
  transition: background 0.15s;
}

.tool-detail-result-toggle:hover {
  background: var(--bg-200, #f0f0f0);
}

.tool-detail-code {
  font-family: var(--font-mono, 'SF Mono', 'Cascadia Code', 'Fira Code', Menlo, monospace);
  font-size: 12px;          /* Claude !text-sm in monospace block */
  line-height: 1.55;
  color: var(--text-200);
  background: transparent;  /* sub-card already paints bg-bg-100 */
  border-radius: 0;
  padding: 0;
  margin: 0;
  max-height: none;         /* outer .tcg-item-details owns the scroll */
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Search Results in Expanded Tool ---- */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-200);
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-200);
  line-height: 1.3;
  margin-bottom: 2px;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-400);
  margin-bottom: 2px;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-300);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-link {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Web Fetch Preview ---- */
.web-fetch-preview {
  padding: 10px 12px;
}

.web-fetch-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-100);
  margin-bottom: 4px;
}

.web-fetch-url {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.web-fetch-url:hover {
  text-decoration: underline;
}

.web-fetch-meta {
  font-size: 11px;
  color: var(--text-400);
  margin-bottom: 8px;
}

.web-fetch-content {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-200);
  background: var(--bg-200);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* ---- Message Actions (hover) ---- */
.message-actions-bar {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-end;
  height: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.message-actions-bar.message-actions-visible {
  opacity: 1;
  pointer-events: auto;
}

.message-actions-bar.message-actions-left {
  justify-content: flex-start;
}

.message-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 0.5px solid var(--border-100);
  background: var(--bg-000);
  color: var(--text-300);
  cursor: pointer;
  transition: all 0.15s;
}

.message-action-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

/* AI disclaimer */
.message-disclaimer {
  margin-top: 4px;
  font-size: 0.6875rem;
  line-height: 0.875rem;
  color: var(--text-400);
  text-align: right;
  letter-spacing: -0.01em;
  user-select: none;
}

/* User message edit */
.message-edit-area {
  width: 100%;
  max-width: 95%;
}

.message-edit-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  background: var(--bg-200);
  color: var(--text-000);
  font-size: 0.9375rem;
  line-height: 1.5rem;
  resize: none;
  font-family: inherit;
}

.message-edit-textarea:focus {
  outline: none;
  border-color: var(--border-300);
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.message-edit-cancel,
.message-edit-save {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.message-edit-cancel {
  background: var(--bg-200);
  color: var(--text-200);
  border: 1px solid var(--border-200);
}

.message-edit-cancel:hover {
  background: var(--bg-300);
}

.message-edit-save {
  background: var(--accent-main);
  color: #fff;
}

.message-edit-save:hover {
  opacity: 0.9;
}

/* ---- Messages inner container ---- */
.chat-messages-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 0 4px;
  min-width: 0;
  flex: 1;
}

/* ---- Scroll-to-bottom button ---- */
.scroll-to-bottom-btn {
  position: sticky;
  bottom: 8px;
  align-self: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-200);
  background: var(--bg-100);
  color: var(--text-200);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  z-index: 10;
  transition: background 0.15s;
}
.scroll-to-bottom-btn:hover {
  background: var(--bg-300);
}

/* ---- Scrollbar — light theme ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

/* ---- Fluent UI overrides for light theme ---- */
.fui-FluentProvider {
  background: transparent !important;
}

.fui-Input {
  background: var(--bg-000) !important;
  border-color: var(--border-100) !important;
  color: var(--text-000) !important;
}

.fui-Textarea {
  background: transparent !important;
  border: none !important;
  color: var(--text-000) !important;
}

.fui-Textarea::after {
  display: none !important;
}

.fui-Tab {
  color: var(--text-400) !important;
}

.fui-Tab:hover {
  color: var(--text-200) !important;
}

.fui-Tab[aria-selected="true"] {
  color: var(--text-000) !important;
}

.fui-Button--primary {
  background: var(--accent-main) !important;
  color: var(--bg-300) !important;
  border: none !important;
}

.fui-Button--subtle {
  color: var(--text-300) !important;
}

.fui-Button--subtle:hover {
  background: var(--bg-200) !important;
  color: var(--text-200) !important;
}

.fui-Card {
  background: var(--bg-200) !important;
  border-color: var(--border-100) !important;
}

.fui-Label {
  color: var(--text-200) !important;
}

.fui-Badge {
  color: var(--text-200) !important;
}

/* ---- Recharge promo card ----
   The single "break-from-minimalism" moment in the sidebar.
   Amber radial highlight in the top-right + 🔥 badge + accent color
   on the percentage = conversion-focused without overwhelming the rest
   of the panel. Mirrors web's promo card (unified-sidebar.tsx:2880-2944). */

.promo-card {
  position: relative;
  margin: 8px 8px 4px 8px;
  padding: 14px 12px 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  background: var(--bg-100);
  /* Radial amber highlight in top-right corner — same hue, opacity tuned
     for both modes via blend math (alpha works on either surface). */
  background-image: radial-gradient(
    circle at top right,
    rgba(245, 158, 11, 0.14),
    transparent 60%
  );
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.promo-card__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-400);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}

.promo-card__close:hover {
  background: var(--bg-200);
  color: var(--text-200);
}

.promo-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1.3;
}

.promo-card__hero {
  padding-right: 22px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-000);
  font-variant-numeric: tabular-nums;
}

.promo-card__hero-num {
  font-variant-numeric: tabular-nums;
}

.promo-card__hero-accent {
  color: #d97706;
}

.promo-card__slogan {
  margin: 2px 0 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-400);
}

.promo-card__features {
  margin: 10px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.promo-card__features li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-300);
}

.promo-card__features li svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #10b981;
}

.promo-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent-bg);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, opacity 0.12s;
}

.promo-card__cta:hover {
  opacity: 0.92;
}

.promo-card__cta:active {
  transform: scale(0.985);
}

/* ---- Bottom-anchored section (mirror web's bottomSectionRef block) ----
   Sticks to the bottom of the sidebar. Inside it stack (top → bottom):
   menu card → promo card → user profile button. Layout grows upward as
   menu / promo become visible. */
.sidebar-bottom-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

/* ---- Foldable menu card ----
   Pops up above the user button when isBottomSectionOpen=true. */
.sidebar-menu-card {
  margin: 0 8px 6px 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  background: var(--bg-100);
  box-shadow: var(--shadow-card);
  animation: menu-card-rise 140ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes menu-card-rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sidebar-menu-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-menu-card .sidebar-item {
  padding: 7px 10px;
  border-radius: 8px;
}

.sidebar-menu-card .sidebar-divider {
  margin: 6px 4px;
  background: var(--border-100);
}

/* ---- User profile toggle button ----
   The always-visible bar at the bottom. Click toggles the menu card above. */
.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 0 8px 8px 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  font-family: inherit;
}

.sidebar-user-btn:hover {
  background: var(--bg-200);
  border-color: var(--border-100);
}

.sidebar-user-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Meta row: tier·credits text with the inline "Recharge" link glued to its
   right edge. `gap: 6px` provides the small breathing room between credits
   and the CTA; both shrink together if width is tight (meta truncates first
   because it's the longer string). */
.sidebar-user-meta-row {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.sidebar-user-meta {
  font-size: 11px;
  color: var(--text-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Inline text "Recharge" / "立即充值" CTA — sits immediately after the
   credits string. Amber accent picks up the same hue as the promo card's
   10% highlight and the Coins icon. Rendered as role=button so it nests
   inside the outer user-toggle button without invalid HTML. */
.sidebar-user-recharge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  padding: 1px 6px;
  border-radius: 5px;
  background: transparent;
  color: #d97706;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.12s;
  white-space: nowrap;
}

.sidebar-user-recharge:hover {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.sidebar-user-recharge:active {
  transform: scale(0.96);
}

.sidebar-user-chevron {
  flex-shrink: 0;
  color: var(--text-400);
  transition: transform 0.18s ease;
}

.sidebar-user-chevron-open {
  transform: rotate(180deg);
}

/* ---- Top-nav primary group ---- */
.sidebar-nav-primary,
.sidebar-nav-playful {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ─── Welcome hero icon (empty-state model glyph) ──────────────────────
   The single moment of personality in the empty chat. The active model's
   icon sits in a rounded square tinted with the provider accent. Swaps
   with a gentle "bloom" when the user changes model — fast enough to feel
   responsive, slow enough to register as intentional. */
.welcome-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
  animation: welcome-bloom 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.welcome-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  /* Slight saturation so single-color SVGs (openai, xai) stay readable on
     tinted backgrounds in both modes. */
  filter: saturate(1.05);
}
@keyframes welcome-bloom {
  0%   { opacity: 0; transform: scale(0.85); }
  60%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

/* OpenAI / xAI ship monochromatic SVGs that read black-on-dark. In dark
   mode we invert them so they remain visible inside the accent halo. */
:root[data-theme="dark"] .welcome-icon img[data-mono="true"],
:root[data-theme="dark"] .model-icon[data-mono="true"] {
  filter: invert(1) saturate(0);
}

/* ─── Dark-mode polish for code blocks, badges, gradients ─────────── */
:root[data-theme="dark"] .model-recommended-badge {
  /* Same gradient, lower saturation so it doesn't burn against dark surface */
  background: linear-gradient(135deg, #2563eb, #0891b2);
}

:root[data-theme="dark"] .login-error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.32);
}

:root[data-theme="dark"] .sidebar-item-referral {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(6, 182, 212, 0.10));
}
:root[data-theme="dark"] .sidebar-item-referral:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(6, 182, 212, 0.18));
}

:root[data-theme="dark"] .sidebar-item-danger:hover,
:root[data-theme="dark"] .header-menu-item-danger:hover,
:root[data-theme="dark"] .header-menu-item-delete:hover {
  background: rgba(239, 68, 68, 0.14);
}

/* Active-model row in selector picks up the accent ink */
.model-menu-item.active .model-menu-item-name {
  color: var(--accent-main);
}

/* ── Skills slash autocomplete (Spec §7.2 §8.1) ──────────────────────
   Positioned absolutely against .chat-input-box (which is position:
   relative). Uses the same token palette as .plus-menu / .model-menu so
   it picks up light/dark theming automatically. */
.skills-autocomplete {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 20;
}
.skills-autocomplete__item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--text-100);
}
.skills-autocomplete__item:hover {
  background: var(--bg-200);
}
.skills-autocomplete__name {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-100);
}
.skills-autocomplete__desc {
  font-size: 12px;
  color: var(--text-400);
  margin-top: 2px;
}
.skills-autocomplete__empty,
.skills-autocomplete__loading {
  padding: 12px;
  color: var(--text-400);
  font-size: 13px;
}

/* ── SkillsListPanel — spec §8.1 ─────────────────────────────
   Modal-style overlay opened from the plus menu. A backdrop scrim
   provides visual separation; click-outside / Esc both close.
   Design pass 2026-05-16: styled controls (no native checkbox or bare
   ×), SVG icon-buttons, inline uninstall confirmation, source badges,
   and per-skill glyphs from SkillIcons.
*/
.skills-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 29;
  animation: skills-backdrop-fade 0.18s ease-out;
}
:root[data-theme="dark"] .skills-panel-backdrop {
  background: rgba(0, 0, 0, 0.48);
}
@keyframes skills-backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.skills-panel {
  position: fixed;
  top: 56px;
  right: 12px;
  left: 12px;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 12px;
  max-height: calc(100vh - 72px);
  overflow: hidden;          /* inner list owns the scroll */
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: var(--shadow-card, 0 12px 32px rgba(0, 0, 0, 0.18));
  animation: skills-panel-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes skills-panel-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1);     }
}

.skills-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border-100, var(--border-200));
}
.skills-panel__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-100);
  margin: 0;
  line-height: 1.2;
}
.skills-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--text-400);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.skills-panel__close:hover {
  background: var(--bg-200);
  color: var(--text-100);
}

.skills-panel__loading,
.skills-panel__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-400);
}

.skills-panel__list {
  list-style: none;
  padding: 6px;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.skills-panel__item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.skills-panel__item:hover {
  background: var(--bg-100);
}

.skills-panel__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-100);
  color: var(--text-200);
}
.skills-panel__item:hover .skills-panel__icon {
  background: var(--bg-200);
}

.skills-panel__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.skills-panel__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.skills-panel__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-100);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.skills-panel__desc {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-400);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skills-panel__badge {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.skills-panel__badge--builtin {
  background: var(--bg-200);
  color: var(--text-300);
}

.skills-panel__actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Toggle switch — replaces native checkbox.
 * Track is a rounded pill that recolors when checked; thumb slides via
 * transform so we don't trigger layout work. */
.skills-panel__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.skills-panel__toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.skills-panel__toggle-track {
  display: inline-block;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: var(--bg-300, var(--bg-200));
  border: 1px solid var(--border-200);
  transition: background 0.18s, border-color 0.18s;
  position: relative;
}
.skills-panel__toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg-000);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.skills-panel__toggle input:checked + .skills-panel__toggle-track {
  background: var(--text-100);
  border-color: var(--text-100);
}
.skills-panel__toggle input:checked + .skills-panel__toggle-track .skills-panel__toggle-thumb {
  transform: translateX(13px);
  background: var(--bg-000);
}
.skills-panel__toggle input:focus-visible + .skills-panel__toggle-track {
  box-shadow: 0 0 0 3px rgba(23, 21, 19, 0.10);
}
:root[data-theme="dark"] .skills-panel__toggle input:focus-visible + .skills-panel__toggle-track {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10);
}

/* Trash icon-button — sits next to the toggle for marketplace skills. */
.skills-panel__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--text-400);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.skills-panel__icon-btn:hover {
  background: var(--bg-200);
  color: var(--danger-100, #ef4444);
}

/* Inline confirm row — replaces the browser `confirm()` dialog. */
.skills-panel__confirm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.skills-panel__btn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.skills-panel__btn--ghost {
  background: transparent;
  color: var(--text-300);
  border-color: var(--border-200);
}
.skills-panel__btn--ghost:hover {
  background: var(--bg-200);
  color: var(--text-100);
}
.skills-panel__btn--danger {
  background: var(--danger-100, #ef4444);
  color: var(--bg-000);
  border-color: var(--danger-100, #ef4444);
}
.skills-panel__btn--danger:hover {
  filter: brightness(0.95);
}

/* Primary "Use" CTA — solid ink button, replaces the toggle switch as the
 * row's main action. Uses the same color tokens as the send button so it
 * reads as the intentional next step. */
.skills-panel__btn--primary {
  background: var(--text-100);
  color: var(--bg-000);
  border-color: var(--text-100);
  padding: 0 12px;
}
.skills-panel__btn--primary:hover {
  filter: brightness(1.15);
}
:root[data-theme="dark"] .skills-panel__btn--primary:hover {
  filter: brightness(0.9);
}

/* ============================================================
 * ThinkingTree — Claude-aligned step tree
 * Width budget: 320–420px task pane.
 * ============================================================ */

.tt-root {
  margin: 6px 0 8px;
  display: flex;
  flex-direction: column;
}

.tt-summary-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;                /* chevron hugs the text (Claude: gap-1) */
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-500, var(--text-400));
  padding: 4px 0;
  user-select: none;
  transition: color 0.15s;
  background: none;
  border: none;
  max-width: 100%;         /* don't overflow narrow task pane */
  min-width: 0;
}

.tt-summary-row:hover { color: var(--text-300); }

.tt-summary-label {
  line-height: 1.4;
  /* no flex: 1 — let the chevron sit immediately after the text */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.tt-body {
  max-height: 4000px;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  margin-top: 2px;
}

.tt-body.tt-collapsed {
  max-height: 0;
}

/* Claude-style rail topology: each step renders a continuous 1px column on the
 * rail side, drawn explicitly via ::before (top 8px spacer) and ::after
 * (bottom 8px spacer) so the line "flows" through every step. First step
 * hides ::before, last step hides ::after — matches Claude HTML exactly. */
.tt-step {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 8px 0;            /* the spacer halves; ::before/::after live here */
  min-height: 0;
}

.tt-step::before,
.tt-step::after {
  content: "";
  position: absolute;
  left: 9.5px;               /* center inside the 20px icon column */
  width: 1px;
  background: var(--border-200);
  pointer-events: none;
}

/* Geometry inside the padded .tt-step (padding: 8px 0):
 *   y=0..8    → top spacer
 *   y=8..13   → rail padding-top (5px, baseline-aligns icon to 13/1.4 text)
 *   y=13..29  → 16px icon
 *   y=29..end → details / bottom spacer
 * Line is drawn ABOVE the icon (::before) and BELOW the icon (::after),
 * letting the icon visually "interrupt" the rail like Claude's HTML. */
.tt-step::before { top: 0;    height: 11px; }    /* end 2px before icon top to leave a hairline gap */
.tt-step::after  { top: 31px; bottom: 0;   }    /* start 2px after icon bottom */

/* First step: no line above its icon. Last step: no line below its icon. */
.tt-step:first-child::before { display: none; }
.tt-step:last-child::after { display: none; }

/* Dark mode: brighter rail for contrast on dark bg */
:root[data-theme="dark"] .tt-step::before,
:root[data-theme="dark"] .tt-step::after {
  background: rgba(255, 255, 255, 0.18);
}

.tt-step-rail {
  width: 20px;               /* Claude: w-[20px] */
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5px;          /* aligns 16px icon center with 13px/1.4 text baseline-center */
  position: relative;
  z-index: 1;                /* icon sits above the ::before/::after line */
}

.tt-step-icon {
  color: var(--text-500, var(--text-400));
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Legacy node — kept so existing JSX doesn't break, but we no longer draw it. */
.tt-step-line { display: none; }

.tt-step-content {
  flex: 1;
  min-width: 0;
  padding: 2px 0 0 0;       /* button (.tcg-item-header) owns its own px-2.5 */
  animation: tt-step-enter 0.2s ease-out;
}

/* Thinking-text and Done rows don't sit inside a button, so they need to
 * supply the same px-2.5 the tool-row button has, for column alignment. */
.tt-step-thinking-text { padding-left: 10px; }

@keyframes tt-step-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tt-step-thinking-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-400);
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

.tt-step-thinking-text.tt-fade {
  position: relative;
  max-height: 6.4em;
  overflow: hidden;
}

.tt-step-thinking-text.tt-fade::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.6em;
  background: linear-gradient(to top, var(--bg-100), transparent);
  pointer-events: none;
}

.tt-step-show-more {
  background: none;
  border: none;
  padding: 4px 0 0;
  font-size: 11px;
  color: var(--text-400);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tt-step-show-more:hover { color: var(--text-200); }

/* ============================================================
 * Inline citation chip
 * ============================================================ */

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  max-width: 120px;
  padding: 0 6px;
  margin: 0 2px;
  border-radius: 9px;
  border: 0.5px solid var(--border-200);
  background: var(--bg-200);
  color: var(--text-300);
  font-size: 11.5px;
  font-weight: 400;
  text-decoration: none !important;
  vertical-align: baseline;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.citation-chip .citation-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-chip .citation-chip-arrow {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  flex-shrink: 0;
}

.citation-chip:hover {
  background: var(--bg-300);
  border-color: var(--border-300);
  color: var(--text-100);
}

.citation-chip:hover .citation-chip-arrow {
  opacity: 1;
  transform: scale(1);
}

/* ============================================================
 * Streaming caret — pulses at trailing edge of live text
 * ============================================================ */

.streaming-caret {
  display: inline-block;
  width: 0.55ch;
  margin-left: 1px;
  color: var(--text-300);
  animation: streaming-caret-pulse 1s ease-in-out infinite;
}

@keyframes streaming-caret-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ============================================================
 * Typography overrides — final response prose
 * ============================================================ */

/* Overrides .message-content h3 / h1..h4 declarations earlier in this file
 * (around lines 1031 & 1041). Same specificity → source order wins. */
.message-content {
  font-size: 14px;
  color: var(--text-100);
}

.message-content h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-000);
  margin: 12px 0 -4px;
}

/* ============================================================
 * Message action bars — assistant (4 buttons) + user (3 buttons + time)
 *
 * Note: base .message-actions-bar (around line 1839) sets opacity:0 +
 * pointer-events:none; visibility is toggled via .message-actions-visible.
 * The variants below only customize layout/sizing — they inherit that gate.
 * ============================================================ */

.message-actions-bar.message-actions-assistant {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-top: 6px;
}

.message-actions-bar.message-actions-assistant .message-action-btn {
  width: 28px;
  height: 28px;
}

.message-actions-bar.message-actions-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}

.message-actions-bar.message-actions-user .message-action-btn {
  width: 24px;
  height: 24px;
}

.message-timestamp {
  font-size: 11px;
  color: var(--text-400);
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

.message-action-feedback-active {
  color: var(--text-100) !important;
}

.message-disclaimer {
  display: block;
  font-size: 11px;
  color: var(--text-400);
  padding-top: 4px;
  line-height: 1.4;
}

