[hidden] { display: none !important; }  /* #login/#main au display:flex, care altfel bate atributul hidden */
:root {
  --bg: #101418; --panel: #182027; --panel2: #1f2a33; --line: #2a3742; --text: #e8edf2; --muted: #8c99a6;
  --accent: #2f9e6e; --accent2: #1f7a54; --stop: #c4473a; --warn: #d9a43b; --blue: #4aa8e0;
  --user: #22303b; --bot: #1c2a24; --good: #2fbf7f; --bad: #e0705f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app {
  display: flex; flex-direction: column; height: 100dvh; max-width: 720px; margin: 0 auto;
  padding: max(env(safe-area-inset-top), 10px) 12px max(env(safe-area-inset-bottom), 12px);
}
.top { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); }
.who h1 { font-size: 19px; margin: 0; line-height: 1.1; }
.top-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.meta { color: var(--muted); font-size: 13px; text-align: right; }
.status { font-size: 14px; color: var(--muted); }
.status.listening { color: var(--accent); }
.status.speaking { color: var(--blue); }
.status.connecting, .status.tool { color: var(--warn); }
.status.error { color: var(--stop); }
.btn-ghost {
  font: inherit; font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px;
}

/* ---- bara de sarcini */
.tasks { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.task {
  display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 10px;
  background: var(--panel2); border-radius: 10px; border-left: 3px solid var(--warn);
}
.task .tl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .tt { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.task .ti { width: 16px; height: 16px; flex: none; text-align: center; line-height: 16px; font-weight: 700; }
.task.run .ti { border: 2px solid var(--warn); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.task.ok { border-left-color: var(--good); } .task.ok .ti { color: var(--good); }
.task.later { border-left-color: var(--good); cursor: pointer; } .task.later .ti { color: var(--good); }
.task.later .tl { white-space: normal; }
.task.err { border-left-color: var(--bad); } .task.err .ti { color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- login */
#login { flex: 1; display: flex; align-items: center; justify-content: center; }
#loginForm { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; }
#loginForm label { color: var(--muted); }
#pin {
  font-size: 32px; letter-spacing: 10px; text-align: center; padding: 12px;
  border-radius: 12px; border: 1px solid var(--muted); background: var(--panel); color: var(--text);
}
.btn-small { font-size: 18px; padding: 12px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; }
.err { color: var(--stop); min-height: 0; margin: 2px 0; font-size: 14px; }
.err:empty { display: none; }

/* ---- zona principală */
#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; font: inherit; font-size: 12px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; max-width: 170px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab.on { color: var(--text); border-color: var(--blue); background: #1d3242; }
.tab.busy::before { content: "• "; color: var(--warn); }
.stage {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-radius: 16px; position: relative;
}
.empty { height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 15px; padding: 20px; }

/* ---- cardul vizual */
.vcard { padding: 12px 12px 16px; }
.vhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.vhead h2 { font-size: 18px; margin: 0; line-height: 1.25; flex: 1; }
.vtag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.blk { margin-top: 12px; }
.blk h3 { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: none; }
.nota { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.text { white-space: pre-wrap; margin: 0; font-size: 16px; }
.muted { color: var(--muted); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
.tbl-in { position: relative; }
.tbl-fade { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 34px; pointer-events: none; border-radius: 0 10px 10px 0;
  background: linear-gradient(to right, rgba(24,32,39,0), rgba(16,20,24,.95)); opacity: 0; transition: opacity .2s; z-index: 2; }
.tbl-hint { display: none; font-size: 12.5px; color: var(--blue); text-align: right; margin-top: 4px; }
.tbl-box.more .tbl-fade { opacity: 1; }
.tbl-box.more:not(.scrolled) .tbl-hint { display: block; }
.tbl td.wrap, .tbl th.wrap { white-space: normal; }
.tbl td.wide { min-width: 9.5em; line-height: 1.3; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl th { white-space: normal; min-width: 3.5em; line-height: 1.2; vertical-align: bottom; position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 13px; }
.tbl .num { text-align: right; }
.tbl td.zero { color: #56636f; }
.tbl tbody tr:nth-child(even) td { background: rgba(255,255,255,.025); }
.tbl tfoot td { font-weight: 700; background: var(--panel2); border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.tbl th:first-child, .tbl tfoot td:first-child { background: var(--panel2); }
.tbl tbody tr:nth-child(even) td:first-child { background: #1b242b; }

.chart { width: 100%; }
.svgc { width: 100%; height: auto; display: block; overflow: visible; }
.svgc .ax { fill: var(--muted); font-size: 11px; }
.svgc .val { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.svgc .grid { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .pie-row i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }

.pie { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pie-svg { width: 150px; height: 150px; flex: none; }
.pie-svg .pie-c { fill: var(--text); font-size: 17px; font-weight: 700; }
.pie-svg .ax { fill: var(--muted); font-size: 10px; }
.pie-lg { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pie-row { display: flex; align-items: center; gap: 8px; }
.pie-e { flex: 1; min-width: 0; }
.pie-v { color: var(--muted); font-variant-numeric: tabular-nums; }
.pie-p { font-weight: 700; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

.kcard { display: flex; flex-direction: column; gap: 10px; }
.badge { align-self: flex-start; font-weight: 700; font-size: 16px; padding: 5px 14px; border-radius: 999px; background: #2a3440; }
.badge.bun { background: rgba(47,191,127,.18); color: var(--good); }
.badge.rau { background: rgba(224,112,95,.2); color: var(--bad); }
.badge.atentie { background: rgba(217,164,59,.18); color: var(--warn); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.kpi { background: var(--panel2); border-radius: 12px; padding: 10px 12px; }
.kpi-v { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi-e { color: var(--muted); font-size: 13px; margin-top: 2px; }
.kpi-d { font-size: 13px; margin-top: 4px; color: var(--muted); }
.kpi-d.pos { color: var(--good); } .kpi-d.neg { color: var(--bad); }
.kpi.neutru .kpi-v { color: var(--muted); }
.kpi.bun .kpi-v { color: var(--good); } .kpi.rau .kpi-v { color: var(--bad); } .kpi.atentie .kpi-v { color: var(--warn); }
.pairs { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 14.5px; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; font-variant-numeric: tabular-nums; }
.lst { margin: 0; padding-left: 18px; font-size: 14.5px; display: flex; flex-direction: column; gap: 6px; }
.free-svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.free-html { width: 100%; height: 240px; border: 0; display: block; border-radius: 10px; background: var(--panel); }

.skel-body { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.skel-l { color: var(--warn); font-size: 14px; }
.skel-bar { height: 16px; border-radius: 6px; background: linear-gradient(90deg, #212c35 25%, #2b3843 50%, #212c35 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel-bar:nth-child(3) { width: 85%; } .skel-bar:nth-child(4) { width: 92%; } .skel-bar:nth-child(5) { width: 70%; } .skel-bar:nth-child(6) { width: 80%; }
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* ---- subtitrarea */
.subs { flex: none; padding: 8px 4px 2px; min-height: 3.2em; }
.sub-user { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-user:not(:empty)::before { content: "Tu: "; color: #6b7884; }
.sub-bot { font-size: 16.5px; line-height: 1.35; max-height: 4.1em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ---- conversația completă */
.conv {
  position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column;
  padding: max(env(safe-area-inset-top), 10px) 12px max(env(safe-area-inset-bottom), 12px);
  max-width: 720px; margin: 0 auto;
}
.conv-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; font-size: 18px; }
.transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; overscroll-behavior: contain; }
.msg { padding: 9px 13px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; }
.msg.user { background: var(--user); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.bot { background: var(--bot); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; color: var(--muted); font-size: 14px; background: none; }
.msg.pending { opacity: .65; }

/* ---- butonul */
.controls { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; flex: none; }
.timer { color: var(--muted); font-size: 13px; min-height: 1.1em; font-variant-numeric: tabular-nums; }
.talk {
  position: relative; width: 116px; height: 116px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 21px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); touch-action: manipulation;
}
.talk:active { transform: scale(.97); }
.talk.on { background: var(--stop); }
.talk:disabled { opacity: .6; }
.talk .ring { position: absolute; inset: -7px; border-radius: 50%; border: 3px solid transparent; pointer-events: none; }
.talk.on.listening .ring { border-color: var(--accent); animation: pulse 1.6s infinite; }
.talk.on.speaking .ring { border-color: var(--blue); animation: pulse .8s infinite; }
.hush { font-size: 16px; padding: 7px 22px; border-radius: 999px; border: 2px solid var(--blue);
  background: none; color: var(--text); touch-action: manipulation; }
.top-btns { display: flex; gap: 6px; }
.badge { display: inline-block; flex: none; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--accent); margin-left: 5px; vertical-align: middle; }
.learn-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 20px; }
.learn-body h3 { font-size: 15px; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
.req-form { display: flex; gap: 8px; align-items: stretch; }
.req-form textarea { flex: 1; font: inherit; font-size: 15px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; resize: vertical; }
.learn-list { display: flex; flex-direction: column; gap: 8px; }
.li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 14.5px; }
.li .st { font-size: 12px; color: var(--muted); margin-top: 3px; }
.li .st b { color: var(--text); font-weight: 600; }
.li .sum { margin-top: 5px; color: var(--text); }
.li .acts { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.li .acts button { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.li .acts button.go { background: var(--accent); border-color: var(--accent); color: #fff; }
.li.lesson { display: flex; gap: 8px; align-items: flex-start; }
.li.lesson span { flex: 1; }
.li.lesson button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
.below { display: flex; gap: 8px; margin-top: 6px; }
.talk.meet .ring { border-color: var(--stop); animation: pulse 1.6s infinite; }
.meet-live { height: 100%; overflow-y: auto; padding: 14px; font-size: 15.5px; line-height: 1.45; overscroll-behavior: contain; }
.meet-live .rec { color: var(--stop); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.meet-live p { margin: 0 0 8px; }
.meet-live .t { color: var(--muted); font-size: 12px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.meet-live .wait { color: var(--muted); font-style: italic; }
.md h1 { font-size: 19px; margin: 4px 0 8px; }
.md h2 { font-size: 15px; color: var(--muted); margin: 14px 0 4px; }
.md ul { margin: 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md p { margin: 6px 0; }
.li.click { cursor: pointer; }
.voice-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 100%; }
.voice-row select { font: inherit; font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; max-width: 190px; }
.voice-row #modelSel { max-width: 130px; }
.voice-row button { padding: 3px 10px; }
.voice-note { margin: 2px 0 0; text-align: center; min-height: 1em; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9 } 100% { transform: scale(1.12); opacity: 0 } }
