/* Styles spécifiques pour Mazak Assistant — iOS-native mobile + desktop */

/* --- Design tokens (light / dark) --- */

:root {
  --bg-app: #f2f2f7;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #e5e5ea;
  --border: rgba(60, 60, 67, 0.12);
  --text: #1c1c1e;
  --text-secondary: #8e8e93;
  --accent: #ff5901;
  --accent-hover: #e64e00;
  --accent-soft: #fff0e6;
  --accent-soft-hover: #ffe4d1;
  --accent-border: #ffd1b3;
  --accent-text: #cc4700;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

.dark {
  --bg-app: #000000;
  --bg-surface: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --bg-muted: #3a3a3c;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --text-secondary: #8e8e93;
  --accent-soft: rgba(255, 89, 1, 0.18);
  --accent-soft-hover: rgba(255, 89, 1, 0.28);
  --accent-border: rgba(255, 89, 1, 0.4);
  --accent-text: #ff9f6b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

html {
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Full viewport shell (dvh avoids iOS Safari 100vh bug) */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
}

/* Tools-first shell and workshop dashboard */
.desktop-sidebar { width: 15.5rem; flex-direction: column; padding: 1rem; background: var(--bg-surface); border-right: 1px solid var(--border); }
.desktop-sidebar .sidebar-brand { display: grid; gap: .8rem; height: auto; padding: .5rem; }
.atelier-pill { width: fit-content; border: 1px solid var(--accent-border); border-radius: 999px; color: var(--accent-text); background: var(--accent-soft); padding: .25rem .5rem; font-size: .7rem; font-weight: 600; }
.desktop-nav { display: grid; gap: .35rem; margin-top: 1.5rem; }
.desktop-nav .nav-item, #mobile-tabbar button { min-height: 44px; display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: .85rem; color: var(--text-secondary); }
.desktop-nav svg, #mobile-tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-item.is-active, #mobile-tabbar button.is-active { background: var(--accent-soft); color: var(--accent); box-shadow: 0 4px 12px rgba(255,89,1,.12); }
#mobile-tabbar { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4,1fr); padding: .35rem max(.45rem, env(safe-area-inset-right)) calc(.35rem + env(safe-area-inset-bottom)) max(.45rem, env(safe-area-inset-left)); background: var(--bg-surface); background: color-mix(in srgb, var(--bg-surface) 88%, transparent); border-top: 1px solid var(--border); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
#mobile-tabbar button { flex-direction: column; justify-content: center; gap: .15rem; padding: .2rem; font-size: .68rem; }
#mobile-tabbar svg { width: 19px; height: 19px; }
main { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.chat-history { background: var(--bg-surface); border: 1px solid var(--border); border-radius: .8rem; padding: .6rem .8rem; }
.tools-dashboard, #tool-detail { max-width: 980px; margin: 0 auto; padding: 1rem; }
.tools-route-view > h2 { color: var(--text); font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.tools-route-view { margin-top: .25rem; }
.tools-search-shell { display: block; margin: 0 0 1rem; }.tools-search-shell input { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: .9rem; background: var(--bg-surface); padding: .7rem 1rem; }
#tools-quick, #tools-recents, #tools-categories, #tools-search-results { margin-top: 1.4rem; } .tools-dashboard h3 { margin-bottom: .65rem; font-weight: 700; color: var(--text); }
.tools-quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.quick-tool-card { min-height: 100px; }
.quick-tool-card .tool-card-open { min-height: 100px; padding: .7rem; }
.quick-tool-card .tool-card-copy { margin-top: .4rem; padding-right: 0; }
.quick-tool-card .tool-card-copy strong { font-size: .86rem; line-height: 1.18; }
.quick-tool-card .tool-card-copy small { display: none; }
.tools-recent-list .tool-card { min-height: 76px; }.tools-recent-list .tool-card-open { min-height: 76px; display: flex; align-items: center; gap: .75rem; }.tools-recent-list .tool-card-copy { margin-top: 0; }
.tools-category-grid { display: grid; gap: .55rem; }.tools-category-button { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: space-between; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: .85rem; background: var(--bg-surface); color: var(--text); text-align: left; }.tools-category-copy { display: flex; align-items: center; font-weight: 650; }.tools-category-button small { color: var(--text-secondary); }
.tools-back, #tools-category-back { min-height: 44px; margin-bottom: .75rem; color: var(--accent); font-weight: 650; }
.tools-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }.tool-card { position: relative; min-height: 106px; border: 1px solid var(--border); border-radius: 1rem; background: var(--bg-surface); transition: transform .15s ease, box-shadow .15s ease; }.tool-card:active { transform: scale(.98); }.tool-card-open { display: block; width: 100%; min-height: 106px; text-align: left; padding: .75rem; }.tool-card-icon { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; color: var(--accent); background: var(--accent-soft); border-radius: .75rem; }.tool-card-copy { display: block; margin-top: .5rem; padding-right: 2rem; }.tool-card-copy strong, .tool-card-copy small { display: block; }.tool-card-copy small { margin-top: .2rem; color: var(--text-secondary); font-size: .72rem; line-height: 1.25; }.tool-favorite { min-width: 44px; min-height: 44px; position: absolute; top: .3rem; right: .3rem; color: var(--accent); font-size: 1.25rem; border-radius: 999px; }.tools-recents-row { display: flex; gap: .65rem; overflow-x: auto; scroll-snap-type: x mandatory; }.tools-recents-row .tool-card { min-width: 185px; scroll-snap-align: start; }.tools-empty { padding: 1rem; color: var(--text-secondary); background: var(--bg-surface); border-radius: .8rem; }.category-icon { display: inline-flex; width: 1.25rem; height: 1.25rem; margin-right: .4rem; vertical-align: -.25rem; color: var(--accent); }.category-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }.contextual-action { min-height: 36px; padding: .35rem .55rem; color: var(--accent); font-size: .8rem; font-weight: 600; border-radius: .65rem; }
#tool-detail-back { min-height: 44px; margin-bottom: 1rem; color: var(--accent); font-weight: 600; } #tool-panel { max-width: 760px; margin: 0 auto; }
.tool-fields { display: grid; gap: 1rem; }
.tool-field-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-field-label { display: block; margin-bottom: .35rem; color: var(--text-secondary); font-size: .78rem; font-weight: 650; }
.tool-control { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: .75rem; background: var(--bg-surface); color: var(--text); padding: .65rem .8rem; }
.tool-input-wrap { position: relative; }.tool-input-wrap .tool-control { padding-right: 4.25rem; }
.tool-unit { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: .78rem; pointer-events: none; }
.tool-unit-hint { display: block; margin-top: .25rem; color: var(--text-secondary); font-size: .7rem; }
.tool-calculate { min-height: 44px; }.tool-calculate:disabled { cursor: wait; opacity: .62; }
.tool-feedback { margin-top: .75rem; padding: .65rem .75rem; border-radius: .7rem; font-size: .82rem; line-height: 1.35; }
.tool-feedback-status { color: var(--text-secondary); background: var(--bg-muted); }.tool-feedback-success { color: #18794e; background: #e8f7ee; }.tool-feedback-warning { color: #9a5b00; background: #fff5d6; }.tool-feedback-error { color: #b42318; background: #fef0ef; }
.dark .tool-feedback-success { color: #8ee6b4; background: rgba(24,121,78,.25); }.dark .tool-feedback-warning { color: #ffd070; background: rgba(154,91,0,.25); }.dark .tool-feedback-error { color: #ffaca5; background: rgba(180,35,24,.28); }
.tool-result { margin-top: 1.5rem; overflow: hidden; border: 1px solid var(--border); border-radius: 1rem; background: var(--bg-surface); box-shadow: var(--shadow); }.tool-result-body { padding: 1rem; color: var(--text); font-size: .9rem; }.tool-result-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }.tool-result-row > span:first-child { color: var(--text-secondary); }.tool-result-row > span:last-child { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }.tool-result-row small { color: var(--text-secondary); font-weight: 400; }.tool-result-primary { margin: -.1rem 0 .6rem; padding: .75rem; border-radius: .75rem; background: var(--accent-soft); }.tool-result-primary .tool-result-row { border: 0; }.tool-result-primary .tool-result-row > span:last-child { color: var(--accent-text); font-size: 1.45rem; font-weight: 750; letter-spacing: -.03em; }.tool-result-summary { display: grid; gap: .15rem; margin-bottom: .85rem; padding-bottom: .85rem; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: .78rem; }
.eyebrow { color: var(--accent-text); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }.chat-screen-intro, .library-intro, .more-screen > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }.chat-screen-intro h2, .library-intro h2, .more-screen > header h2 { margin-top: .15rem; color: var(--text); font-size: 1.2rem; font-weight: 750; }.library-intro { display: block; padding: 1.25rem; border-radius: 1rem; background: var(--accent-soft); }.library-intro > p:last-child { margin-top: .45rem; color: var(--text-secondary); }.library-folder-surface { padding: 1rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--bg-surface); }.settings-group > h3 { margin: 0 0 .45rem .8rem; color: var(--text-secondary); font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }.settings-card { overflow: hidden; border: 1px solid var(--border); border-radius: 1rem; background: var(--bg-surface); }.settings-row { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; text-align: left; }.settings-row + .settings-row { border-top: 1px solid var(--border); }.settings-row > span:last-child { color: var(--text-secondary); font-size: .85rem; }.about-card { display: flex; gap: 1rem; padding: 1rem; }.about-mark { width: 44px; height: 44px; }.about-card strong { color: var(--text); }.about-card strong span { color: var(--text-secondary); font-weight: 500; }.about-card p { margin-top: .35rem; color: var(--text-secondary); font-size: .82rem; line-height: 1.45; }
.conversation-sheet { position: fixed; inset: 0; z-index: 45; }.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.46); }.sheet-panel { position: absolute; right: 0; bottom: 0; left: 0; max-height: min(78dvh, 44rem); overflow: auto; padding: .65rem 1rem calc(1rem + var(--safe-bottom)); border-radius: 1.25rem 1.25rem 0 0; background: var(--bg-surface); box-shadow: 0 -10px 30px rgba(0,0,0,.22); animation: sheet-in .2s ease-out; }.sheet-handle { width: 2.5rem; height: .28rem; margin: 0 auto .65rem; border-radius: 99px; background: var(--bg-muted); }.sheet-panel header { display: flex; align-items: center; justify-content: space-between; }.sheet-panel h2 { color: var(--text); font-size: 1.1rem; font-weight: 700; }.sheet-actions { display: flex; justify-content: space-between; margin: 1rem 0; }.sheet-actions button { min-height: 44px; color: var(--accent); font-weight: 650; }.modal-close { display: inline-flex; width: 44px; min-width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 999px; }.modal-confirm { min-height: 44px; }.login-hero { max-width: 28rem; }.source-card { border-color: var(--border); background: var(--bg-surface); color: var(--text-secondary); }.source-card:hover { border-color: var(--accent-border); color: var(--accent-text); }.reasoning-block, .streaming-surface { border-left: 3px solid var(--accent); background: var(--bg-muted); border-radius: .75rem; padding: .75rem; }
#login-modal > div, #page-viewer > div, #document-viewer > div, #confirm-modal > div, #tag-editor > div { max-height: calc(100dvh - 2rem - var(--safe-top) - var(--safe-bottom)); }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 900px) { .conversation-sheet { left: auto; width: min(26rem, 38vw); }.sheet-panel { top: 0; right: 0; bottom: 0; left: auto; width: 100%; max-height: none; border-radius: 1.25rem 0 0 1.25rem; }.sheet-handle { display: none; }.more-screen { max-width: 52rem; }.library-intro, .chat-screen-intro { max-width: 68rem; margin-left: auto; margin-right: auto; } }
@media (min-width: 700px) { .tools-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }.tools-category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (min-width: 900px) { #mobile-tabbar { display: none; } main { padding-bottom: 0; }.tools-grid, .tools-quick-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }.tools-dashboard, #tool-detail { padding: 1.5rem; } }
@media (max-width: 340px) { .tools-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .tool-field-row, .tool-field-row-3 { grid-template-columns: 1fr; } }
@media (max-width: 899px) {
  button, [role="button"], a[href], [onclick], .interactive-surface,
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea,
  .contextual-action, .ios-icon-btn, #ask-submit, #ask-stop, .tool-result-copy, .source-card, .document-action, .conversation-select, .conversation-delete, .ios-chip, .sheet-actions button, .modal-close, .modal-confirm, #tool-detail-back, .tool-calculate, .settings-row, .library-folder > button {
    min-width: 44px;
    min-height: 44px;
  }
  #conversation-list .conversation-delete { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

#conversation-list .group:focus-within .conversation-delete,
#conversation-list .conversation-delete:focus-visible {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  #conversation-list .conversation-delete { opacity: 1; }
}

/* Safe areas helpers */
.pb-safe {
  padding-bottom: max(0.5rem, var(--safe-bottom));
}

/* Hide horizontal scrollbar on chip row */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* --- iOS header / title bar --- */
.ios-header {
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg-surface) 78%, transparent);
}

.ios-titlebar {
  min-height: 44px;
  padding-top: 4px;
  padding-bottom: 2px;
}

.ios-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  color: var(--text);
  background: transparent;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.ios-icon-btn:active {
  background: var(--bg-muted);
  transform: scale(0.94);
}

.ios-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  background: var(--bg-muted);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.ios-chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}
.ios-chip input[type="checkbox"] {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: var(--accent);
}

.ios-chip-row {
  -webkit-overflow-scrolling: touch;
}

/* Sidebar brand + safe top */
.sidebar-brand {
  min-height: 56px;
  padding-top: max(0.75rem, var(--safe-top));
  padding-bottom: 0.75rem;
}

.app-sidebar {
  padding-left: var(--safe-left);
}

/* Composer dock with home indicator clearance */
.composer-dock {
  padding-top: 0.35rem;
  padding-bottom: max(0.65rem, calc(var(--safe-bottom) + 0.35rem));
  background: linear-gradient(
    to top,
    var(--bg-app) 70%,
    color-mix(in srgb, var(--bg-app) 0%, transparent)
  );
}

/* Desktop-only hint fragment */
@media (max-width: 767px) {
  .hint-desktop {
    display: none;
  }
}

/* 16px inputs on iOS avoid auto-zoom */
@media (max-width: 767px) {
  input, select, textarea {
    font-size: 16px;
  }
  .ios-chip select {
    font-size: 13px !important;
  }
}

/* --- UI polish (macOS sober) --- */

/* Soft hairline: borders already use --border; keep surfaces quiet */
.border-soft {
  border-color: var(--border);
}

/* Sidebar nav: muted fill + accent left bar when active */
.nav-item {
  position: relative;
  overflow: hidden;
}

.nav-item.is-active {
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 500;
}

.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 9999px;
  background: var(--accent);
}

.nav-item.is-active svg {
  color: var(--accent);
}

/* Version footer — dimmer */
.version-footer {
  color: var(--text-secondary);
  opacity: 0.45;
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

/* Header glass (optional blur; solid fallback) */
.header-glass {
  background: color-mix(in srgb, var(--bg-surface) 78%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .header-glass {
    background: var(--bg-surface);
  }
}

/* Floating chat composer — iMessage-like pill */
.composer-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 1.375rem;
  box-shadow: var(--shadow);
}

.composer-bar:focus-within {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* Message bubbles — rounded like iOS Messages */
.bubble-user {
  background: var(--accent);
  color: #ffffff;
  border: none;
  box-shadow: none;
  border-radius: 1.125rem 1.125rem 0.35rem 1.125rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  max-width: 92%;
}

.dark .bubble-user {
  background: var(--accent);
  color: #ffffff;
  border: none;
}

.bubble-assistant {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  border-radius: 1.125rem 1.125rem 1.125rem 0.35rem;
  padding: 0.7rem 0.95rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 92%;
}

.dark .bubble-assistant {
  background: var(--bg-elevated);
}

.bubble-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  box-shadow: none;
  border-radius: 1.125rem 1.125rem 1.125rem 0.35rem;
  padding: 0.7rem 0.95rem;
  max-width: 92%;
}

.dark .bubble-error {
  background: rgba(127, 29, 29, 0.25);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

/* Conversation list — iOS list rows */
#conversation-list button,
#conversation-list .conv-item {
  border-radius: 0.75rem;
}

/* Smooth drawer */
@media (max-width: 767px) {
  #app-sidebar {
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
}

/* Progress tracks */
.progress-track {
  background: var(--bg-muted);
}

.progress-fill {
  background: var(--accent);
}

/* Focus-visible rings (global interactive affordance) */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Composer textarea: no extra ring (bar handles focus) */
.composer-bar textarea:focus-visible,
.composer-bar button:focus-visible {
  box-shadow: none;
}

/* --- Bulle thinking éphémère --- */

.thinking-dot {
    animation: thinking-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0.35); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.thinking-bubble {
    min-width: 12rem;
    animation: thinking-in 0.2s ease-out;
}

@keyframes thinking-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.thinking-fade-out {
    animation: thinking-out 0.28s ease-in forwards;
}

@keyframes thinking-out {
    to { opacity: 0; transform: translateY(-4px); }
}

.thinking-step-mark {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background: var(--bg-muted);
}

.thinking-step-active .thinking-step-mark {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 89, 1, 0.15);
}

.thinking-step-done {
    color: var(--text-secondary);
}

.thinking-step-done .thinking-step-mark {
    background: var(--text-secondary);
}

.thinking-step-active .thinking-step-text {
    color: var(--text);
    font-weight: 500;
}

/* --- Rendu Markdown des réponses LIA --- */
/* Le preflight Tailwind supprime les styles par défaut : on les restaure ici. */

.markdown-body {
    color: var(--text);
}

.markdown-body p {
    margin-bottom: 0.75rem;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    font-weight: 600;
    color: var(--text);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child,
.markdown-body h4:first-child {
    margin-top: 0;
}

.markdown-body h1 { font-size: 1.25rem; }
.markdown-body h2 { font-size: 1.125rem; }
.markdown-body h3 { font-size: 1rem; }
.markdown-body h4 { font-size: 0.9375rem; }

.markdown-body strong {
    font-weight: 600;
    color: var(--text);
}

.markdown-body ul {
    list-style-type: disc;
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.markdown-body ol {
    list-style-type: decimal;
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.markdown-body li {
    margin-bottom: 0.25rem;
}

.markdown-body li > ul,
.markdown-body li > ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.markdown-body code {
    background-color: var(--bg-muted);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: ui-monospace, monospace;
    color: var(--text);
}

.markdown-body pre {
    background-color: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.dark .markdown-body pre {
    background-color: #0a0a0a;
    color: #e2e8f0;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.8125rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border);
    padding: 0.375rem 0.75rem;
    text-align: left;
}

.markdown-body th {
    background-color: var(--bg-muted);
    font-weight: 600;
    color: var(--text);
}

.markdown-body tr:nth-child(even) td {
    background-color: var(--bg-app);
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

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

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

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

/* --- Cartes de sources cliquables --- */

.source-card {
    transition: transform 0.1s ease;
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

.source-card:hover {
    transform: translateY(-1px);
    background: var(--accent-soft-hover);
}
