:root {
  --bg: #07080d; --bg2: #0c0e16; --panel: rgba(18, 21, 33, .78); --panel2: #141827; --line: rgba(148, 163, 255, .14); --line2: rgba(148, 163, 255, .26);
  --ink: #e8ebff; --mute: #8f97b8; --dim: #5d6588;
  --cyan: #22d3ee; --violet: #a855f7; --pink: #f472b6; --green: #34d399; --orange: #fb923c; --yellow: #facc15; --blue: #60a5fa; --red: #f43f5e;
  --grad: linear-gradient(135deg, #22d3ee, #a855f7);
  --r: 14px; --f: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--f); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(900px 600px at 85% -10%, rgba(168, 85, 247, .16), transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(34, 211, 238, .12), transparent 60%),
    linear-gradient(rgba(148, 163, 255, .035) 1px, transparent 1px) 0 0 / 100% 32px, linear-gradient(90deg, rgba(148, 163, 255, .035) 1px, transparent 1px) 0 0 / 32px 100%; }
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(168, 85, 247, .4); }
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--mute); gap: 14px; position: relative; z-index: 1; }
.boot-logo { width: 64px; height: 64px; margin: 0 auto; background: url(/icon.svg) center / contain no-repeat; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); filter: drop-shadow(0 0 18px rgba(34, 211, 238, .6)); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--line); background: rgba(9, 10, 17, .7); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand i { width: 36px; height: 36px; background: url(/icon.svg) center / contain no-repeat; flex: none; }
.brand b { display: block; font-size: 14px; letter-spacing: .14em; }
.brand small { display: block; font-size: 10.5px; color: var(--mute); letter-spacing: .2em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--mute); font-weight: 550; transition: .15s; }
.nav a:hover { color: var(--ink); background: rgba(148, 163, 255, .06); }
.nav a.on { color: var(--ink); background: linear-gradient(90deg, rgba(34, 211, 238, .14), rgba(168, 85, 247, .08)); box-shadow: inset 2px 0 0 var(--cyan); }
.nav a .ic { width: 20px; text-align: center; font-size: 16px; }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 8px; font-size: 12px; color: var(--mute); }
.conn { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.bad { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 1s infinite; }
.dot.run { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: blink 1.1s infinite; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(7, 8, 13, .78); backdrop-filter: blur(14px); }
.top h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sp { flex: 1; }
.page { padding: 22px 24px 90px; max-width: 1280px; width: 100%; animation: rise .25s ease; }
.mob-nav { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 10px 16px; }
  .page { padding: 16px 16px 96px; }
  .mob-nav { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(9, 10, 17, .94); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
  .mob-nav a { flex: 1; display: grid; justify-items: center; gap: 1px; padding: 5px 2px; font-size: 10.5px; color: var(--mute); border-radius: 10px; position: relative; }
  .mob-nav a .ic { font-size: 18px; }
  .mob-nav a.on { color: var(--ink); background: rgba(34, 211, 238, .1); }
  .mob-nav a .badge { position: absolute; top: 0; right: 18%; }
}

/* ---------- elemente ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; backdrop-filter: blur(10px); }
.card h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.card h3 .sp { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .sp { flex: 1; }
.stack { display: grid; gap: 10px; }
.mute { color: var(--mute); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(148, 163, 255, .06); color: var(--ink); font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: rgba(148, 163, 255, .12); border-color: rgba(148, 163, 255, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.pri { background: var(--grad); border-color: transparent; color: #06070c; }
.btn.pri:hover { filter: brightness(1.1); box-shadow: 0 0 22px rgba(34, 211, 238, .35); }
.btn.go { background: linear-gradient(135deg, #34d399, #22d3ee); border-color: transparent; color: #04120c; }
.btn.danger { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .45); color: #ffb4c2; }
.btn.danger:hover { background: rgba(244, 63, 94, .22); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { background: none; border-color: transparent; color: var(--mute); }
.btn.ghost:hover { color: var(--ink); background: rgba(148, 163, 255, .07); }
.btn.stop { background: linear-gradient(135deg, #f43f5e, #be123c); border-color: transparent; color: #fff; letter-spacing: .06em; }
.btn.stop.paused { background: linear-gradient(135deg, #facc15, #fb923c); color: #1a1000; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(5, 6, 11, .7); outline: none; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }
textarea { resize: vertical; min-height: 80px; }
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--mute); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(148, 163, 255, .1); color: var(--mute); border: 1px solid var(--line); white-space: nowrap; }
.badge.red { background: rgba(244, 63, 94, .16); color: #ffb4c2; border-color: rgba(244, 63, 94, .35); }
.badge.green { background: rgba(52, 211, 153, .14); color: #a7f3d0; border-color: rgba(52, 211, 153, .35); }
.badge.cyan { background: rgba(34, 211, 238, .14); color: #a5f3fc; border-color: rgba(34, 211, 238, .35); }
.badge.violet { background: rgba(168, 85, 247, .16); color: #e9d5ff; border-color: rgba(168, 85, 247, .38); }
.badge.yellow { background: rgba(250, 204, 21, .14); color: #fef08a; border-color: rgba(250, 204, 21, .35); }
.badge.orange { background: rgba(251, 146, 60, .14); color: #fed7aa; border-color: rgba(251, 146, 60, .35); }
.empty { padding: 30px 16px; text-align: center; color: var(--mute); }
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 14, 22, .6); color: var(--ink); transition: .15s; min-width: 0; }
a.item:hover { border-color: var(--line2); background: rgba(20, 24, 39, .8); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi small { color: var(--mute); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.bar { height: 6px; border-radius: 6px; background: rgba(148, 163, 255, .12); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 9px 13px; color: var(--mute); font-weight: 650; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--cyan); }
pre.out { margin: 0; padding: 12px; border-radius: 10px; background: #04050a; border: 1px solid var(--line); overflow: auto; max-height: 460px; white-space: pre-wrap; word-break: break-word; color: #c9d1f5; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- autentificare ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; position: relative; z-index: 1; }
.auth .card { width: min(420px, 100%); padding: 26px; }
.auth h2 { margin: 6px 0 2px; font-size: 22px; }
.auth .logo { width: 54px; height: 54px; background: url(/icon.svg) center / contain no-repeat; filter: drop-shadow(0 0 22px rgba(34, 211, 238, .45)); }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 210px; margin: 6px auto; }
.qr svg { display: block; width: 100%; height: auto; }
.code-in { text-align: center; font: 700 26px var(--mono) !important; letter-spacing: .4em; }
.err { color: #ffb4c2; font-size: 13px; min-height: 18px; }

/* ---------- chat ---------- */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .chat-wrap { grid-template-columns: 1fr; } .chat-side { order: -1; } }
.chat { display: flex; flex-direction: column; height: calc(100vh - 130px); min-height: 420px; padding: 0; overflow: hidden; }
@media (max-width: 900px) { .chat { height: calc(100vh - 200px); height: calc(100dvh - 190px); } }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.msg { max-width: 84%; padding: 11px 14px; border-radius: 14px; line-height: 1.55; animation: rise .2s ease; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(34, 211, 238, .2), rgba(168, 85, 247, .2)); border: 1px solid rgba(34, 211, 238, .3); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.err { border-color: rgba(244, 63, 94, .4); }
.msg .who { font-size: 11px; color: var(--mute); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }
.msg code { background: rgba(148, 163, 255, .12); padding: 1px 5px; border-radius: 5px; }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 1s infinite; } .typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: rgba(7, 8, 13, .6); align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 200px; resize: none; }
.plan { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(168, 85, 247, .35); background: rgba(168, 85, 247, .07); }
.plan ol { margin: 8px 0 10px; padding-left: 20px; display: grid; gap: 5px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.starters button { border: 1px solid var(--line2); background: rgba(148, 163, 255, .05); border-radius: 999px; padding: 7px 13px; color: var(--mute); cursor: pointer; font-size: 13px; }
.starters button:hover { color: var(--ink); border-color: var(--cyan); }
.hero-empty { margin: auto; text-align: center; max-width: 520px; padding: 20px; }
.hero-empty .logo { width: 72px; height: 72px; margin: 0 auto 10px; background: url(/icon.svg) center / contain no-repeat; filter: drop-shadow(0 0 26px rgba(168, 85, 247, .5)); }
.hero-empty h2 { margin: 0 0 6px; font-size: 22px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- sarcini / cronologie ---------- */
.st { font-weight: 700; }
.timeline { display: grid; gap: 8px; }
.ev { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; animation: rise .2s ease; }
.ev .av { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); font-size: 15px; }
.ev .bd { min-width: 0; padding: 7px 11px; border-radius: 10px; background: rgba(12, 14, 22, .65); border: 1px solid var(--line); }
.ev.step .bd { background: linear-gradient(90deg, rgba(34, 211, 238, .1), transparent); border-color: rgba(34, 211, 238, .3); }
.ev.finish .bd { border-color: rgba(52, 211, 153, .35); }
.ev.error .bd { border-color: rgba(244, 63, 94, .45); background: rgba(244, 63, 94, .08); }
.ev.review .bd { border-color: rgba(168, 85, 247, .45); background: rgba(168, 85, 247, .08); }
.ev .h { font-size: 12px; color: var(--mute); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ev .h b { color: var(--ink); }
.ev details summary { cursor: pointer; color: var(--mute); font-size: 12.5px; margin-top: 4px; }
.ev details pre { margin-top: 6px; max-height: 320px; }
.toolname { font-family: var(--mono); font-size: 12px; color: var(--cyan); }
.diff { font-family: var(--mono); font-size: 12px; line-height: 1.45; white-space: pre; overflow: auto; max-height: 70vh; padding: 10px 0; background: #04050a; border-radius: 10px; border: 1px solid var(--line); }
.diff div { padding: 0 12px; min-width: max-content; }
.diff .a { background: rgba(52, 211, 153, .12); color: #a7f3d0; } .diff .d { background: rgba(244, 63, 94, .12); color: #fecdd3; } .diff .f { color: var(--cyan); font-weight: 700; padding-top: 10px; } .diff .hk { color: var(--violet); }
.steps-edit { display: grid; gap: 8px; }
.steps-edit .se { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; }
@media (max-width: 640px) { .steps-edit .se { grid-template-columns: 1fr; } }

/* ---------- agenți ---------- */
.agent { position: relative; overflow: hidden; }
.agent .big { font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: rgba(148, 163, 255, .08); border: 1px solid var(--line2); margin-bottom: 10px; }
.agent.busy .big { box-shadow: 0 0 0 2px var(--cyan), 0 0 26px rgba(34, 211, 238, .45); animation: pulse 1.6s infinite; }

/* ---------- monitor ---------- */
.app-tile { display: grid; gap: 6px; }
.app-tile .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ---------- modal + toasts ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(2, 3, 8, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: rise .15s ease; }
.modal { width: min(460px, 100%); max-height: 90vh; overflow: auto; }
.modal.wide { width: min(900px, 100%); }
#toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: #151a2b; border: 1px solid var(--line2); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); animation: rise .2s ease; cursor: pointer; }
.toast b { display: block; margin-bottom: 2px; }
.toast.bad { border-color: rgba(244, 63, 94, .5); }
.term-in { display: flex; gap: 8px; margin-top: 8px; }
.term-in input { font-family: var(--mono); }
.files { display: grid; grid-template-columns: 300px 1fr; gap: 12px; }
@media (max-width: 900px) { .files { grid-template-columns: 1fr; } }
.tree { font-family: var(--mono); font-size: 12.5px; white-space: pre; overflow: auto; max-height: 60vh; }
.tree a { display: block; color: var(--ink); padding: 1px 4px; border-radius: 4px; }
.tree a:hover { background: rgba(148, 163, 255, .1); }
@media (max-width: 900px) { #toasts { bottom: 84px; } }
