@font-face {
  font-family: 'IRANSansX';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/IRANSansXFaNum-LightD4.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSansX';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/IRANSansXFaNum-RegularD4.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSansX';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/IRANSansXFaNum-MediumD4.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSansX';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/IRANSansXFaNum-BoldD4.woff2') format('woff2');
}

/* ============================================
   Claude design system — warm dark with copper
   accent. Matches the Claude desktop app palette.
   ============================================ */
:root {
  /* Surfaces (warm near-black hierarchy) */
  --bg: #1c1b1a;
  --bg-secondary: #262524;
  --bg-elevated: #302f2c;
  --bg-soft: #21201f;

  /* Borders — warm whites at low alpha */
  --border: rgba(245, 240, 230, 0.08);
  --border-strong: rgba(245, 240, 230, 0.14);

  /* Text (warm cream-white, off-pure to feel paper-like) */
  --text: #e8e3d8;
  --text-muted: #8a8378;
  --text-subtle: rgba(232, 227, 216, 0.38);

  /* Brand: Claude copper */
  --accent: #cc785c;
  --accent-2: #b85d44;
  --accent-text: #ffffff;
  --accent-soft: rgba(204, 120, 92, 0.14);
  --link: #cc785c;

  /* Status — desaturated, warm tones */
  --success: #7ba98b;
  --warn: #d4a574;
  --danger: #d27575;

  /* Code / tool surfaces */
  --code-bg: rgba(0, 0, 0, 0.30);
  --code-text: #e8d4be;
  --tool-bg: #232220;
  --user-bg: rgba(204, 120, 92, 0.13);

  /* Brand gradient (logo, hero) */
  --gradient: linear-gradient(135deg, #cc785c 0%, #b85d44 100%);
}

@media (prefers-color-scheme: light) {
  :root {
    /* Claude cream light mode */
    --bg: #faf9f5;
    --bg-secondary: #f3f1ec;
    --bg-elevated: #ffffff;
    --bg-soft: #f7f5f0;

    --border: rgba(26, 25, 24, 0.08);
    --border-strong: rgba(26, 25, 24, 0.14);

    --text: #1c1b1a;
    --text-muted: #6b645b;
    --text-subtle: rgba(28, 27, 26, 0.42);

    --accent: #b85d44;          /* slightly darker copper for contrast on cream */
    --accent-soft: rgba(184, 93, 68, 0.10);
    --link: #b85d44;

    --success: #4f8261;
    --warn: #b07a3a;
    --danger: #b04848;

    --code-bg: rgba(0, 0, 0, 0.04);
    --code-text: #6b3d24;
    --tool-bg: #f3f1ec;
    --user-bg: rgba(184, 93, 68, 0.08);
  }
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'IRANSansX', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#root {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- View containers ---------- */
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

/* ---------- Topbar ---------- */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 12px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.topbar-title-chat { flex-direction: column; align-items: flex-start; gap: 0; }
.logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--gradient);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.topbar-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
  flex-shrink: 0;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg-elevated); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- CWD bar (clickable: opens file browser) ---------- */
.cwd-bar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 13px;
  width: 100%;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
  text-align: right;
}
.cwd-bar:hover, .cwd-bar:active {
  background: var(--bg-elevated);
}
.cwd-path {
  flex: 1;
  font-family: 'SF Mono', Menlo, monospace;
  color: var(--text-muted);
  direction: ltr;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Section header ---------- */
.section-header {
  flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 16px 8px;
}
.section-header h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Buttons ---------- */
.primary-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: opacity 0.12s;
}
.primary-btn:hover { opacity: 0.9; }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.text-btn {
  background: transparent;
  border: none;
  color: var(--link);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
}
.text-btn:hover { opacity: 0.8; }

/* ---------- Sessions list ---------- */
.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 16px;
  -webkit-overflow-scrolling: touch;
}
.session-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
  position: relative;
}
.session-card:hover { border-color: var(--border-strong); }
.session-card:active { transform: scale(0.98); }
.session-title {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.session-meta {
  display: flex; gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.session-meta .dot { opacity: 0.4; }
.session-delete {
  position: absolute;
  top: 8px; left: 8px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.session-card:hover .session-delete { opacity: 0.6; }
.session-delete:hover { opacity: 1; color: var(--danger); }

/* ---------- Empty state ---------- */
.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px 24px;
  color: var(--text);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.7; }
.empty-state .muted { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- Chat events list ---------- */
.events-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.event {
  border-radius: 14px;
  padding: 12px 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.event-user {
  background: var(--user-bg);
  border: 1px solid var(--border-strong);
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
}
.event-assistant {
  background: transparent;
  padding: 4px 0;
}
.event-system {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
  align-self: center;
  max-width: 90%;
  text-align: center;
}
.event-result {
  background: rgba(123, 169, 139, 0.08);
  border: 1px solid rgba(123, 169, 139, 0.24);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  direction: rtl;
}
.event-error {
  background: rgba(210, 117, 117, 0.10);
  border: 1px solid rgba(210, 117, 117, 0.28);
  color: var(--danger);
  text-align: right;
  direction: rtl;
}
.event-result .num,
.event-error .num {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  unicode-bidi: isolate;
  direction: ltr;
  margin: 0 3px;
  display: inline-block;
}
.event-streaming {
  opacity: 0.85;
}

.event-text { white-space: pre-wrap; }
.event-text:empty::before { content: '…'; opacity: 0.5; }

.event-tool {
  background: var(--tool-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  margin: 6px 0;
  overflow: hidden;
}
.tool-header {
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.tool-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
/* Tool semantic colors — warm, desaturated; still distinguishable */
.tool-icon-Read { background: rgba(112, 152, 188, 0.16); color: #7098bc; }
.tool-icon-Edit, .tool-icon-Write { background: rgba(204, 120, 92, 0.16); color: var(--accent); }
.tool-icon-Bash { background: rgba(123, 169, 139, 0.16); color: #7ba98b; }
.tool-icon-Glob, .tool-icon-Grep { background: rgba(212, 165, 116, 0.16); color: #d4a574; }
.tool-icon-Task { background: rgba(186, 122, 158, 0.16); color: #ba7a9e; }
.tool-icon-default { background: var(--bg-elevated); color: var(--text-muted); }
.tool-name { font-weight: 500; font-family: 'SF Mono', Menlo, monospace; font-size: 13px; }
.tool-summary {
  flex: 1;
  color: var(--text-muted);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-arrow {
  color: var(--text-subtle);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.tool-open .tool-arrow { transform: rotate(90deg); }
.tool-body {
  display: none;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.tool-open .tool-body { display: block; }
.tool-section { margin-top: 10px; }
.tool-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.tool-section pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
}
.tool-status {
  margin-right: auto;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.tool-status.success { background: rgba(123, 169, 139, 0.16); color: var(--success); }
.tool-status.error { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.tool-status.running { background: rgba(204, 120, 92, 0.16); color: var(--accent); }
.tool-status.running::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* TodoWrite custom card */
.event-todos {
  background: rgba(123, 169, 139, 0.07);
  border: 1px solid rgba(123, 169, 139, 0.24);
  padding: 0;
  overflow: hidden;
}
.todos-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(123, 169, 139, 0.08);
  border-bottom: 1px solid rgba(123, 169, 139, 0.18);
}
.todos-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.todos-count {
  margin-right: auto;
  font-size: 12px;
  font-family: 'SF Mono', Menlo, monospace;
  color: var(--text-muted);
  direction: ltr;
}
.todos-list {
  padding: 8px 12px 12px;
  max-height: 360px;
  overflow-y: auto;
}
.todos-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 12px;
}
.todo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.6;
}
.todo-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-weight: 700;
  margin-top: 1px;
}
.todo-text {
  flex: 1;
  word-break: break-word;
}
.todo-done .todo-icon { color: var(--success); }
.todo-done .todo-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(140, 140, 140, 0.4);
}
.todo-active .todo-icon { color: var(--accent); animation: ss-pulse 1.4s infinite; }
.todo-active .todo-text {
  color: var(--text);
  font-weight: 500;
}
.todo-pending .todo-icon { color: var(--text-subtle); }
.todo-pending .todo-text { color: var(--text-muted); }

/* code block in assistant text */
.event-assistant pre, .event-text pre, .event-user pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
}
.event-assistant code, .event-text code, .event-user code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  direction: ltr;
  display: inline-block;
}

/* ---------- Usage modal ---------- */
.usage-section {
  margin-bottom: 18px;
}
.usage-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.usage-row-label {
  color: var(--text);
  font-weight: 500;
}
.usage-row-value {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  direction: ltr;
}
.usage-row-value.muted { color: var(--text-muted); }
.usage-row-value.success { color: var(--success); }
.usage-row-value.warn { color: var(--warn); }
.usage-row-value.danger { color: var(--danger); }
.usage-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.usage-note strong { color: var(--text); }

/* ---------- Streaming status bar ---------- */
.streaming-status {
  flex-shrink: 0;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.ss-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: ss-pulse 1.2s infinite;
  flex-shrink: 0;
}
@keyframes ss-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}
.ss-status {
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
}
.ss-elapsed, .ss-tokens {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  direction: ltr;
  unicode-bidi: isolate;
}
.ss-sep { color: var(--text-subtle); font-size: 14px; }
.streaming-status.done .ss-dot {
  background: var(--success);
  animation: none;
}
.streaming-status.done .ss-status { color: var(--success); }

/* ---------- Composer ---------- */
.composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.composer textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  resize: none;
  outline: none;
  max-height: 140px;
  line-height: 1.6;
}
.composer textarea:focus { border-color: var(--accent); }
.composer textarea:disabled { opacity: 0.6; }
.send-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.12s, transform 0.12s;
}
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn svg { transform: scaleX(-1); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadein 0.18s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal input, .modal textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 20px;
  right: 50%;
  transform: translateX(50%);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  animation: slidein 0.25s;
  max-width: 90%;
}
@keyframes slidein {
  from { opacity: 0; transform: translate(50%, -10px); }
  to { opacity: 1; transform: translate(50%, 0); }
}
.toast.error { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }

/* ---------- Files browser ---------- */
.breadcrumb {
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-family: 'SF Mono', Menlo, monospace;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: nowrap;
}
.breadcrumb-segment {
  color: var(--accent);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.breadcrumb-segment:hover { background: var(--accent-soft); }
.breadcrumb-sep { color: var(--text-subtle); flex-shrink: 0; padding: 0 2px; }

.files-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.file-row:hover, .file-row:active { background: var(--bg-secondary); }
.file-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.file-row.is-dir .file-icon { background: rgba(112, 152, 188, 0.16); color: #7098bc; }
.file-row.is-html .file-icon { background: rgba(204, 120, 92, 0.18); color: var(--accent); }
.file-row.is-image .file-icon { background: rgba(123, 169, 139, 0.16); color: #7ba98b; }
.file-row.is-code .file-icon { background: rgba(186, 122, 158, 0.16); color: #ba7a9e; }
.file-info {
  flex: 1;
  min-width: 0;
}
.file-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex; gap: 8px;
}
.file-arrow {
  color: var(--text-subtle);
  flex-shrink: 0;
}
.files-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

/* ---------- Preview view ---------- */
.preview-frame-wrap {
  flex: 1;
  position: relative;
  background: white;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .preview-frame-wrap { background: #0d1117; }
}
.preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}
.preview-text {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
}
.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-secondary);
}
.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
  pointer-events: none;
}

/* ---------- Tool card preview button ---------- */
.tool-preview-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.tool-preview-btn:hover { opacity: 0.88; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
