/* RemoteCVPS PWA — mobil-first, dark alapból + light támogatás (Pico-szellemű változókkal) */
:root {
  --bg: #101418; --card: #1a2027; --border: #2a323c;
  --text: #e6ebf0; --muted: #8b98a5;
  --accent: #4c8dff; --ok: #2ea36c; --warn: #c9483c; --attn: #d9a53a;
  --radius: 12px;
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f5f6f8; --card:#ffffff; --border:#dde2e8;
          --text:#1a2027; --muted:#5c6873; }
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, system-ui, sans-serif;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--border);
}
h1 { font-size: 17px; font-weight: 600; flex: 1;
     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#conn { color: var(--warn); font-size: 12px; }
#conn.on { color: var(--ok); }
main { flex: 1; overflow-y: auto; padding: 12px; }

button {
  border: 0; border-radius: var(--radius); padding: 10px 16px;
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
}
button.ghost { background: none; color: var(--text); font-size: 24px; padding: 0 8px; }
button.ok { background: var(--ok); }
button.warn { background: var(--warn); }
button:active { filter: brightness(1.15); }

/* session-lista — a figyelmet kérők felül, hangsúlyosan */
#sessions { list-style: none; display: flex; flex-direction: column; gap: 10px; }
#sessions li {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
}
#sessions li.attn { border-color: var(--attn); }
#sessions li .name { font-weight: 600; }
#sessions li .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge {
  float: right; font-size: 12px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; background: var(--border); color: var(--muted);
}
.badge.needs_permission { background: var(--attn); color: #1a1405; }
.badge.waiting_input { background: var(--accent); color: #fff; }
#empty { color: var(--muted); text-align: center; margin-top: 40px; }

/* beszélgetés-nézet */
#events { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.ev { max-width: 88%; padding: 9px 13px; border-radius: var(--radius);
      white-space: pre-wrap; word-break: break-word; }
.ev.user { align-self: flex-end; background: var(--accent); color: #fff; }
.ev.assistant { align-self: flex-start; background: var(--card);
                border: 1px solid var(--border); white-space: normal; }
.ev.assistant p { margin: 0 0 6px; }
.ev.assistant p:last-child { margin-bottom: 0; }
.ev.assistant ul, .ev.assistant ol { margin: 0 0 6px; padding-left: 20px; }
.ev.assistant pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; overflow-x: auto; margin: 0 0 6px;
  font-size: 12.5px; line-height: 1.4;
}
.ev.assistant code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em;
  background: var(--bg); border-radius: 4px; padding: 1px 4px;
}
.ev.assistant pre code { background: none; padding: 0; }
.ev.tool_use, .ev.raw {
  align-self: flex-start; font-size: 12.5px; color: var(--muted);
  background: none; border: 1px dashed var(--border); padding: 5px 10px;
}
.ev .tool-name { color: var(--text); font-weight: 600; }

#permission-bar {
  position: sticky; bottom: 58px; background: var(--card);
  border: 1px solid var(--attn); border-radius: var(--radius);
  padding: 12px; margin: 8px 0;
}
#permission-msg { font-weight: 600; margin-bottom: 10px; }
.row { display: flex; gap: 10px; }
.row button { flex: 1; }

#input-bar {
  position: sticky; bottom: 0; display: flex; gap: 8px;
  padding: 10px 0 4px; background: var(--bg);
}
#msg {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--text); padding: 10px 13px; font: inherit;
}
#msg:focus { outline: 2px solid var(--accent); border-color: transparent; }
