/* Miorița AI — design clean, spațial, minimalist.
   Paletă: alb/soft-milk, charcoal, emerald mint + slate grey. */
:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-warm: #f9fafb;
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-faint: #9ca3af;
  --emerald: #10b981;
  --emerald-deep: #059669;
  --slate: #e5e7eb;
  --slate-2: #f1f3f5;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(17,24,39,.04), 0 8px 30px rgba(17,24,39,.06);
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font);
  --accent-soft: #ecfdf5;      /* fundal verde deschis pentru stări active */
  --topbar-bg: rgba(255,255,255,.8);
  --overlay: rgba(17,24,39,.45);
}

/* ---------- Temă întunecată ---------- */
[data-theme="dark"] {
  --bg: #0f1729;
  --bg-soft: #0b1220;
  --bg-warm: #0c1424;
  --ink: #e5e9f0;
  --ink-soft: #aeb9c9;
  --ink-faint: #6b7688;
  --emerald: #10b981;
  --emerald-deep: #34d399;
  --slate: #26324a;
  --slate-2: #182235;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.4);
  --accent-soft: #10321f;
  --topbar-bg: rgba(15,23,41,.82);
  --overlay: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* ---------- Iconițe SVG (înlocuiesc emoji-urile) + animații subtile ---------- */
.mi { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; overflow: visible; }
@keyframes mi-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }
.mi-anim-breathe { animation: mi-breathe 3.6s ease-in-out infinite; transform-origin: center; }
@keyframes mi-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
.mi-anim-float { animation: mi-float 3s ease-in-out infinite; }
@keyframes mi-spin { to { transform: rotate(360deg); } }
.mi-anim-spin-slow { animation: mi-spin 7s linear infinite; transform-origin: center; }
@keyframes mi-bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-1.5px) rotate(4deg); } }
.mi-anim-bob { animation: mi-bob 1.7s ease-in-out infinite; transform-origin: center; }
@keyframes mi-flip { 0%,45% { transform: rotate(0); } 55%,100% { transform: rotate(180deg); } }
.mi-anim-flip { animation: mi-flip 2.6s ease-in-out infinite; transform-origin: center; }
@keyframes mi-twinkle { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.9); } }
.mi-anim-twinkle { animation: mi-twinkle 2.2s ease-in-out infinite; transform-origin: center; }
@keyframes mi-shake { 0%,88%,100% { transform: translateX(0); } 92% { transform: translateX(-1.6px); } 96% { transform: translateX(1.6px); } }
.mi-anim-shake { animation: mi-shake 3.2s ease-in-out infinite; }
@keyframes mi-wag { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.mi-anim-wag { animation: mi-wag 1.3s ease-in-out infinite; transform-origin: center bottom; }
@keyframes mi-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.mi-anim-pop { animation: mi-pop .4s ease-out; }
@media (prefers-reduced-motion: reduce) { .mi { animation: none !important; } }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  justify-content: space-between;
  border-bottom: 1px solid var(--slate);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 800; margin: 0; letter-spacing: -.02em;
}
.brand-text h1 span { color: var(--emerald); }
.status { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-faint); }
.status.online { color: var(--emerald-deep); }
.status.offline { color: #ef4444; }

.topbar-actions { display: flex; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--slate); background: var(--bg);
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: .18s ease;
}
.chip:hover { border-color: var(--emerald); color: var(--emerald-deep); }
.chip.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.primary:hover { background: #000; color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.chip.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.chip.active .dot { background: #fff; }


/* ---------- Avatar Living Miorița ---------- */
.avatar {
  position: relative; width: 46px; height: 46px;
  display: grid; place-items: center;
}
.avatar-aura {
  position: absolute; inset: -6px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,.0) 40%, rgba(16,185,129,.0) 70%);
  transition: .4s ease;
}
.avatar-sheep { width: 46px; height: 46px; position: relative; z-index: 2;
  animation: breathe 4s ease-in-out infinite; transform-origin: 50% 60%; }
.avatar-sheep .wool, .avatar-sheep .body { fill: #fff; stroke: var(--slate); stroke-width: 1.5; }
.avatar-sheep .face { fill: #2b3240; }
.avatar-sheep .ear { fill: #2b3240; }
.avatar-sheep .eye { fill: #fff; }

@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* Stare: reasoning (aură acvatică/nebuloasă) */
.avatar[data-state="reasoning"] .avatar-aura {
  background: radial-gradient(circle, rgba(59,130,246,.35) 20%, rgba(16,185,129,.18) 55%, transparent 72%);
  animation: pulse 1.6s ease-in-out infinite;
}
.avatar[data-state="reasoning"] .avatar-sheep { animation: breathe 1.6s ease-in-out infinite; }
/* Stare: execuție/securitate (contur verde-smarald) */
.avatar[data-state="execution"] .avatar-aura {
  background: radial-gradient(circle, rgba(16,185,129,.4) 25%, transparent 68%);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.12); opacity: 1; } }

/* ---------- Workspace + Sidebar ---------- */
.workspace { flex: 1; display: flex; min-height: 0; min-width: 0; }
.sidebar {
  width: 264px; flex-shrink: 0; border-right: 1px solid var(--slate);
  background: var(--bg); display: flex; flex-direction: column;
  transition: margin-left .28s ease, transform .28s ease; overflow: hidden;
}
.sidebar.collapsed { margin-left: -264px; }
/* Butoane de acțiune mutate în sidebar (Chat nou / Sesiune temporară / Whitelist) */
.sidebar-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px 10px 4px; flex-shrink: 0; }
.sidebar-actions .chip { width: 100%; justify-content: center; }

/* Tab-uri sidebar (Conversații / Galerie) */
.sidebar-tabs { display: flex; gap: 4px; padding: 10px 10px 0; flex-shrink: 0; }
.sb-tab { flex: 1; border: 0; background: transparent; border-radius: 10px 10px 0 0; padding: 10px 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-faint); cursor: pointer; transition: .15s; }
.sb-tab:hover { color: var(--ink); background: var(--slate-2); }
.sb-tab.active { color: var(--emerald-deep); background: var(--accent-soft); }
.sidebar-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sidebar-panel[hidden] { display: none; }

/* Credit „Made with ♥ by 4level4.io" — jos în sidebar */
.sidebar-credit { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--slate); font-size: 11.5px; color: var(--ink-faint); }
.sidebar-credit a { color: var(--emerald-deep); font-weight: 600; text-decoration: none; }
.sidebar-credit a:hover { text-decoration: underline; }
.sidebar-credit .heart { vertical-align: -2px; animation: heartbeat 1.6s ease-in-out infinite; }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .sidebar-credit .heart, .fp-madeby .heart { animation: none; } }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); flex-shrink: 0; }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }

/* Grilă galerie imagini */
.gallery-grid { flex: 1; overflow-y: auto; padding: 6px 10px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.gal-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--slate); cursor: pointer; background: var(--slate-2); }
.gal-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gal-item:hover img { transform: scale(1.05); }
.gal-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(17,24,39,.6); color: #fff; cursor: pointer; font-size: 12px; opacity: 0; transition: .15s; }
.gal-item:hover .gal-del { opacity: 1; }
.gal-del:hover { background: #ef4444; }
.conv-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  cursor: pointer; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 2px;
  transition: .12s; position: relative;
}
.conv-item:hover { background: var(--slate-2); color: var(--ink); }
.conv-item.active { background: var(--accent-soft); color: var(--emerald-deep); font-weight: 600; }
.conv-item .ci-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .ci-del { opacity: 0; border: 0; background: transparent; cursor: pointer; color: var(--ink-faint); font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.conv-item:hover .ci-del { opacity: 1; }
.conv-item .ci-del:hover { color: #ef4444; background: #fff; }
.conv-empty { text-align: center; color: var(--ink-faint); font-size: 12.5px; padding: 24px 12px; }

/* ---------- Stage (dual) ---------- */
.stage { flex: 1; display: flex; min-height: 0; min-width: 0; }
.conversation {
  flex: 1 1 100%; display: flex; flex-direction: column;
  min-width: 0; min-height: 0; background: var(--bg-warm);
  transition: flex-basis .35s ease;
  position: relative;
}

/* Buton „derulează la ultimul mesaj" — plutește deasupra composer-ului */
.scroll-bottom {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 104px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--slate); background: var(--bg); color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow); transition: .16s ease; animation: sb-in .2s ease;
}
.scroll-bottom:hover { color: var(--emerald); border-color: var(--emerald); transform: translateX(-50%) translateY(-2px); }
.scroll-bottom[hidden] { display: none; }
@keyframes sb-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }

/* Contor de caractere în composer */
.char-count { align-self: flex-end; font-size: 11px; color: var(--ink-faint); padding: 0 2px 10px; user-select: none; font-variant-numeric: tabular-nums; }
.char-count.warn { color: #d97706; font-weight: 600; }
.char-count[hidden] { display: none; }

.stage.split .conversation { flex-basis: 40%; }
.stage.split .canvas { display: flex; }

/* ---------- Mesaje ---------- */
.messages { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 28px clamp(16px, 5vw, 60px); scroll-behavior: smooth; }
.welcome { max-width: 620px; margin: 5vh auto 0; text-align: center; }
.welcome h2 { font-family: var(--font-display); font-size: 26px; margin: 0 0 8px; letter-spacing: -.02em; }

/* ---------- Oița animată din ecranul de întâmpinare ---------- */
.welcome-sheep { width: 128px; height: 120px; margin: 0 auto 14px; display: block; overflow: visible; }
.welcome-sheep .ws-shadow { fill: rgba(17,24,39,.08); animation: ws-shadow 3.4s ease-in-out infinite; transform-origin: center; }
.welcome-sheep .ws-wool { fill: #ffffff; stroke: #e5e7eb; stroke-width: 2; }
.welcome-sheep .ws-face { fill: #2b3240; }
.welcome-sheep .ws-ear { fill: #2b3240; transform-origin: center; }
.welcome-sheep .ws-ear-l { animation: ws-ear-l 3.6s ease-in-out infinite; }
.welcome-sheep .ws-ear-r { animation: ws-ear-r 3.6s ease-in-out infinite; }
.welcome-sheep .ws-tuft { fill: #ffffff; stroke: #e5e7eb; stroke-width: 2; }
.welcome-sheep .ws-eye { fill: #ffffff; }
.welcome-sheep .ws-glint { fill: #2b3240; }
.welcome-sheep .ws-eyes { transform-origin: 80px 74px; animation: ws-blink 4.2s ease-in-out infinite; }
.welcome-sheep .ws-nose { fill: #10b981; }
.welcome-sheep .ws-smile { stroke: #10b981; stroke-width: 2.4; stroke-linecap: round; }
.welcome-sheep .ws-cheek { fill: rgba(16,185,129,.18); }
.welcome-sheep .ws-float { transform-origin: 80px 90px; animation: ws-float 3.4s ease-in-out infinite; }
.welcome-sheep .ws-body { transform-origin: 80px 78px; animation: ws-breathe 3.4s ease-in-out infinite; }
.welcome-sheep .ws-legs rect { fill: #2b3240; }

@keyframes ws-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ws-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes ws-shadow { 0%,100% { transform: scaleX(1); opacity: .55; } 50% { transform: scaleX(.86); opacity: .35; } }
@keyframes ws-blink { 0%,92%,100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes ws-ear-l { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-12deg); } }
@keyframes ws-ear-r { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(12deg); } }

@media (prefers-reduced-motion: reduce) {
  .welcome-sheep .ws-float, .welcome-sheep .ws-body, .welcome-sheep .ws-eyes,
  .welcome-sheep .ws-ear-l, .welcome-sheep .ws-ear-r, .welcome-sheep .ws-shadow { animation: none; }
}
.welcome p { color: var(--ink-soft); font-size: 15px; line-height: 1.6; margin: 0 auto 26px; max-width: 480px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suggestions button {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--slate); background: var(--bg); border-radius: 14px;
  padding: 14px 16px; text-align: left; cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: var(--ink); transition: .18s ease;
}
.suggestions button:hover { border-color: var(--emerald); box-shadow: var(--shadow); transform: translateY(-2px); }
.suggestions .card-ic { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; }
.suggestions .card-ic .gen-ic { width: 34px; height: 34px; display: block; transition: transform .2s ease; }
.suggestions button:hover .card-ic .gen-ic { transform: rotate(-6deg) scale(1.08); }
.suggestions .card-label { min-width: 0; }

.msg { max-width: 780px; margin: 0 auto 22px; display: flex; gap: 14px; }
.msg .who { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.msg.user .who { background: var(--ink); color: #fff; overflow: hidden; }
.msg.bot .who { background: var(--emerald); color: #fff; overflow: hidden; }
.who-sheep, .who-shepherd { width: 24px; height: 24px; display: block; }
/* Ciobănaș (avatar utilizator) */
.who-shepherd .sh-face { fill: #f3c79f; }
.who-shepherd .sh-ear { fill: #eab784; }
.who-shepherd .sh-hat { fill: #a06a3c; }
.who-shepherd .sh-eye { fill: #2b2018; }
.who-shepherd .sh-cheek { fill: rgba(239,120,90,.45); }
.who-shepherd .sh-tache { fill: #6b4326; }
.who-shepherd .sh-smile { fill: none; stroke: #6b4326; stroke-width: 1.1; stroke-linecap: round; }
.who-sheep .ws-wool { fill: #fff; }
.who-sheep .ws-tuft { fill: #fff; }
.who-sheep .ws-face { fill: #2b3240; }
.who-sheep .ws-ear { fill: #2b3240; }
.who-sheep .ws-eye { fill: #fff; }
.msg .bubble { flex: 1; min-width: 0; }
.msg .bubble .name { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); margin-bottom: 4px; }
.model-badge { font-weight: 600; font-size: 11px; color: var(--emerald-deep); background: var(--accent-soft); border: 1px solid var(--slate); padding: 1px 7px; border-radius: 999px; margin-left: 6px; }

/* Continut markdown */
.content { font-size: 15px; line-height: 1.7; color: var(--ink); }
.content p { margin: 0 0 12px; }
.content h1,.content h2,.content h3 { font-family: var(--font-display); letter-spacing: -.01em; margin: 18px 0 10px; }
.content ul,.content ol { margin: 0 0 12px; padding-left: 22px; }
.content li { margin: 4px 0; }
.content a { color: var(--emerald-deep); }
.content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.content th, .content td { border: 1px solid var(--slate); padding: 8px 12px; text-align: left; }
.content th { background: var(--slate-2); font-weight: 700; }
.content :not(pre) > code {
  background: var(--slate-2); padding: 2px 6px; border-radius: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; color: #b23c17;
}
.content blockquote { border-left: 3px solid var(--emerald); margin: 12px 0; padding: 4px 16px; color: var(--ink-soft); }

/* Bloc de reasoning <think> */
.think {
  border: 1px dashed var(--slate); border-radius: 12px; padding: 4px 14px;
  margin: 0 0 14px; background: #fbfbfd; color: var(--ink-soft); font-size: 13.5px;
}
.think summary { cursor: pointer; font-weight: 600; color: var(--ink-faint); padding: 8px 0; list-style: none; }
.think summary::before { content: "✦ "; color: #6366f1; }

/* Cod / Code Boxes */
.codeblock { position: relative; margin: 14px 0; border-radius: 12px; overflow: hidden; border: 1px solid #2b3240; }
.codeblock .cb-head {
  display: flex; align-items: center; justify-content: space-between;
  background: #1c2128; color: #8b98a5; padding: 8px 14px; font-size: 12px; font-family: var(--font);
}
.codeblock .cb-lang { font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.codeblock .cb-actions { display: flex; gap: 8px; }
.codeblock .cb-btn { background: transparent; border: 1px solid #3a4048; color: #c9d1d9; border-radius: 7px; padding: 3px 10px; cursor: pointer; font-size: 12px; transition: .15s; }
.codeblock .cb-btn:hover { border-color: var(--emerald); color: var(--emerald); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: #282c34; }
.codeblock code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; line-height: 1.55; }

.cursor-blink::after { content: '▊'; color: var(--emerald); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Mesaj de încărcare amuzant */
.loading-msg { color: var(--ink-soft); font-style: italic; font-size: 14px; opacity: .85; animation: fadepulse 2.2s ease-in-out infinite; }
@keyframes fadepulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* Oiță care aleargă (indicator de procesare) */
.run-sheep { display: inline-block; width: 30px; height: 24px; vertical-align: -6px; margin-right: 4px; }
.run-sheep svg { width: 100%; height: 100%; overflow: visible; }
.run-sheep .rs-wool { fill: #fff; stroke: var(--slate); stroke-width: 2; }
.run-sheep .rs-head { fill: #2b3240; }
.run-sheep .rs-ear { fill: #2b3240; }
.run-sheep .rs-eye { fill: #fff; }
.run-sheep .rs-leg { fill: #2b3240; transform-box: fill-box; transform-origin: 50% 0; }
.run-sheep .rs-body { transform-origin: 50% 60%; animation: rs-bob .34s ease-in-out infinite; }
.run-sheep .rs-leg-a { animation: rs-run-a .34s linear infinite; }
.run-sheep .rs-leg-b { animation: rs-run-b .34s linear infinite; }
@keyframes rs-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes rs-run-a { 0%,100% { transform: rotate(24deg); } 50% { transform: rotate(-24deg); } }
@keyframes rs-run-b { 0%,100% { transform: rotate(-24deg); } 50% { transform: rotate(24deg); } }
@media (prefers-reduced-motion: reduce) {
  .run-sheep .rs-body, .run-sheep .rs-leg { animation: none; }
}

/* Card „in curs de generare" (fisier / imagine / sunet) */
.gen-card {
  display: flex; align-items: center; gap: 14px; margin: 14px 0;
  padding: 14px 16px; border: 1px solid var(--slate); border-radius: 16px;
  background: var(--bg); box-shadow: var(--shadow); max-width: 480px;
  position: relative; overflow: hidden;
}
.gen-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(16,185,129,.10) 50%, transparent 70%);
  transform: translateX(-100%); animation: gc-shimmer 1.4s ease-in-out infinite;
}
@keyframes gc-shimmer { to { transform: translateX(100%); } }
.gc-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px;
  background: rgba(16,185,129,.12); animation: pulse 1.4s ease-in-out infinite;
}
.gc-info { flex: 1; min-width: 0; }
.gc-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.gc-sub { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-dots { display: flex; gap: 4px; }
.gc-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); animation: gc-bounce 1.2s ease-in-out infinite; }
.gc-dots span:nth-child(2) { animation-delay: .2s; }
.gc-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes gc-bounce { 0%,100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-4px); opacity: 1; } }

/* Mesaje de eroare amuzante */
.err-msg { color: var(--ink); font-weight: 600; margin: 0 0 4px; }
.err-detail { color: var(--ink-faint); font-size: 12px; margin: 0; }

/* Output rulare cod (JS sandbox) */
.run-output { border-top: 1px solid #3a4048; background: #14171c; color: #c9d1d9; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; padding: 10px 16px; max-height: 220px; overflow: auto; }
.run-output .ro-head { color: #8b98a5; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.run-output .ro-line { white-space: pre-wrap; word-break: break-word; }
.run-output .ro-err { color: #ff7b72; }
.run-output .ro-warn { color: #e3b341; }

/* ---------- Card prompt muzical ---------- */
.music-card { margin: 16px 0; border-radius: 16px; overflow: hidden; border: 1px solid #2a2f3a;
  background: linear-gradient(160deg, #1a1d27, #12141b); color: #e8eaf0; box-shadow: var(--shadow); }
.music-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #2a2f3a; }
.music-head .mc-icon { font-size: 22px; }
.music-head .mc-style { flex: 1; }
.music-head .mc-style .mc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #7f8598; }
.music-head .mc-style .mc-val { font-size: 14px; font-weight: 600; color: #fff; }
.music-viz { display: flex; align-items: flex-end; gap: 3px; height: 40px; padding: 0 16px; margin: 12px 0; }
.music-viz .bar { flex: 1; background: linear-gradient(to top, var(--emerald), #6ee7b7); border-radius: 2px; height: 20%; transition: height .09s ease-out; }
/* La redare, înălțimea barelor e controlată din JS (reactiv la audio). */
.music-sections { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.music-sec { background: #0e1016; border: 1px solid #262b36; border-radius: 10px; overflow: hidden; }
.music-sec-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #171b24; }
.music-sec-head .ms-tag { font-size: 12px; font-weight: 700; color: var(--emerald); letter-spacing: .03em; }
.music-sec-head button { background: transparent; border: 1px solid #333a47; color: #c9d1d9; border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 11px; }
.music-sec-head button:hover { border-color: var(--emerald); color: var(--emerald); }
.music-sec pre { margin: 0; padding: 10px 12px; white-space: pre-wrap; font-family: inherit; font-size: 13px; color: #cdd3df; line-height: 1.5; }
.music-actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.music-actions button { background: var(--emerald); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.music-actions button.ghost { background: transparent; border: 1px solid #333a47; color: #c9d1d9; }
.music-actions button:hover { filter: brightness(1.08); }

/* ---------- Card de fișier ---------- */
.file-chip {
  display: flex; align-items: center; gap: 14px; margin: 14px 0;
  padding: 14px 16px; border: 1px solid var(--slate); border-radius: 16px;
  background: var(--bg); box-shadow: var(--shadow); max-width: 480px; transition: .18s;
}
.file-chip:hover { border-color: #d1d5db; }
.fc-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 14.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-label { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.fc-actions { display: flex; gap: 8px; flex-shrink: 0; }
.fc-actions button {
  border: 1px solid var(--slate); background: var(--slate-2); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.fc-actions .fc-open:hover { border-color: var(--emerald); color: var(--emerald-deep); background: #ecfdf5; }
.fc-actions .fc-download { background: var(--ink); color: #fff; border-color: var(--ink); }
.fc-actions .fc-download:hover { background: #000; }
@media (max-width: 640px) {
  .file-chip { flex-wrap: wrap; }
  .fc-actions { width: 100%; }
  .fc-actions button { flex: 1; }
}

/* ---------- Card de imagine generată ---------- */
.image-card { margin: 14px 0; border: 1px solid var(--slate); border-radius: 16px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow); max-width: 560px; }
.ic-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--slate); }
.ic-icon { font-size: 20px; }
.ic-meta { min-width: 0; }
.ic-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.ic-prompt { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 460px; }
.ic-stage { min-height: 120px; display: grid; place-items: center; background: var(--bg-warm); padding: 12px; }
.ic-status { color: var(--ink-soft); font-size: 13.5px; text-align: center; display: flex; align-items: center; gap: 8px; }
.ic-status .spin { width: 16px; height: 16px; border: 2px solid var(--slate); border-top-color: var(--emerald); border-radius: 50%; animation: spin .7s linear infinite; }
.ic-status.ic-err { color: #b91c1c; flex-direction: column; }
.ic-hint { color: var(--ink-faint); font-size: 12px; }
.ic-img { max-width: 100%; border-radius: 10px; cursor: zoom-in; display: block; }
.ic-actions { display: flex; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.ic-actions button { border: 1px solid var(--slate); background: var(--slate-2); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s; }
.ic-actions .ic-gen { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.ic-actions .ic-gen:hover { background: var(--emerald-deep); }
.ic-actions button:hover { border-color: var(--emerald); }

/* ---------- Timeline ---------- */
.timeline { margin: 16px 0; padding-left: 8px; }
.tl-item { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--slate); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px #ecfdf5; }
.tl-date { font-size: 12px; font-weight: 700; color: var(--emerald-deep); }
.tl-title { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 2px 0; }
.tl-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

/* ---------- Ghid pas-cu-pas (steps) ---------- */
.steps { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps .st-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #fff; border: 1px solid var(--slate); border-radius: 12px; transition: .15s; }
.steps .st-item:hover { border-color: var(--emerald); box-shadow: var(--shadow); }
.steps .st-num { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--emerald); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; box-shadow: 0 0 0 3px #ecfdf5; }
.steps .st-body { flex: 1; min-width: 0; }
.steps .st-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.steps .st-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 3px; }

/* ---------- Galerie / Carousel imagini ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--slate); cursor: pointer; transition: .15s; }
.gallery img:hover { transform: scale(1.02); border-color: var(--emerald); }
.lightbox { position: fixed; inset: 0; background: rgba(17,24,39,.86); display: grid; place-items: center; z-index: 200; padding: 40px; }
.lightbox img { max-width: 90vw; max-height: 86vh; border-radius: 12px; }
.lightbox .lb-close { position: absolute; top: 20px; right: 26px; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.lightbox .lb-prev { left: 20px; } .lightbox .lb-next { right: 20px; }

/* ---------- Composer ---------- */
.composer { padding: 14px clamp(16px, 5vw, 60px) 20px; border-top: 1px solid var(--slate); background: var(--bg); }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.attachments .thumb { position: relative; width: 54px; height: 54px; border-radius: 10px; overflow: hidden; border: 1px solid var(--slate); }
.attachments .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachments .thumb button { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; font-size: 11px; line-height: 1; }
/* Chip document atașat (în composer) */
.doc-att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--slate); background: var(--bg); border-radius: 12px; padding: 6px 8px 6px 6px; max-width: 240px; }
.da-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.da-info { display: flex; flex-direction: column; min-width: 0; }
.da-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-sub { font-size: 11px; color: var(--ink-faint); }
.da-del { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 6px; flex-shrink: 0; }
.da-del:hover { color: #ef4444; }
/* Chips document afișate în mesajul utilizatorului */
.msg-docs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.doc-att.mini { padding: 5px 12px 5px 5px; }
.doc-att.mini .da-icon { width: 26px; height: 26px; font-size: 14px; }
.composer-row {
  display: flex; align-items: flex-end; gap: 10px; max-width: 820px; margin: 0 auto;
  background: var(--bg); border: 1.5px solid var(--slate); border-radius: 18px; padding: 8px 8px 8px 12px;
  transition: border-color .2s;
}
.composer-row:focus-within { border-color: var(--emerald); }
#input { flex: 1; border: 0; outline: 0; resize: none; font-family: var(--font); font-size: 15px; line-height: 1.5; max-height: 200px; background: transparent; color: var(--ink); padding: 8px 0; }
.icon-btn { background: transparent; border: 0; color: var(--ink-faint); cursor: pointer; padding: 8px; border-radius: 10px; display: grid; place-items: center; transition: .15s; }
.icon-btn:hover { color: var(--emerald); background: var(--slate-2); }
.icon-btn.small { font-size: 14px; }
.send-btn { background: var(--emerald); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; transition: .18s; flex-shrink: 0; }
.send-btn:hover { background: var(--emerald-deep); }
.send-btn:disabled { background: var(--slate); cursor: not-allowed; }
.send-btn.stopping { background: #ef4444; }
.send-btn.stopping:hover { background: #dc2626; }
.send-btn.stopping svg { animation: stop-pulse 1.2s ease-in-out infinite; }
@keyframes stop-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.stopped-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); font-style: italic; }

/* Conținut dublat după un fișier livrat — pliat, ca discuția să rămână curată */
.post-file { margin: 10px 0 0; border: 1px dashed var(--slate); border-radius: 12px; padding: 0 14px; background: var(--bg-warm); }
.post-file > summary { cursor: pointer; list-style: none; padding: 10px 0; font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.post-file > summary::before { content: '📄 '; }
.post-file[open] > summary { border-bottom: 1px solid var(--slate); margin-bottom: 10px; }
.post-file > *:not(summary) { margin-bottom: 10px; }
.hint { text-align: center; font-size: 11.5px; color: var(--ink-faint); margin: 8px 0 0; }
.icon-btn.active { color: var(--emerald); background: #ecfdf5; }

/* Status căutare web + surse */
.search-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }
.search-status .spin { width: 14px; height: 14px; border: 2px solid var(--slate); border-top-color: var(--emerald); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sources { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px;
  border: 1px solid var(--slate); background: var(--bg); border-radius: 10px;
  padding: 6px 10px; font-size: 12px; color: var(--ink-soft); text-decoration: none;
  transition: .15s;
}
.source-chip:hover { border-color: var(--emerald); color: var(--emerald-deep); }
.source-chip .num { background: var(--emerald); color: #fff; border-radius: 5px; width: 16px; height: 16px; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.source-chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Galerie de imagini exemplu din căutarea web */
.search-images { margin: 4px 0 14px; }
.si-head { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 0 0 8px; }
.si-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.si-item { margin: 0; border: 1px solid var(--slate); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow); transition: .18s; }
.si-item:hover { border-color: var(--emerald); transform: translateY(-2px); }
.si-link { display: block; aspect-ratio: 4 / 3; background: var(--slate-2); }
.si-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.si-cap { padding: 8px 10px; font-size: 12px; line-height: 1.35; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.si-src { font-size: 10.5px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .si-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .si-cap { font-size: 11px; }
}

/* Ilustrare automată inline (placeholder cât se caută) */
.inline-illustrate { margin: 14px 0; }
.ill-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-style: italic; padding: 12px 14px; border: 1px dashed var(--slate); border-radius: 12px; background: var(--bg); }
.ill-loading .spin { width: 14px; height: 14px; border: 2px solid var(--slate); border-top-color: var(--emerald); border-radius: 50%; animation: spin .7s linear infinite; }

/* Butoane de acțiune rapidă la finalul mesajelor */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-actions button {
  border: 1px solid var(--slate); background: var(--bg); border-radius: 999px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: .15s;
}
.quick-actions button:hover { border-color: var(--emerald); color: var(--emerald-deep); background: #ecfdf5; }

/* ---------- Canvas / Pânză Live ---------- */
.canvas { flex: 1 1 60%; display: none; flex-direction: column; border-left: 1px solid var(--slate); background: var(--bg); min-width: 0; }
.canvas-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--slate); }
.canvas-tabs { display: flex; gap: 6px; overflow-x: auto; }
.canvas-tab { border: 1px solid var(--slate); background: var(--bg-warm); border-radius: 9px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink-soft); }
.canvas-tab.active { border-color: var(--emerald); color: var(--emerald-deep); background: #ecfdf5; }
.canvas-body { flex: 1; overflow: auto; }
.canvas-body pre { margin: 0; padding: 18px; height: 100%; }
.canvas-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.canvas-preview-bar { display: flex; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--slate); background: var(--bg-warm); position: sticky; top: 0; z-index: 2; }

/* ---------- Vizualizator documente în pânză ---------- */
.doc-scroll { background: var(--bg-warm); min-height: 100%; }
.doc-wrap { padding: 28px 24px; max-width: 820px; margin: 0 auto; }
.doc-view { color: var(--ink); }
/* Document „pe hârtie" (PDF/Word/RTF/text) */
.doc-paper {
  background: #fff; border: 1px solid var(--slate); border-radius: 12px;
  box-shadow: var(--shadow); padding: 40px 44px; line-height: 1.7;
}
.doc-paper h1, .doc-paper h2, .doc-paper h3 { font-family: 'Plus Jakarta Sans', sans-serif; }
.doc-paper h1 { padding-bottom: .4em; border-bottom: 3px solid #059669; }
.doc-paper h2 { padding-bottom: .25em; border-bottom: 1px solid var(--slate); }
.doc-paper figure.doc-figure { margin: 1.5em auto; text-align: center; }
.doc-paper figure.doc-figure img { display: block; margin: 0 auto; max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.doc-paper figure.doc-figure figcaption { margin-top: .5em; font-size: 13px; font-style: italic; color: #6b7280; }
.doc-paper img.doc-img-loading { display: block; width: 100%; height: 220px; border-radius: 8px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%); background-size: 200% 100%;
  animation: docImgPulse 1.4s ease-in-out infinite; }
@keyframes docImgPulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.doc-pre { white-space: pre-wrap; word-wrap: break-word; font-family: Georgia, 'Times New Roman', serif; font-size: 15px; margin: 0; background: none; padding: 0; color: var(--ink); }
.doc-code { margin: 0; border-radius: 12px; overflow: auto; }
.doc-empty { color: var(--ink-soft); font-style: italic; }
/* Tabel pentru CSV/XLSX */
.doc-table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.doc-table th, .doc-table td { border: 1px solid var(--slate); padding: 8px 12px; text-align: left; white-space: nowrap; }
.doc-table th { background: var(--slate-2); font-weight: 700; }
.doc-table tbody tr:nth-child(even) { background: var(--bg-warm); }
.doc-table tbody tr:hover { background: #ecfdf5; }
@media (max-width: 640px) {
  .doc-wrap { padding: 16px 12px; }
  .doc-paper { padding: 24px 20px; }
}

/* ---------- Overlay drag & drop ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(16,185,129,.12); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 24px;
}
.drop-overlay.show { display: flex; }
.drop-overlay .drop-box {
  border: 3px dashed var(--emerald); border-radius: 24px; background: rgba(255,255,255,.9);
  padding: 48px 56px; text-align: center; font-family: var(--font-display);
  font-size: 24px; font-weight: 700; color: var(--emerald-deep); box-shadow: var(--shadow);
}
.drop-overlay .drop-box span { display: block; margin-top: 8px; font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--ink-soft); }

/* ---------- Meniu radial ---------- */
.radial { position: fixed; z-index: 100; width: 0; height: 0; }
.radial button {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--slate); background: #fff; box-shadow: var(--shadow);
  cursor: pointer; font-size: 18px; display: grid; place-items: center;
  transform: translate(-50%, -50%) scale(0); transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.radial:not([hidden]) button { transform: translate(-50%, -50%) scale(1); }
.radial button:hover { border-color: var(--emerald); background: #ecfdf5; }
.radial button:nth-child(1) { left: 0; top: -58px; }
.radial button:nth-child(2) { left: 55px; top: -18px; }
.radial button:nth-child(3) { left: 34px; top: 46px; }
.radial button:nth-child(4) { left: -34px; top: 46px; }
.radial button:nth-child(5) { left: -55px; top: -18px; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--slate); border-radius: 6px; border: 3px solid var(--bg-warm); }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* ---------- Responsive ---------- */
/* Sidebar ca overlay pe ecrane medii */
@media (max-width: 900px) {
  .stage { flex-direction: column; }
  .stage.split .conversation { flex-basis: auto; }
  .canvas { border-left: 0; border-top: 1px solid var(--slate); }
  .suggestions { grid-template-columns: 1fr; }
  .sidebar { position: absolute; z-index: 30; height: 100%; box-shadow: var(--shadow); }
}

/* Backdrop pentru sidebar pe mobil */
.sidebar-backdrop { display: none; }

/* ---------- Telefon ---------- */
@media (max-width: 640px) {
  /* Împiedică pagina să depășească lățimea ecranului */
  html, body { overflow-x: hidden; max-width: 100%; }
  .messages { overflow-x: hidden; }
  .content, .content p, .content li { overflow-wrap: anywhere; word-break: break-word; }
  .content pre, .codeblock, .codeblock pre { max-width: 100%; }

  /* Sidebar glisează complet în afara ecranului */
  .sidebar { width: 84vw; max-width: 320px; }
  .sidebar.collapsed { margin-left: 0; transform: translateX(-105%); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.4); z-index: 25; }

  /* ---- Topbar compact ---- */
  .topbar { padding: 8px 10px; gap: 8px; }
  .brand { gap: 8px; min-width: 0; flex: 1; }
  .avatar, .avatar-sheep { width: 34px; height: 34px; }
  .brand-text { min-width: 0; }
  .brand-text h1 { font-size: 15.5px; line-height: 1.1; }
  .status { font-size: 10px; max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  #tempChatBtn { padding: 9px; }
  #tempChatBtn .label { display: none; }
  .chip { padding: 9px 12px; font-size: 12px; }
  .chip.primary .label-full { display: none; }

  /* ---- Mesaje ca bule de chat ---- */
  .messages { padding: 16px 12px 8px; }
  .msg { max-width: 100%; margin-bottom: 14px; gap: 8px; align-items: flex-end; }

  /* Mesajul UTILIZATORULUI: bulă închisă, aliniată la dreapta */
  .msg.user { flex-direction: row-reverse; }
  .msg.user .who { display: none; }
  .msg.user .bubble {
    flex: 0 1 auto; max-width: 86%;
    background: var(--ink); color: #fff;
    padding: 10px 14px; border-radius: 18px 18px 5px 18px;
  }
  .msg.user .bubble .name { display: none; }
  .msg.user .content { color: #fff; font-size: 14.5px; line-height: 1.55; }
  .msg.user .content p { margin: 0; }
  .msg.user .content a { color: #a7f3d0; }

  /* Mesajul MIORIȚEI: avatar mic + conținut plat, pe toată lățimea */
  .msg.bot { align-items: flex-start; gap: 8px; }
  .msg.bot .who { width: 30px; height: 30px; font-size: 13px; }
  .msg.bot .bubble { flex: 1; min-width: 0; }
  .msg.bot .bubble .name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; }
  .content { font-size: 15px; }
  .model-badge { font-size: 10px; margin-left: 0; }

  /* ---- Ecran de întâmpinare ---- */
  .welcome { margin-top: 2vh; }
  .welcome-sheep { width: 104px; height: 98px; }
  .welcome h2 { font-size: 19px; line-height: 1.25; }
  .welcome p { font-size: 13.5px; }
  .suggestions button { padding: 13px 14px; font-size: 13px; }
  .suggestions .card-ic, .suggestions .card-ic .gen-ic { width: 30px; height: 30px; }

  /* ---- Canvas full-screen peste chat ---- */
  .stage.split .canvas { position: fixed; inset: 0; z-index: 40; border: 0; background: var(--bg); height: 100%; }
  .canvas-body pre { padding: 12px; }

  /* ---- Composer lipit jos, cu safe-area (iPhone) ---- */
  .composer { padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .composer-row { padding: 5px 5px 5px 12px; border-radius: 22px; }
  #input { font-size: 16px; } /* 16px previne zoom-ul automat pe iOS */
  .send-btn { width: 38px; height: 38px; }
  .hint { display: none; }
  .attachments .thumb { width: 46px; height: 46px; }

  /* ---- Cod: derulare orizontală doar în bloc ---- */
  .codeblock { margin: 12px 0; }
  .codeblock .cb-head { flex-wrap: wrap; gap: 6px; padding: 7px 12px; }
  .codeblock .cb-actions { flex-wrap: wrap; gap: 6px; }
  .codeblock .cb-btn { padding: 5px 9px; }
  .codeblock pre { padding: 12px; -webkit-overflow-scrolling: touch; }
  .codeblock code { font-size: 12.5px; }

  /* ---- Surse, acțiuni rapide, tabele ---- */
  .sources { gap: 6px; }
  .source-chip { max-width: 100%; }
  .quick-actions { gap: 6px; }
  .quick-actions button { font-size: 12px; padding: 8px 12px; }
  .content table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* ---- Card de fișier: pe verticală, butoane late ---- */
  .file-chip { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .fc-info { flex-basis: calc(100% - 56px); }
  .fc-actions { width: 100%; }
  .fc-actions button { flex: 1; }

  /* ---- Atașamente document ---- */
  .doc-att { max-width: 100%; }
  .msg-docs .doc-att.mini { max-width: 100%; }

  /* ---- Card muzical ---- */
  .music-actions { flex-wrap: wrap; }
  .music-actions button { flex: 1; }

  /* ---- Meniu radial mai mare pentru deget ---- */
  .radial button { width: 46px; height: 46px; }

  /* ---- Lightbox ---- */
  .lightbox { padding: 12px; }
  .lightbox .lb-nav { width: 46px; height: 46px; }
  .lightbox .lb-close { top: 12px; right: 14px; }
}

/* Zone de atingere mai generoase pe orice ecran tactil */
@media (hover: none) and (pointer: coarse) {
  .cb-btn, .quick-actions button, .source-chip, .conv-item, .fc-actions button, .da-del { min-height: 40px; }
  .icon-btn { padding: 11px; }
  .suggestions button { padding: 16px; }
}

/* ============ Pagina „Capabilități & Funcționalități" ============ */
.features-page {
  position: fixed; inset: 0; z-index: 60; background: var(--bg-warm);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(8px); transition: opacity .22s ease, transform .22s ease;
}
.features-page[hidden] { display: none; }
.features-page.show { opacity: 1; transform: none; }

.fp-topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--bg); border-bottom: 1px solid var(--slate);
  position: sticky; top: 0; z-index: 5;
}
.fp-home { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; border: 1px solid var(--slate); background: var(--bg); color: var(--ink-soft); border-radius: 10px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s; }
.fp-home:hover { border-color: var(--emerald); color: var(--emerald-deep); background: #ecfdf5; }
.fp-brand { display: flex; align-items: center; gap: 10px; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 16px; color: var(--ink); white-space: nowrap; }
.fp-brand-ic { font-size: 20px; }
.fp-searchbox { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 8px; background: var(--bg-warm); border: 1.5px solid var(--slate); border-radius: 12px; padding: 8px 12px; color: var(--ink-faint); transition: border-color .18s; }
.fp-searchbox:focus-within { border-color: var(--emerald); color: var(--emerald-deep); }
.fp-searchbox input { flex: 1; border: 0; background: none; outline: none; font-size: 14px; color: var(--ink); font-family: inherit; }
.fp-close { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--slate); background: var(--bg); color: var(--ink-soft); font-size: 16px; cursor: pointer; transition: .15s; }
.fp-close:hover { border-color: #ef4444; color: #ef4444; }

.fp-body { flex: 1; overflow: auto; scroll-behavior: smooth; }

/* Hero */
.fp-hero { max-width: 960px; margin: 0 auto; padding: 48px 24px 24px; text-align: center; }
.fp-hero-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--emerald-deep); background: #ecfdf5; border: 1px solid #a7f3d0; padding: 5px 12px; border-radius: 999px; }
.fp-hero h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: clamp(28px, 5vw, 44px); font-weight: 800; color: var(--ink); margin: 16px 0 10px; letter-spacing: -.5px; }
.fp-acronym { margin: 2px auto 14px; }
.fp-acronym-word { display: inline-block; font-size: 14px; color: var(--ink-soft); background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 999px; padding: 6px 16px; letter-spacing: .2px; }
.fp-acronym-word b { color: var(--emerald-deep); font-weight: 800; }
.fp-hero p { color: var(--ink-soft); font-size: 15.5px; line-height: 1.65; max-width: 620px; margin: 0 auto; }
.fp-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.fp-stat { background: var(--bg); border: 1px solid var(--slate); border-radius: 16px; padding: 16px 24px; min-width: 120px; box-shadow: var(--shadow); }
.fp-stat-n { display: block; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 26px; font-weight: 800; color: var(--emerald-deep); }
.fp-stat-l { display: block; font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* Tabs (lipite stabil în capul zonei derulabile) */
.fp-tabs { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px 24px; background: var(--bg-warm); border-bottom: 1px solid var(--slate); }
.fp-tab { border: 1px solid var(--slate); background: var(--bg); color: var(--ink-soft); border-radius: 999px; padding: 8px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s; font-family: inherit; }
.fp-tab:hover { border-color: var(--emerald); color: var(--emerald-deep); }
.fp-tab.active { background: var(--emerald); border-color: var(--emerald); color: #fff; }

/* Grilă de carduri */
.fp-grid { max-width: 1180px; margin: 0 auto; padding: 8px 24px 64px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.fp-card { background: var(--bg); border: 1px solid var(--slate); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); transition: border-color .18s, transform .18s; }
.fp-card:hover { border-color: #d1d5db; transform: translateY(-2px); }
.fp-card-wide { grid-column: 1 / -1; }
.fp-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fp-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: #ecfdf5; flex-shrink: 0; }
.fp-card-head h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15.5px; font-weight: 700; color: var(--ink); margin: 0; flex: 1; }
.fp-count { font-size: 12px; font-weight: 700; color: var(--emerald-deep); background: #ecfdf5; border-radius: 999px; padding: 3px 9px; }

.fp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fp-list li { position: relative; padding-left: 24px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.fp-list li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--emerald); font-weight: 800; }

.fp-feats, .fp-formats, .fp-design { display: flex; flex-direction: column; gap: 12px; }
.fp-feat-t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.fp-feat-d { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px; }

.fp-formats { display: grid; grid-template-columns: 1fr; gap: 10px; }
.fp-fmt { display: flex; align-items: center; gap: 10px; }
.fp-ext { flex-shrink: 0; font-family: ui-monospace, monospace; font-size: 11.5px; font-weight: 700; color: var(--emerald-deep); background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 7px; padding: 3px 8px; min-width: 84px; text-align: center; }
.fp-fmt-d { font-size: 12.5px; color: var(--ink-soft); }

.fp-design { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.fp-principle { display: flex; gap: 12px; align-items: flex-start; }
.fp-principle-ic { font-size: 22px; flex-shrink: 0; }

.fp-empty { text-align: center; color: var(--ink-faint); padding: 40px; font-size: 14px; }

/* Footer whitelist: creatori + sponsor + „made with ♥ by 4level4.io" */
.fp-footer { max-width: 1180px; margin: 0 auto; padding: 8px 24px 56px; }
.fp-credits { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-bottom: 22px; }
.fp-credit-col { background: var(--bg); border: 1px solid var(--slate); border-radius: 16px; padding: 18px 26px; text-align: center; min-width: 200px; box-shadow: var(--shadow); }
.fp-credit-role { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--emerald-deep); margin-bottom: 10px; }
.fp-credit-people { display: flex; flex-direction: column; gap: 6px; }
.fp-person { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; color: var(--ink); }
.fp-madeby { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--slate); font-size: 14px; color: var(--ink-soft); }
.fp-madeby a { color: var(--emerald-deep); font-weight: 700; text-decoration: none; }
.fp-madeby a:hover { text-decoration: underline; }
.fp-madeby .heart { vertical-align: -2px; animation: heartbeat 1.6s ease-in-out infinite; }

@media (max-width: 640px) {
  .fp-brand span:last-child { display: none; }
  .fp-hero { padding: 28px 16px 12px; }
  .fp-tabs { top: 0; padding: 12px 12px; }
  .fp-grid { grid-template-columns: 1fr; padding: 8px 14px 48px; gap: 14px; }
  .fp-stat { padding: 12px 18px; min-width: 96px; }
}

/* ---------- Bară de proiect multi-fișier (ZIP + preview site) ---------- */
.project-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px 0; padding: 12px 16px; flex-wrap: wrap;
  border: 1px solid var(--slate); border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), var(--bg));
}
.pb-info { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.pb-info .mi { width: 20px; height: 20px; color: var(--emerald-deep); }
.pb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pb-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--slate); background: var(--bg); color: var(--ink);
  border-radius: 999px; padding: 8px 15px; font-size: 13px; font-weight: 600; transition: .15s;
}
.pb-btn .mi { width: 17px; height: 17px; }
.pb-btn:hover { border-color: var(--emerald); color: var(--emerald-deep); background: var(--accent-soft); }
.pb-btn.pb-preview { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.pb-btn.pb-preview:hover { background: var(--emerald-deep); color: #fff; }

/* ---------- Bară de acțiuni sub răspunsul AI ---------- */
.msg-toolbar { display: flex; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--slate-2); }
.mt-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; background: transparent; color: var(--ink-faint);
  border-radius: 8px; cursor: pointer; transition: .15s;
}
.mt-btn .mi { width: 17px; height: 17px; }
.mt-btn:hover { color: var(--emerald); background: var(--slate-2); }
.mt-btn.done { color: var(--emerald); }
.mt-btn.done::after { content: 'Copiat'; position: absolute; margin-top: -34px; font-size: 11px; background: var(--ink); color: #fff; padding: 3px 7px; border-radius: 6px; }
.mt-btn.speaking { color: var(--emerald-deep); background: var(--accent-soft); animation: fadepulse 1.4s ease-in-out infinite; }

/* ---------- Comenzi rapide (slash) ---------- */
.slash-menu {
  position: absolute; bottom: 100%; left: clamp(16px, 5vw, 60px); right: auto; margin-bottom: 8px;
  min-width: 300px; max-width: 420px; z-index: 40;
  background: var(--bg); border: 1px solid var(--slate); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; max-height: 320px; overflow-y: auto;
}
.slash-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 9px; padding: 9px 11px; cursor: pointer;
  color: var(--ink); font-size: 13.5px; transition: .12s;
}
.slash-item .mi { width: 18px; height: 18px; color: var(--ink-faint); flex-shrink: 0; }
.slash-item .sl-cmd { font-weight: 700; color: var(--emerald-deep); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.slash-item .sl-desc { color: var(--ink-soft); font-size: 12.5px; }
.slash-item.active, .slash-item:hover { background: var(--accent-soft); }
.slash-item.active .mi { color: var(--emerald-deep); }

/* ---------- Buton microfon (dictare) ---------- */
.mic-btn.recording { color: #ef4444; background: #fef2f2; animation: fadepulse 1.2s ease-in-out infinite; }

/* ---------- Footer composer + indicator context ---------- */
.composer-foot { display: flex; align-items: center; justify-content: center; gap: 14px; max-width: 820px; margin: 8px auto 0; }
.ctx-meter { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-faint); flex-shrink: 0; }
.ctx-meter .cm-bar { width: 54px; height: 5px; background: var(--slate); border-radius: 999px; overflow: hidden; }
.ctx-meter .cm-fill { display: block; height: 100%; width: 0; background: var(--emerald); border-radius: 999px; transition: width .3s ease; }
.ctx-meter .cm-fill.warn { background: #f59e0b; }
.ctx-meter .cm-txt { font-variant-numeric: tabular-nums; }

/* ---------- Grupuri istoric + meniu conversație ---------- */
.conv-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); padding: 12px 12px 4px; }
.ci-pin { display: inline-flex; color: var(--emerald-deep); }
.ci-pin .mi { width: 13px; height: 13px; }
.ci-menu { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; padding: 4px; border-radius: 7px; display: grid; place-items: center; opacity: 0; transition: .12s; }
.ci-menu .mi { width: 15px; height: 15px; }
.conv-item:hover .ci-menu { opacity: 1; }
.ci-menu:hover { background: var(--bg); color: var(--emerald); }
.conv-menu {
  position: fixed; z-index: 100; min-width: 190px;
  background: var(--bg); border: 1px solid var(--slate); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
}
.conv-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 8px; padding: 9px 11px; cursor: pointer;
  color: var(--ink); font-size: 13px; transition: .12s;
}
.conv-menu button .mi { width: 16px; height: 16px; color: var(--ink-faint); }
.conv-menu button:hover { background: var(--slate-2); }
.conv-menu button.danger { color: #dc2626; }
.conv-menu button.danger .mi { color: #dc2626; }
.conv-menu button.danger:hover { background: rgba(220,38,38,.12); }

/* ---------- Favicon în chip-urile de surse ---------- */
.sc-fav { width: 15px; height: 15px; border-radius: 3px; flex-shrink: 0; vertical-align: -2px; }

/* ---------- Modal scurtături de tastatură ---------- */
.shortcuts-modal { position: fixed; inset: 0; z-index: 200; background: var(--overlay); display: grid; place-items: center; animation: sb-in .18s ease; }
.shortcuts-modal .sc-box { width: min(440px, 92vw); background: var(--bg); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.shortcuts-modal .sc-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--slate); font-weight: 700; color: var(--ink); }
.shortcuts-modal .sc-head .mi { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; color: var(--emerald-deep); }
.shortcuts-modal .sc-close { border: 0; background: transparent; cursor: pointer; color: var(--ink-faint); padding: 4px; border-radius: 8px; }
.shortcuts-modal .sc-close:hover { background: var(--slate-2); color: var(--ink); }
.shortcuts-modal .sc-list { padding: 12px 20px 20px; }
.shortcuts-modal .sc-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.shortcuts-modal .sc-row kbd { flex-shrink: 0; min-width: 120px; font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--slate-2); border: 1px solid var(--slate); border-radius: 6px; padding: 4px 8px; color: var(--ink); text-align: center; }
.shortcuts-modal .sc-row span { color: var(--ink-soft); font-size: 13.5px; }

/* ---------- Comutator temă (topbar) ---------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
#themeToggle .th-sun { display: none; }
#themeToggle .th-moon { display: block; }
[data-theme="dark"] #themeToggle .th-sun { display: block; }
[data-theme="dark"] #themeToggle .th-moon { display: none; }

/* În temă întunecată, previzualizarea documentelor rămâne pe „hârtie" (lizibilă). */
[data-theme="dark"] .doc-paper { background: #f8fafc; color: #1f2937; }
[data-theme="dark"] .doc-paper h1, [data-theme="dark"] .doc-paper h2,
[data-theme="dark"] .doc-paper h3, [data-theme="dark"] .doc-paper h4 { color: #0f172a; }
[data-theme="dark"] .search-images img, [data-theme="dark"] .si-item { background: var(--slate-2); }
