:root {
  --bg: #0a0f16; --panel: #121a24; --panel2: #18222f; --line: #233142;
  --text: #e8f1fa; --muted: #8aa0b6; --accent: #6cc4ff; --accent2: #3a8dde;
  --ok: #45d49a; --warn: #ffb547; --danger: #ff6b6b;
  --me: #1d3a56; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.screen { height: 100dvh; display: flex; flex-direction: column; }

/* login */
#login { align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.login-box h1 { margin: 4px 0 0; font-weight: 300; letter-spacing: .08em; font-size: 34px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
#inCod { width: 100%; text-align: center; font-size: 30px; letter-spacing: .5em; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.primary { width: 100%; padding: 14px; border: 0; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #04121f; font-weight: 600; }
.primary:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--accent); padding: 6px; }
.err { color: var(--danger); min-height: 1.4em; margin: 0; }

/* header */
header { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; border-bottom: 1px solid var(--line); background: rgba(10,15,22,.92); }
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: .06em; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(138,160,182,.15); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(69,212,154,.18); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,107,.18); }
.status { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon { background: none; border: 0; font-size: 22px; padding: 2px 8px; color: var(--muted); }
.menu { position: absolute; right: 12px; top: calc(52px + var(--safe-t)); z-index: 10; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 220px; }
.menu button { background: none; border: 0; text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.menu button:last-child { border-bottom: 0; color: var(--danger); }

/* carduri în așteptare (sus, mereu vizibile) */
.pending { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; max-height: 55dvh; overflow-y: auto; }
.pending:not(:empty) { padding-top: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }

/* conversație */
.feed { flex: 1; overflow-y: auto; padding: 14px 12px 20px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; background: var(--panel); white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 13px; text-align: center; padding: 2px 8px; }
.msg.working { color: var(--muted); }
.msg.working::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.screen-card { align-self: stretch; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.screen-card .q { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.screen-card .warn { background: rgba(255,181,71,.12); border: 1px solid rgba(255,181,71,.5); color: var(--warn); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-weight: 600; }
.md p { margin: 0 0 8px; } .md p:last-child { margin-bottom: 0; }
.md ul { margin: 4px 0 8px; padding-left: 20px; }
.md code { background: var(--panel2); padding: 1px 5px; border-radius: 6px; font-size: 13px; word-break: break-all; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 6px 0; display: block; overflow-x: auto; }
.md td, .md th { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
.md h3, .md h4 { margin: 8px 0 4px; font-size: 15px; }

/* card de acțiune */
.action { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.action.plata { border-color: rgba(255,107,107,.6); box-shadow: inset 0 0 0 1px rgba(255,107,107,.15); }
.action .top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.action .tip { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); border: 1px solid rgba(108,196,255,.4); border-radius: 999px; padding: 2px 8px; }
.action.plata .tip { color: var(--danger); border-color: rgba(255,107,107,.5); }
.action .titlu { font-weight: 600; }
.action .text { white-space: pre-wrap; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 40dvh; overflow-y: auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.action .btns { display: flex; gap: 10px; margin-top: 10px; }
.action .btns button { flex: 1; padding: 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.action .btns .confirm { background: linear-gradient(135deg, var(--ok), #2fae7c); color: #03180f; font-weight: 700; border: 0 !important; position: relative; overflow: hidden; }
.action.plata .btns .confirm { background: linear-gradient(135deg, #ff8a8a, var(--danger)); color: #1f0505; }
.action .confirm .fill { position: absolute; inset: 0; background: rgba(255,255,255,.35); transform-origin: left; transform: scaleX(0); }
.action .confirm.holding .fill { transition: transform 1.6s linear; transform: scaleX(1); }
.action .confirm span { position: relative; }
.action .hint { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; }
.action .res { margin-top: 10px; font-size: 14px; }
.action.done { opacity: .85; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-left: auto; }
.badge.ok { background: rgba(69,212,154,.15); color: var(--ok); }
.badge.bad { background: rgba(255,107,107,.15); color: var(--danger); }
.badge.wait { background: rgba(108,196,255,.15); color: var(--accent); }

/* bara de jos */
footer { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + var(--safe-b)); background: rgba(10,15,22,.96); }
.talk-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.talk { background: none; border: 0; padding: 0; border-radius: 50%; }
.orb { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 300;
  background: radial-gradient(circle at 50% 40%, #1c2a3a, #0a0f16); border: 3px solid var(--accent2); color: #e8f4ff; transition: transform .2s, box-shadow .2s; }
.orb.small { width: 76px; height: 76px; }
.talk.live .orb { border-color: var(--ok); box-shadow: 0 0 0 6px rgba(69,212,154,.15), 0 0 28px rgba(69,212,154,.35); }
.talk.speaking .orb { animation: pulse 1.1s ease-in-out infinite; border-color: var(--accent); }
.talk.connecting .orb { opacity: .6; }
@keyframes pulse { 0%,100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(108,196,255,.15); } 50% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(108,196,255,.08); } }
.talk-label { color: var(--muted); font-size: 14px; }
.text-row { display: flex; gap: 8px; }
.text-row input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; }
.send { width: 48px; border-radius: 14px; border: 0; background: var(--accent2); color: #fff; font-size: 18px; }
