:root {
  --bg: #0E1014;
  --bg-deep: #0B0D11;
  --surface: #161920;
  --surface-2: #1B1F28;
  --line: #262A35;
  --line-soft: #1E222B;
  --chip: #232733;
  --text: #ECEEF2;
  --text-2: #C9CFDA;
  --muted: #9AA3B2;
  --faint: #8A92A1;
  --accent: #FF6B86;
  --accent-ink: #1B0A10;
  --accent-soft: #2A1820;
  --cyan: #5CC8E0;
  --cyan-soft: #15242A;
  --amber: #F2B45C;
  --amber-soft: #2A2215;
  --violet: #A99BF2;
  --violet-soft: #1E1A2C;
  --green: #4FD1A1;
  --green-soft: #10261E;
  --red: #FF8A7A;
  --radius: 16px;
  --font: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
.ic { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
/* În modul Fullscreen, Telegram își pune butoanele (închidere, meniu) peste
 * partea de sus și expune înălțimea lor ca variabile CSS. Fără Telegram = 0. */
:root { --tg-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
.view { flex-grow: 1; display: flex; flex-direction: column; gap: 20px; padding: calc(22px + var(--tg-top)) 18px calc(96px + env(safe-area-inset-bottom)); outline: none; }
.view.chat-view { padding-top: var(--tg-top); }
.view.chat-view { padding-bottom: 0; gap: 0; height: 100dvh; }
.login { padding-top: calc(24px + var(--tg-top)) !important; }

.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); background: var(--bg-deep); z-index: 10; }
.tabs[hidden], [hidden] { display: none !important; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--faint); }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; }

h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
p { margin: 0; }
.sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex-grow: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 2px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.link { font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.tight { padding: 12px 14px; }
.card.soft { background: var(--surface-2); border-color: transparent; }
a.card:hover, button.card:hover { border-color: #343947; }
button.card { text-align: left; width: 100%; }

.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn { height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.btn.small { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: var(--chip); color: var(--text-2); white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: #2C1716; color: var(--red); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.pill { height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid #2E3340; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }

.field { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.field input, .field select { flex-grow: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 15px; }
.field select option { background: var(--surface); }
.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 15px; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.45; }
label.lbl { font-size: 13px; font-weight: 700; color: var(--text-2); }

.qa { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: left; }
.qa .badge { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.qa span.t { font-size: 15px; font-weight: 700; }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.b-cyan { background: var(--cyan-soft); color: var(--cyan); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--chip); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; border-radius: 28px; font-size: 18px; }
.avatar.sq { border-radius: 10px; width: 36px; height: 36px; font-size: 13px; color: var(--text-2); }

.bot-card .dot { width: 10px; height: 10px; border-radius: 5px; background: #4A5060; flex-shrink: 0; }
.bot-card .dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(79, 209, 161, .15); }
.bot-actions { display: flex; gap: 8px; margin-top: 12px; }
.logbox { margin-top: 12px; max-height: 260px; overflow: auto; background: var(--bg-deep); border-radius: 10px; padding: 10px; font: 12px/1.45 ui-monospace, Consolas, monospace; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.v.down { color: var(--red); }
.v.up { color: var(--green); }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 92px; }
.bars .col { flex-grow: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars .bar { width: 100%; border-radius: 6px; background: #2E3340; min-height: 3px; }
.bars .bar.peak { background: var(--accent); }
.bars .lab { font-size: 11px; color: var(--muted); }
.hbar { display: flex; flex-direction: column; gap: 4px; }
.hbar .meta { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.hbar .meta span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .meta span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.hbar .track { height: 6px; border-radius: 3px; background: var(--chip); }
.hbar .fill { height: 6px; border-radius: 3px; background: var(--accent); }

.note { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.note .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.note p { font-size: 14px; line-height: 1.45; }

/* chat */
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.chat-head .badge { width: 40px; height: 40px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.status-on { font-size: 12px; color: var(--green); font-weight: 600; }
.msgs { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; }
.msg { max-width: 86%; padding: 11px 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border-radius: 18px 18px 6px 18px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; white-space: pre-wrap; }
.msg.bot b { font-weight: 800; }
.msg, .composer textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.ctx-menu { position: fixed; z-index: 100000; min-width: 170px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); box-shadow: 0 12px 30px rgba(0,0,0,.45); display: flex; flex-direction: column; }
.ctx-item kbd { font-family: inherit; font-size: 12px; font-weight: 600; color: var(--faint); }
.ctx-item { display: flex; justify-content: space-between; gap: 18px; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; }
.ctx-item:hover:not(:disabled) { background: var(--chip); }
.ctx-item:disabled { color: var(--faint); opacity: .6; cursor: default; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.msg-actions .copy-btn { margin-top: 0; }
.pieces-dlg { max-height: calc(100dvh - 40px); overflow-y: auto; overflow-x: hidden; }
.pieces { display: flex; flex-direction: column; gap: 8px; }
.piece { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 13.5px; line-height: 1.45; }
.piece .piece-txt { flex-grow: 1; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.piece .ic { margin-top: 2px; color: var(--muted); }
.piece.done { border-color: var(--cyan); }
.piece.done .ic { color: var(--cyan); }
.piece-text { width: 100%; min-height: 140px; font-size: 14px; line-height: 1.45; resize: vertical; white-space: pre-wrap; overflow-x: hidden; -webkit-user-select: text; user-select: text; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 11px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.copy-btn .ic { width: 15px; height: 15px; }
.copy-btn:active { transform: scale(.97); }
.copy-btn.done { color: var(--cyan); border-color: var(--cyan); }
.msg.bot code { background: var(--chip); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg.bot a { color: var(--cyan); text-decoration: underline; }
.msg.bot.gen-img { padding: 6px; max-width: 86%; white-space: normal; }
.msg.bot.gen-img img { display: block; width: 100%; border-radius: 13px; background: var(--surface-2); }
.msg.bot.gen-img .msg-actions { margin: 8px 4px 2px; align-items: center; }
.msg.bot.gen-img a.copy-btn { color: var(--muted); text-decoration: none; }
.msg.doc { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.msg.thinking { color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.msg.thinking .thinking-line { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.msg.thinking .live-text { color: var(--text); white-space: pre-wrap; }
.msg.thinking .live-text.typing::after { content: ''; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--accent); border-radius: 1px; animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 3px; background: var(--muted); animation: blink 1.2s infinite both; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
/* Doar lista de mesaje se micșorează; capul, sugestiile și câmpul de scris își
 * păstrează mereu înălțimea (altfel sugestiile se turteau la o linie, 02.10). */
.chat-head, .suggest, .attach-preview, .composer { flex-shrink: 0; }
.msgs { min-height: 0; }
.suggest { display: flex; gap: 8px; padding: 8px 14px 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.suggest::-webkit-scrollbar { display: none; }
.suggest .pill { flex-shrink: 0; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px calc(84px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.composer textarea { flex-grow: 1; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 15px; line-height: 1.4; resize: none; }
.attach-preview { padding: 0 14px 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.attach-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.send { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* promo */
.toggle { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: #2E3340; display: flex; align-items: center; padding: 3px; flex-shrink: 0; }
.switch .knob { width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: transform .15s; }
.switch.on { background: var(--green); }
.switch.on .knob { transform: translateX(20px); }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.used img { opacity: .35; }
.photo .tag { position: absolute; left: 6px; bottom: 6px; }
.photo .del { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(11, 13, 17, .8); color: var(--text); display: flex; align-items: center; justify-content: center; }
.photo .vid { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 700; }

.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px; }
.err { color: var(--red); font-size: 14px; font-weight: 600; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom)); max-width: 520px; width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #ECEEF2; color: #0E1014; font-size: 14px; font-weight: 700; z-index: 20; }
.toast.bad { background: var(--red); }
.spinner { width: 18px; height: 18px; border-radius: 9px; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 60px; border-radius: 16px; background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: min(520px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.seg { display: flex; gap: 8px; }
.seg button { font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; background: var(--surface); color: var(--text-2); border: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 700; }

/* Modele studio (2026-11-20) */
.row.wrap { flex-wrap: wrap; gap: 8px; }
button.chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; border: 0; padding: 6px 10px; }

/* ---------------------------------------------------------------------------
 * Ecran lat (programul Liv de pe PC, browser, Telegram Desktop mărit), 2026-11-20.
 * Sub 860px rămâne exact ca pe telefon. Peste: meniu în stânga, conținut mai lat,
 * iar textul și elementele cresc proporțional cu fereastra (--z, setat din app.js
 * ca CSS zoom pe zona de conținut; înălțimile în dvh se împart la --z).
 * ------------------------------------------------------------------------- */
:root { --z: 1; }
@media (min-width: 860px) {
  .shell { max-width: none; flex-direction: row; align-items: stretch; }
  .tabs { position: sticky; top: 0; left: auto; transform: none; order: -1; flex-shrink: 0;
    width: 96px; max-width: none; height: 100dvh; padding: 28px 0 0; border-top: 0;
    border-right: 1px solid var(--line-soft); grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start; }
  .tabs a { font-size: 12px; gap: 6px; border-radius: 14px; margin: 0 10px; }
  .tabs a:hover { background: var(--surface); color: var(--text-2); }
  .tabs a[aria-current="page"] { background: var(--accent-soft); }
  .tabs .ic { width: 22px; height: 22px; }
  .view { zoom: var(--z); width: calc(100% / var(--z)); max-width: 1080px; margin: 0 auto; padding: 32px 36px 48px; min-width: 0; }
  .view.chat-view { height: calc(100dvh / var(--z)); padding-bottom: 0; }
  .login { min-height: calc(100dvh / var(--z)); max-width: 520px; margin: 0 auto; }
  .toast { bottom: 24px; }
  .grid2 { gap: 14px; }
  .msg { max-width: 78%; }
}
@media (min-width: 1280px) {
  .grid2:has(> .card.kpi:nth-child(3)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* „Mereu deasupra” (doar în programul Liv de pe PC) */
.pin-btn { position: fixed; top: 8px; right: 8px; z-index: 15; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 15px; line-height: 1; opacity: .55; filter: grayscale(1); }
.pin-btn:hover { opacity: 1; }
.pin-btn.on { opacity: 1; filter: none; background: var(--accent-soft); border-color: var(--accent); }
@media (min-width: 860px) {
  .pin-btn { top: auto; right: auto; bottom: 20px; left: 28px; width: 40px; height: 40px; font-size: 17px; }
}
.chip-sep { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--line); }
.note-chip { align-self: flex-start; margin: 6px 0 8px; white-space: normal; }
