:root {
  --app-bg: #f0f4f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --brand: #0b1222;
  --brand-soft: #162033;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-soft: #cffafe;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(11, 18, 34, 0.06);
  --shadow-md: 0 10px 24px rgba(11, 18, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body.app-body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1300px 500px at 20% -20%, rgba(6, 182, 212, 0.07), transparent 60%),
    radial-gradient(1200px 600px at 100% -10%, rgba(11, 18, 34, 0.06), transparent 70%),
    var(--app-bg);
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-soft) 100%);
  color: #e2e8f0;
  border-right: 1px solid rgba(148, 163, 184, 0.2);
}

.app-sidebar a,
.app-sidebar button {
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  color: #cbd5e1;
  padding: 0.6rem 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}

.app-nav-link:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #f8fafc;
}

.app-nav-link.active {
  background: rgba(6, 182, 212, 0.22);
  color: #cffafe;
}

.app-main {
  min-height: 100vh;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.page-frame {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.25rem;
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
}

.card-surface-elevated {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0b1222;
  line-height: 1.2;
}

.section-subtitle {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  border-radius: 0.75rem;
  padding: 0.56rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.25);
}

.btn-secondary {
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.56rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: #f8fafc;
}

.badge-soft {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0f172a;
  background: #f8fafc;
}

.metric-value {
  font-size: 1.7rem;
  line-height: 1.1;
  font-weight: 700;
  color: #0f172a;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.79rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.notice-banner {
  border-radius: 0.9rem;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
  padding: 0.75rem 1rem;
}

.alert-banner {
  border-radius: 0.9rem;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  padding: 0.75rem 1rem;
}

.chat-scroll {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.chat-scroll::-webkit-scrollbar {
  width: 8px;
}

.chat-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.chat-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.messages-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 5rem;
}

.chat-empty-state {
  width: min(560px, 100%);
  border: 1px dashed #a5f3fc;
  border-radius: 1.1rem;
  background:
    linear-gradient(160deg, rgba(6, 182, 212, 0.08), rgba(11, 18, 34, 0.03)),
    #f8fafc;
  padding: 1.4rem 1.2rem;
  text-align: center;
}

.chat-empty-icon {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-empty-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.chat-empty-copy {
  margin: 0.35rem 0 0;
  color: #475569;
  font-size: 0.87rem;
}

.chat-empty-prompts {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.chat-empty-prompt {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.24rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.chat-empty-prompt:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.chat-empty-prompt:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 1px;
}

.floating-composer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(240, 244, 248, 0), var(--app-bg) 22%, var(--app-bg) 100%);
  padding-top: 0.75rem;
  backdrop-filter: blur(2px);
}

.voice-state {
  font-size: 0.74rem;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.voice-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #94a3b8;
}

.voice-dot.recording {
  background: #dc2626;
  animation: pulseDot 0.9s ease-in-out infinite alternate;
}

.voice-fallback {
  border: 1px solid #fbcfe8;
  border-radius: 0.85rem;
  background: #fff1f2;
  padding: 0.6rem 0.75rem;
}

.voice-fallback-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9f1239;
}

.voice-fallback-copy {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
  color: #9f1239;
}

.chat-model-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-model-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.chat-model-select {
  min-width: 13.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.62rem;
  background: #fff;
  color: #0f172a;
  font-size: 0.74rem;
  padding: 0.28rem 0.5rem;
}

.chat-model-select:disabled {
  opacity: 0.65;
}

.chat-capabilities {
  border: 1px solid #a5f3fc;
  border-radius: 0.85rem;
  background: #f0fdfa;
  padding: 0.55rem 0.7rem;
}

.chat-capabilities > summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: #164e63;
  list-style: none;
}

.chat-capabilities > summary::-webkit-details-marker {
  display: none;
}

.chat-capabilities-body {
  margin-top: 0.45rem;
}

.chat-capabilities-intro {
  margin: 0;
  font-size: 0.73rem;
  color: #334155;
}

.chat-capability-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.chat-capability-item {
  border: 1px solid #a5f3fc;
  border-radius: 0.7rem;
  background: #ffffff;
  padding: 0.45rem 0.55rem;
}

.chat-capability-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.chat-capability-title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0f172a;
}

.chat-capability-detail {
  margin: 0.32rem 0 0;
  font-size: 0.71rem;
  color: #334155;
}

.chat-capability-link {
  margin-top: 0.3rem;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0891b2;
  text-decoration: none;
}

.chat-capability-link:hover {
  text-decoration: underline;
}

@keyframes pulseDot {
  from {
    transform: scale(0.85);
    opacity: 0.7;
  }
  to {
    transform: scale(1.1);
    opacity: 1;
  }
}

.status-pill {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-success {
  color: #065f46;
  background: #d1fae5;
}

.status-warning {
  color: #92400e;
  background: #fef3c7;
}

.status-error {
  color: #991b1b;
  background: #fee2e2;
}

.status-neutral {
  color: #334155;
  background: #e2e8f0;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

@media (max-width: 1023px) {
  .page-frame {
    padding: 1rem;
  }
}

/* Chat premium upgrade */
#chat-container {
  overflow-x: hidden;
}

#messages-container {
  overflow-x: hidden;
}

.chat-scroll {
  overflow-x: hidden;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 0.68rem;
  margin-bottom: 0.8rem;
  min-width: 0;
  animation: chatMessageIn 180ms ease-out;
}

.chat-message--user {
  justify-content: flex-end;
}

.chat-message-avatar {
  margin-top: 0.1rem;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-message-avatar--assistant {
  background: #ecfeff;
  color: #475569;
}

.chat-message-avatar--user {
  background: #cbd5e1;
  color: #475569;
}

.chat-message-bubble {
  min-width: 0;
  border-radius: 1rem;
  padding: 0.82rem 0.95rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.chat-message-bubble--user {
  max-width: min(58%, 38rem);
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  color: #fff;
}

.chat-message-bubble--assistant {
  max-width: min(70%, 44rem);
  background: #fff;
  color: #1e293b;
  border-color: #e2e8f0;
}

.chat-message-bubble--error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff7f7 0%, #fff1f2 100%);
  color: #991b1b;
}

.chat-error-topline {
  margin-bottom: 0.35rem;
  color: #dc2626;
  font-weight: 700;
  line-height: 1;
}

.chat-error-icon {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid #fecaca;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  background: #ffe4e6;
}

.chat-message-footer {
  margin-top: 0.42rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.chat-message-meta {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.2;
}

.chat-message-meta--user {
  color: #cffafe;
}

.chat-message-meta--assistant {
  color: #94a3b8;
}

.chat-meta-badge {
  margin-left: 0.35rem;
  border: 1px solid #a5f3fc;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.67rem;
  font-weight: 600;
  color: #164e63;
  background: #ecfeff;
  display: inline-flex;
  align-items: center;
}

.chat-meta-link {
  margin-left: 0.35rem;
  font-size: 0.67rem;
  font-weight: 600;
  color: #0891b2;
  text-decoration: none;
}

.chat-meta-link:hover {
  text-decoration: underline;
}

.chat-error-label {
  margin-left: 0.38rem;
  color: #fca5a5;
  font-weight: 600;
}

.chat-retry-button {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1;
  transition: background-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.chat-retry-button:hover {
  background: #fee2e2;
}

.chat-retry-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.chat-retry-button.is-loading {
  opacity: 0.75;
}

.chat-retry-button.hidden {
  display: none;
}

.chat-error-hint {
  margin: 0.45rem 0 0;
  font-size: 0.73rem;
  color: #be123c;
}

.message-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.floating-composer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(240, 244, 248, 0) 0%, rgba(240, 244, 248, 0.9) 24%, #f0f4f8 100%);
  padding-top: 0.72rem;
  backdrop-filter: blur(7px);
}

.chat-composer-shell {
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 0.9rem;
  padding: 0.6rem;
}

.chat-connection-banner {
  margin-bottom: 0.6rem;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  border-radius: 0.75rem;
  padding: 0.45rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.3;
}

.chat-connection-banner.hidden {
  display: none;
}

.chat-connection-banner p {
  margin: 0;
}

.chat-connection-reconnect {
  border: 1px solid #d97706;
  background: #fff;
  color: #b45309;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.chat-connection-reconnect:hover {
  background: #fef3c7;
}

.chat-connection-reconnect.hidden {
  display: none;
}

.chat-connection-reconnect:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.chat-task-hint {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: #475569;
}

.chat-task-mode-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #164e63;
}

.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.chat-quick-action {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 0.2rem 0.58rem;
  font-size: 0.7rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-quick-action:hover {
  background: #f8fafc;
  border-color: #67e8f9;
}

.chat-composer-input {
  min-height: 2.6rem;
  max-height: 10rem;
  padding-right: 2.1rem;
  resize: none;
  line-height: 1.42;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.chat-composer-input:focus {
  outline: none;
}

.chat-composer-input:focus-visible {
  border-color: #22d3ee;
  outline: 2px solid rgba(34, 211, 238, 0.35);
  outline-offset: 0;
  box-shadow: none;
}

.chat-send-button {
  min-width: 3rem;
  min-height: 2.35rem;
}

.chat-send-button.is-disabled,
.chat-send-button:disabled {
  opacity: 0.58;
}

.chat-send-button.is-sending {
  cursor: wait;
}

.chat-voice-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chat-voice-compact-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
}

.chat-voice-compact-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chat-voice-menu-wrap {
  position: relative;
}

.chat-voice-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 10;
  min-width: 14rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.4rem;
  background: #fff;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 0.35rem;
}

.chat-voice-menu .btn-secondary {
  width: 100%;
  justify-content: flex-start;
  border-radius: 0.62rem;
  white-space: nowrap;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  line-height: 1.25;
}

.chat-message--typing .chat-message-bubble,
.chat-message--streaming .chat-message-bubble {
  max-width: min(74%, 50rem);
}

.conversation-pagination-meta {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  color: #64748b;
}

.conversation-pagination .pagination {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.conversation-pagination .pagination a,
.conversation-pagination .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  color: #334155;
  text-decoration: none;
}

.conversation-pagination .pagination .current {
  border-color: #22d3ee;
  background: var(--accent-soft);
  color: #164e63;
  font-weight: 700;
}

.conversation-pagination .pagination .disabled {
  opacity: 0.55;
}

@keyframes chatMessageIn {
  from {
    transform: translateY(6px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  #messages-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .chat-message {
    gap: 0.48rem;
    margin-bottom: 0.66rem;
  }

  .chat-message-avatar {
    width: 1.7rem;
    height: 1.7rem;
  }

  .chat-message-bubble--user {
    max-width: 88%;
  }

  .chat-message-bubble--assistant,
  .chat-message--typing .chat-message-bubble,
  .chat-message--streaming .chat-message-bubble {
    max-width: 92%;
  }

  .chat-message-bubble {
    padding: 0.7rem 0.8rem;
    border-radius: 0.86rem;
  }

  .floating-composer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .chat-composer-shell {
    border-radius: 0.8rem;
    padding: 0.5rem;
  }

  .chat-voice-compact {
    align-items: stretch;
  }

  .chat-voice-compact-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .chat-connection-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-voice-menu {
    left: 0;
    right: auto;
    min-width: min(16rem, calc(100vw - 2.2rem));
  }

  .chat-model-picker {
    width: 100%;
    justify-content: space-between;
  }

  .chat-model-select {
    min-width: 0;
    width: 100%;
  }

  .chat-capability-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-quick-actions {
    gap: 0.35rem;
  }

  .chat-quick-action {
    font-size: 0.68rem;
  }
}

/* ── Markdown content in chat messages ── */

.markdown-content {
  line-height: 1.65;
  word-break: break-word;
}

.markdown-content > *:first-child {
  margin-top: 0;
}

.markdown-content > *:last-child {
  margin-bottom: 0;
}

.markdown-content p {
  margin: 0.5em 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 1em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
}

.markdown-content h1 { font-size: 1.4em; }
.markdown-content h2 { font-size: 1.25em; }
.markdown-content h3 { font-size: 1.1em; }
.markdown-content h4 { font-size: 1em; }

.markdown-content strong {
  font-weight: 600;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content del {
  text-decoration: line-through;
  opacity: 0.7;
}

.markdown-content mark {
  background: #fef08a;
  padding: 0.1em 0.25em;
  border-radius: 0.2em;
}

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

.markdown-content a:hover {
  color: var(--accent-hover);
}

.markdown-content ul,
.markdown-content ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content li {
  margin: 0.25em 0;
}

.markdown-content li > p {
  margin: 0.25em 0;
}

.markdown-content li > ul,
.markdown-content li > ol {
  margin: 0.15em 0;
}

.markdown-content blockquote {
  margin: 0.75em 0;
  padding: 0.5em 1em;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  border-radius: 0 0.4em 0.4em 0;
  color: var(--text-muted);
}

.markdown-content blockquote > *:first-child {
  margin-top: 0;
}

.markdown-content blockquote > *:last-child {
  margin-bottom: 0;
}

.markdown-content hr {
  margin: 1em 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* Inline code */
.markdown-content code.inline-code,
.markdown-content :not(pre) > code {
  background: #f1f5f9;
  color: #be185d;
  padding: 0.15em 0.4em;
  border-radius: 0.3em;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

/* Code blocks */
.markdown-content .code-block,
.markdown-content pre {
  margin: 0.75em 0;
  border-radius: 0.6em;
  overflow: hidden;
}

.markdown-content .code-block {
  background: #0f172a;
}

.markdown-content .code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45em 0.85em;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.markdown-content .code-block-lang {
  font-size: 0.72em;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.markdown-content .code-block-copy {
  font-size: 0.72em;
  color: #94a3b8;
  background: transparent;
  border: 1px solid #475569;
  border-radius: 0.3em;
  padding: 0.2em 0.55em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.markdown-content .code-block-copy:hover {
  color: #e2e8f0;
  border-color: #64748b;
}

.markdown-content pre.highlight,
.markdown-content .code-block pre {
  margin: 0;
  padding: 0.85em;
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.82em;
  line-height: 1.55;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.markdown-content pre.highlight code,
.markdown-content .code-block code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Standalone pre without code-block wrapper (client-side marked) */
.markdown-content > pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.85em;
  border-radius: 0.6em;
  overflow-x: auto;
  font-size: 0.82em;
  line-height: 1.55;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.markdown-content > pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Tables */
.markdown-content table {
  margin: 0.75em 0;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

.markdown-content th,
.markdown-content td {
  padding: 0.45em 0.7em;
  border: 1px solid var(--border);
  text-align: left;
}

.markdown-content th {
  background: var(--surface-soft);
  font-weight: 600;
  color: var(--text);
}

.markdown-content tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.5);
}

/* Rouge syntax highlighting tokens (midnight navy theme) */
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs { color: #64748b; font-style: italic; } /* comments */
.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt { color: #c084fc; } /* keywords */
.highlight .s,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .s1,
.highlight .ss { color: #86efac; } /* strings */
.highlight .na,
.highlight .nb,
.highlight .nc,
.highlight .no,
.highlight .nd,
.highlight .ni,
.highlight .ne,
.highlight .nf,
.highlight .nl,
.highlight .nn,
.highlight .nt,
.highlight .nv { color: #7dd3fc; } /* names */
.highlight .o,
.highlight .ow { color: #fbbf24; } /* operators */
.highlight .m,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo { color: #f9a8d4; } /* numbers */
.highlight .p { color: #e2e8f0; } /* punctuation */
.highlight .err { color: #fca5a5; } /* errors */
