/* Asystent – panel Smart Bistro.
   Kierunek: tablica dyspozytora tras. Pasek boczny w kolorze asfaltu z białym „pasem ruchu” przy aktywnej pozycji,
   krój DIN z oznakowania dróg (Bahnschrift), akcent: spokojny błękit tablic informacyjnych. Kolor tylko tam, gdzie coś znaczy:
   czerwony = pilne, niebieski = sygnał / nowe.
   Reszta spokojna – liczby w wąskim kroju, listy zamiast stosu kart, przerywana linia jak oś jezdni w planie nocy. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --ink: #1b222b; --muted: #55606c; --faint: #85909c; --line: #d5dbe1;
  --asphalt: #262c34; --asphalt-2: #343b45; --side-ink: #e9edf1; --side-muted: #a7b0ba;
  --accent: #1f5fae; --accent-soft: #e4ecf7; --accent-side: #9fc3ee; --red: #c8161d; --red-soft: #fbe3e3; --blue: #0b4f9c; --blue-soft: #e3edf8;
  --green: #1f7a4d; --green-soft: #e1f1e8; --amber: #8a5a00; --amber-soft: #fdf1cf; --user: #dfe5ec; --code: #eef1f4;
  --f-ui: Bahnschrift, "DIN Alternate", "DIN 2014", "Roboto Condensed", "Arial Narrow", sans-serif;
  --f-text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1f26; --surface: #222831; --ink: #e6eaee; --muted: #a3adb8; --faint: #7a8591; --line: #343c47;
    --asphalt: #12161b; --asphalt-2: #262d36; --side-ink: #e6eaee; --side-muted: #8f99a4;
    --accent: #7fb0f0; --accent-soft: #1c2b3f; --accent-side: #9fc3ee;
    --red: #ff6b5e; --red-soft: #3f2224; --blue: #7fb0f0; --blue-soft: #1c2b3f; --green: #6fcf97; --green-soft: #1b3326;
    --amber: #f0c050; --amber-soft: #3a3120; --user: #2c3440; --code: #1a1f26; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--f-text); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, h4 { font-family: var(--f-ui); font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: #3fae74; } .dot.off { background: var(--red); }

/* ---------- szkielet i pasek boczny (asfalt) ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--asphalt); color: var(--side-ink); display: flex; flex-direction: column; padding: 16px 10px 12px; gap: 2px; overflow: hidden; }
.side-top { padding: 2px 8px 16px; }
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--side-ink); }
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 5px; background: var(--accent); color: #fff;
  font: 700 15px/1 var(--f-ui); font-stretch: condensed; letter-spacing: .02em; }
.mark.big { width: 46px; height: 46px; font-size: 20px; }
.logo-t { display: flex; flex-direction: column; gap: 2px; font: 600 18px/1.1 var(--f-ui); }
.logo-t small { font: 400 13px/1.1 var(--f-ui); color: var(--side-muted); }
.new-chat, .nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 5px; text-decoration: none;
  font: 500 15px/1.2 var(--f-ui); color: var(--side-ink); }
.new-chat { border: 1px solid color-mix(in srgb, var(--side-ink) 25%, transparent); margin-bottom: 12px; }
.new-chat:hover { border-color: var(--side-ink); }
.nav-link { color: var(--side-muted); position: relative; }
.nav-link:hover { color: var(--side-ink); background: var(--asphalt-2); }
.nav-link.on { color: var(--side-ink); background: var(--asphalt-2); }
.nav-link.on::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 2px 2px 0; background: var(--side-ink); }
.side-label { margin: 22px 10px 6px; font: 500 13px/1 var(--f-ui); color: var(--side-muted); }
.chats { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-right: 2px; scrollbar-color: var(--asphalt-2) transparent; }
.chat-item { position: relative; display: flex; align-items: center; border-radius: 5px; flex: none; }
.chat-item:hover, .chat-item.on { background: var(--asphalt-2); }
.chat-link { flex: 1; min-width: 0; display: block; padding: 7px 10px; text-decoration: none; color: var(--side-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-item:hover .chat-link, .chat-item.on .chat-link { color: var(--side-ink); }
.chat-del { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-right: 3px; border: 0; border-radius: 4px;
  background: none; color: var(--side-muted); cursor: pointer; opacity: 0; }
.chat-del svg { width: 15px; height: 15px; }
.chat-item:hover .chat-del, .chat-item.on .chat-del, .chat-del:focus-visible { opacity: 1; }
.chat-del:hover { color: #fff; background: var(--red); }
.chat-item.deleting { opacity: .4; }
@media (hover: none) { .chat-del { opacity: 1; } }
.side-empty { margin: 0 10px; color: var(--side-muted); font-size: 13.5px; }
.agent-st { display: flex; gap: 10px; align-items: flex-start; margin: 10px 4px 6px; padding: 10px 12px; border-radius: 5px;
  background: var(--asphalt-2); font: 14px/1.35 var(--f-ui); color: var(--side-muted); }
.agent-st:empty { display: none; }
.agent-st b { color: var(--side-ink); font-weight: 600; }
.agent-st .dot { margin-top: 5px; }
.agent-st .muted { color: var(--side-muted); }
.pulse { flex: none; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--accent-side);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-side) 60%, transparent); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.side-cost { margin: 0 6px 8px; padding: 0 6px; font: 13px/1.3 var(--f-ui); color: var(--side-muted); }
.side-cost b { color: var(--side-ink); font-weight: 600; }
.logout { padding: 8px 10px 0; border-top: 1px solid var(--asphalt-2); }
.logout button { background: none; border: 0; color: var(--side-muted); cursor: pointer; padding: 6px 0; font-family: var(--f-ui); }
.logout button:hover { color: var(--side-ink); }
.main { overflow-y: auto; min-width: 0; position: relative; }
.main.is-chat { overflow: hidden; display: flex; flex-direction: column; }
.topbar, .scrim { display: none; }

/* ---------- plakietki „nowe” ---------- */
.nb { margin-left: auto; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 4px; background: var(--accent); color: #fff;
  font: 600 13px/21px var(--f-ui); text-align: center; }
.nb.hot { background: var(--red); color: #fff; }
.nb[hidden] { display: none; }
.nowe { display: inline-block; padding: 1px 7px; border-radius: 3px; background: var(--accent-soft); color: var(--accent);
  font: 600 12.5px/1.5 var(--f-ui); margin-right: 8px; }
.row .nowe { order: -1; margin-right: 0; }

/* ---------- pulpit ---------- */
.thread > .hero.dash { max-width: 1060px; margin: 0 auto; padding: 4px 0 32px; }
.dash-head h1 { font: 600 36px/1.1 var(--f-ui); font-stretch: condensed; margin: 0 0 18px; letter-spacing: -.005em; }

/* wiadomość od asystenta – jak dymek w komunikatorze, przed listą spraw */
.msg-from { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 6px; padding: 16px 22px 18px; margin: 0 0 22px; max-width: 820px; }
.msg-from-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.msg-from-h h2 { font: 600 17px/1 var(--f-ui); margin: 0; }
.msg-from-h time { font: 13px/1 var(--f-ui); color: var(--faint); }
.msg-from.unread .msg-from-h h2::after { content: "nowa"; margin-left: 8px; padding: 2px 7px; border-radius: 3px; vertical-align: 1px;
  background: var(--accent); color: #fff; font: 600 12px/1.2 var(--f-ui); }
.mark.sm { width: 26px; height: 26px; font-size: 12px; border-radius: 4px; }
.msg-from-text { font-size: 15px; line-height: 1.6; max-width: 70ch; }
.msg-from-text > :first-child { margin-top: 0; }
.msg-from-text > :last-child { margin-bottom: 0; }
.msg-from-wait { margin: 0; color: var(--muted); }
.msg-from-btn { display: inline-block; margin-top: 14px; padding: 8px 18px; border-radius: 4px; background: var(--accent); color: #fff;
  font: 600 15px/1.2 var(--f-ui); text-decoration: none; }
.msg-from-btn:hover { filter: brightness(1.1); }
.first-note { margin: 0 0 14px; color: var(--muted); font: 500 13.5px/1.3 var(--f-ui); display: flex; align-items: center; gap: 8px; }
.first-note::before { content: ""; width: 18px; border-top: 2px solid var(--accent); }
.chat-item .dot { width: 7px; height: 7px; margin: 0 7px 1px 0; vertical-align: middle; background: var(--accent-side); }
.chat-item.unread .chat-link { color: var(--side-ink); font-weight: 600; }
@media (prefers-color-scheme: dark) { .msg-from-btn { color: #10161d; } }

/* pas spraw do sprawdzenia – jedyny głośny element */
.band { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 0 0 6px 6px;
  padding: 20px 24px 6px; }
.band.calm { padding-bottom: 20px; }
.band-h h2 { font: 700 34px/1.05 var(--f-ui); font-stretch: condensed; margin: 0 0 6px; }
.band-h p { margin: 0 0 14px; max-width: 70ch; font-size: 14.5px; color: var(--muted); }
.band.calm .band-h p { margin: 0; color: var(--muted); }
.band-list { list-style: none; margin: 0; padding: 0; }
.b-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 6px 20px; align-items: start; padding: 14px 0;
  border-top: 1px solid var(--line); }
.b-tag { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; padding-top: 2px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 3px; background: var(--accent-soft); color: var(--accent);
  font: 700 14px/1.2 var(--f-ui); letter-spacing: .01em; }
.b-hi .tag { background: var(--red); color: #fff; }
.b-area { font: 500 13.5px/1.2 var(--f-ui); color: var(--muted); }
.b-body h3 { font: 600 19px/1.25 var(--f-ui); margin: 0 0 4px; }
.b-body p { margin: 0; max-width: 72ch; font-size: 14.5px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.b-when { display: block; margin-top: 6px; font: 13px/1.2 var(--f-ui); color: var(--faint); }
.b-act { display: flex; flex-direction: column; gap: 7px; align-items: stretch; padding-top: 2px; }
.b-btn { display: block; text-align: center; padding: 6px 13px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 600 14px/1.2 var(--f-ui); text-decoration: none; cursor: pointer; white-space: nowrap; }
.b-btn:hover { border-color: var(--ink); }
.b-btn.ask-btn { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.b-btn.ask-btn:hover { border-color: var(--accent); }

/* ostatni dzień w liczbach */
.day { margin-top: 36px; }
.day-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 12px; }
.day-h h2 { font: 600 24px/1.2 var(--f-ui); font-stretch: condensed; margin: 0; }
.day-h p { margin: 0; color: var(--muted); font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 3px solid var(--ink); background: var(--surface);
  border-radius: 0 0 6px 6px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 18px 16px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi-l { font: 500 14px/1.25 var(--f-ui); color: var(--muted); }
.kpi-v { font: 600 34px/1.1 var(--f-ui); font-stretch: condensed; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.kpi-d { font: 600 14px/1 var(--f-ui); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-d.good { color: var(--green); } .kpi-d.bad { color: var(--red); } .kpi-d.flat { color: var(--faint); }
svg.spark { width: 100%; max-width: 110px; height: 28px; margin-left: auto; }
.spark polyline { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.spark circle { fill: var(--accent); stroke: none; }
.day-src { margin: 8px 0 0; color: var(--faint); font: 13px/1.3 var(--f-ui); }

/* nowości + plan pracy agenta */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 32px; margin-top: 36px; align-items: start; }
.dash-cols > :only-child { grid-column: 1 / -1; }
.feed { margin: 0; }
.feed-h h2, .night h2, .ask-h { font: 600 20px/1.2 var(--f-ui); font-stretch: condensed; margin: 0 0 10px; }
.feed-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.feed-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 2px; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line); }
.feed-item:hover b { text-decoration: underline; }
.feed-item b { font: 600 16px/1.3 var(--f-ui); flex: 1 1 60%; }
.feed-k { font: 500 13.5px/1.2 var(--f-ui); color: var(--blue); flex-basis: 100%; }
.feed-t { flex-basis: 100%; color: var(--muted); font-size: 14px; max-width: 72ch; }
.feed-go { flex-basis: 100%; color: var(--blue); font: 600 14px/1.2 var(--f-ui); }
.feed-item.more { color: var(--muted); font: 500 14.5px/1.3 var(--f-ui); }
.feed-empty { color: var(--muted); margin: 0; }
.rate-cta { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding: 12px 16px; border-radius: 5px; background: var(--amber-soft);
  color: var(--ink); text-decoration: none; border-left: 4px solid var(--amber); }
.rate-cta b { font: 600 16px/1.3 var(--f-ui); }
.rate-cta span { color: var(--muted); font-size: 13.5px; }
.jobs { list-style: none; margin: 4px 0 0; padding: 0 0 0 18px; position: relative; }
.jobs::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 0; border-left: 2px dashed var(--faint); }
.jobs li { position: relative; display: grid; grid-template-columns: 86px 1fr; gap: 8px; padding: 5px 0; font: 15px/1.3 var(--f-ui); }
.jobs li::before { content: ""; position: absolute; left: -18px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg);
  border: 2px solid var(--ink); }
.jobs li:first-child::before { background: var(--accent); border-color: var(--accent); }
.jobs time { color: var(--muted); font-variant-numeric: tabular-nums; }
.ask { margin-top: 36px; }
.chips-q { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-q { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 8px 13px; cursor: pointer; color: var(--ink);
  font: 15px/1.3 var(--f-ui); text-align: left; }
.chip-q:hover { border-color: var(--ink); }

/* ---------- czat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; flex: 1; }
.thread { flex: 1; overflow-y: auto; padding: 32px 24px 24px; }
.thread > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.thread.static { padding: 0; overflow: visible; }
.dock { padding: 0 24px 14px; background: linear-gradient(to bottom, transparent, var(--bg) 18px); }
.dock > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 10px 10px 10px 16px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--ink); }
.composer.flash { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; color: var(--ink); font: inherit; line-height: 1.5;
  max-height: 220px; padding: 6px 0; outline: none; }
.composer button { width: 40px; height: 40px; border-radius: 6px; border: 0; background: var(--asphalt); color: #fff;
  display: grid; place-items: center; cursor: pointer; }
.composer button:disabled { opacity: .35; cursor: default; }
.composer button.stop { background: var(--red); color: #fff; }
.hint { text-align: center; color: var(--faint); font: 13px/1.3 var(--f-ui); margin: 8px 0 0; }
.msg-user { display: flex; justify-content: flex-end; margin: 6px 0 22px; }
.msg-user div { background: var(--user); color: var(--ink); padding: 10px 16px; border-radius: 10px 10px 3px 10px;
  max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-agent { margin: 0 0 32px; }
.task { border-left: 4px solid var(--accent); padding: 4px 0 4px 14px; margin: 0 0 18px; }
.task-k { display: block; color: var(--muted); font: 500 13.5px/1.3 var(--f-ui); margin-bottom: 2px; }
.answer { overflow-wrap: anywhere; line-height: 1.6; }
.answer.streaming::after { content: ""; display: inline-block; width: 8px; height: 15px; margin-left: 2px; vertical-align: -2px;
  background: var(--ink); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.answer.streaming:empty { display: none; }
.err-line { color: var(--red); background: var(--red-soft); padding: 8px 12px; border-radius: 5px; font-size: 14px; }
.turn-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font: 13.5px/1.3 var(--f-ui); color: var(--faint); }
.turn-foot b { color: var(--muted); font-weight: 600; }

/* ślad pracy agenta */
.trace { margin: 0 0 14px; }
.trace > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted);
  font: 500 14.5px/1.2 var(--f-ui); padding: 6px 10px 6px 8px; border-radius: 4px; user-select: none; }
.trace > summary::-webkit-details-marker { display: none; }
.trace > summary:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.trace > summary .chev { transition: transform .15s; }
.trace[open] > summary .chev { transform: rotate(90deg); }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tape { margin: 8px 0 0 6px; padding: 4px 0 4px 18px; border-left: 2px dashed var(--faint); font-size: 14px; }
.tape-head { display: flex; justify-content: space-between; gap: 12px; color: var(--faint); font: 13px/1.4 var(--f-ui); padding: 4px 0 8px; }
.think { color: var(--muted); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 0; }
.think.live { max-height: 9.5em; overflow-y: auto; }
.think-k { display: block; color: var(--faint); font: 500 13px/1.3 var(--f-ui); margin-bottom: 2px; }
.item { padding: 8px 0; }
.item-h { display: flex; align-items: baseline; gap: 10px; }
.item-n { font: 600 13px/1 var(--f-ui); color: var(--faint); min-width: 1.6em; font-variant-numeric: tabular-nums; }
.item-l { font: 600 15px/1.3 var(--f-ui); flex: 1; }
.item-s { font: 13px/1 var(--f-ui); color: var(--faint); }
.item-s.run { color: var(--blue); }
.sql { font: 12.5px/1.5 var(--f-mono); background: var(--code); border-radius: 4px; padding: 8px 10px; margin: 6px 0 0 2.4em;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.res { margin: 6px 0 0 2.4em; }
.res > summary { cursor: pointer; color: var(--muted); font: 13.5px/1.3 var(--f-ui); }
.res-t { overflow-x: auto; margin-top: 6px; }
.res pre { font: 12.5px/1.45 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; color: var(--muted); }
.note { margin: 4px 0 0 2.4em; }
.comment { color: var(--muted); font-size: 13.5px; padding: 6px 0; }
table { border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 10px 4px 0; text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-family: var(--f-ui); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- treść markdown ---------- */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h2, .md h3, .md h4, .md h5 { margin: 1.3em 0 .4em; line-height: 1.25; }
.md h2 { font-size: 22px; } .md h3 { font-size: 19px; } .md h4, .md h5 { font-size: 16px; }
.md p { margin: .6em 0; } .md ul, .md ol { padding-left: 1.3em; margin: .5em 0; } .md li { margin: .25em 0; }
.md code { font: 13px var(--f-mono); background: var(--code); padding: 1px 5px; border-radius: 3px; }
.md pre { background: var(--code); padding: 10px 12px; border-radius: 5px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md .tbl { overflow-x: auto; margin: .8em 0; }
.md table { font-size: 14px; } .md th, .md td { white-space: normal; padding: 6px 14px 6px 0; }
.md blockquote { margin: .8em 0; padding-left: 14px; border-left: 4px solid var(--line); color: var(--muted); }
.md strong { font-weight: 650; }

/* ---------- strony: raporty, znaleziska, plan, dziennik ---------- */
.page { max-width: 860px; margin: 0 auto; padding: 40px 28px 64px; }
.page.wide { max-width: 900px; }
.page h1 { font: 600 36px/1.1 var(--f-ui); font-stretch: condensed; margin: 0 0 8px; }
.page h2 { font: 600 22px/1.25 var(--f-ui); font-stretch: condensed; margin: 36px 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 66ch; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font: 500 14.5px/1.2 var(--f-ui); margin-bottom: 18px; }
.back:hover { color: var(--ink); }
.rows { border-top: 3px solid var(--ink); background: var(--surface); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink); }
.row b { font: 600 17px/1.3 var(--f-ui); }
.row:hover b { text-decoration: underline; }
.row span { color: var(--faint); font: 14px/1.3 var(--f-ui); white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; margin: 0 0 12px; }
.card h3 { font: 600 19px/1.3 var(--f-ui); margin: 8px 0 6px; }
.card h3 a { color: var(--ink); text-decoration: none; } .card h3 a:hover { text-decoration: underline; }
.card h4 { margin: 16px 0 4px; font: 600 15px/1.3 var(--f-ui); color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; color: var(--faint); font: 14px/1.3 var(--f-ui); }
.st { margin-left: auto; }
.badge { padding: 2px 8px; border-radius: 3px; font: 600 13.5px/1.35 var(--f-ui); }
.w-hi { color: #fff; background: var(--red); }
.w-mid { color: var(--amber); background: var(--amber-soft); }
.w-lo { color: var(--blue); background: var(--blue-soft); }
.w-off { color: var(--faint); background: var(--code); }
.doc { background: var(--surface); border-top: 3px solid var(--ink); padding: 28px 34px; border-radius: 0 0 6px 6px; }
.doc h1 { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { padding: 6px 13px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--muted);
  background: var(--surface); font: 500 14.5px/1.2 var(--f-ui); }
.chip.on { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.btn { display: inline-block; margin-top: 6px; padding: 9px 14px; border-radius: 4px; background: var(--asphalt); color: var(--side-ink);
  text-decoration: none; font: 600 15px/1.2 var(--f-ui); }
.btn:hover { background: var(--asphalt-2); }
.empty { color: var(--muted); }
.more-link { display: inline-block; margin-top: 6px; font: 600 14.5px/1.2 var(--f-ui); text-decoration: none; }
.rating { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 20px 16px; margin: 0 0 14px; }
.rating h4 { margin: 0 0 2px; font-size: 16px; }
.rating p { margin: 0 0 10px; }
.rating textarea { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink);
  font: inherit; padding: 8px 10px; resize: vertical; }
.rate-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rate { border: 1.5px solid var(--line); background: var(--bg); border-radius: 4px; padding: 7px 14px; cursor: pointer; font: 600 15px/1.2 var(--f-ui); }
.rate:hover { border-color: var(--ink); }
.rate.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.notes { list-style: none; padding: 0; margin: 0; border-left: 2px dashed var(--faint); }
.notes li { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; padding: 8px 0 8px 16px; position: relative; }
.notes li::before { content: ""; position: absolute; left: -7px; top: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--faint); }
.n-k { font: 600 15px/1.3 var(--f-ui); } .n-h { color: var(--faint); font: 13.5px/1.3 var(--f-ui); }
.n-wynik::before, .n-wniosek::before { border-color: var(--accent) !important; background: var(--accent) !important; }
.n-odrzucone .n-k, .n-odrzucone .n-t { color: var(--faint); }

/* ---------- logowanie ---------- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: var(--asphalt); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 6px; padding: 30px; border-top: 4px solid var(--accent); }
.login-card h1 { font: 600 28px/1.15 var(--f-ui); font-stretch: condensed; margin: 16px 0 2px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card label { display: block; font: 500 15px/1.2 var(--f-ui); }
.login-card input { display: block; width: 100%; margin: 6px 0 16px; padding: 11px 12px; font: inherit; border: 1.5px solid var(--line);
  border-radius: 4px; background: var(--bg); color: var(--ink); }
.login-card input:focus { border-color: var(--ink); outline: none; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 4px; background: var(--asphalt); color: #fff;
  font: 600 16px/1.2 var(--f-ui); cursor: pointer; }
.err { color: var(--red) !important; }

/* ---------- węższe ekrany i telefon ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 10; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--asphalt); color: var(--side-ink);
    font: 600 16px/1.2 var(--f-ui); position: sticky; top: 0; z-index: 5; }
  .topbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .icon-btn { border: 0; background: none; padding: 6px; cursor: pointer; display: grid; place-items: center; color: var(--side-ink); }
  .thread { padding: 20px 16px; }
  .dock { padding: 0 12px 10px; }
  .dash-head h1 { font-size: 28px; }
  .band { padding: 18px 16px 4px; }
  .band-h h2 { font-size: 28px; }
  .b-row { grid-template-columns: 1fr; gap: 8px; }
  .b-tag { flex-direction: row; align-items: center; gap: 10px; }
  .b-act { flex-direction: row; flex-wrap: wrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi-v { font-size: 28px; }
  .page { padding: 24px 16px 48px; }
  .doc { padding: 20px 18px; }
  .notes li { grid-template-columns: 1fr; gap: 2px; }
  .sql, .res, .note { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.login-card label.remember { display: flex; align-items: center; gap: 9px; margin: -4px 0 18px; font: 400 14.5px/1.3 var(--f-ui); color: var(--muted); cursor: pointer; }
.login-card label.remember input { display: inline-block; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--accent); }

/* ---------- szybka ocena znalezisk pod wiadomością asystenta ---------- */
.qr { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.qr h3 { font: 600 15px/1.3 var(--f-ui); margin: 0 0 8px; }
.qr ul { list-style: none; margin: 0; padding: 0; }
.qr li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 7px 0;
  border-top: 1px dashed var(--line); scroll-margin-top: 80px; }
.qr li:first-child { border-top: 0; }
.qr li > a { color: var(--ink); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.qr li > a:hover { text-decoration: underline; }
.qr-f { display: flex; gap: 5px; }
.qr-b { border: 1.5px solid var(--line); background: var(--surface); border-radius: 4px; padding: 4px 10px; cursor: pointer;
  font: 600 13px/1.2 var(--f-ui); white-space: nowrap; }
.qr-b:hover { border-color: var(--ink); }
.qr-b.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.qr-hint { margin: 8px 0 0; color: var(--faint); font-size: 12.5px; }

/* ---------- wiedza o firmie ---------- */
.flash { padding: 10px 14px; border-radius: 5px; margin: 0 0 16px; font: 500 14.5px/1.4 var(--f-ui); }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }
.k-add textarea, .k-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink);
  padding: 8px 10px; font: 14.5px/1.5 var(--f-text); resize: vertical; }
.k-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.k-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.k-text { line-height: 1.55; overflow-wrap: anywhere; }
.k-edit summary { display: inline-block; margin-top: 4px; color: var(--blue); cursor: pointer; font: 500 13.5px/1.3 var(--f-ui); list-style: none; }
.k-edit summary::-webkit-details-marker { display: none; }
.k-edit[open] summary { color: var(--muted); }
.k-form { margin-top: 8px; }
.k-row { display: flex; gap: 8px; margin-top: 6px; }
.k-del { border: 0; background: none; color: var(--red); cursor: pointer; padding: 4px 0; font: 500 13.5px/1.3 var(--f-ui); }
.k-del:hover { text-decoration: underline; }
@media (max-width: 860px) {
  .qr li { grid-template-columns: auto minmax(0, 1fr); }
  .qr-f { grid-column: 1 / -1; flex-wrap: wrap; }
}

/* ======================================================================================================
   Asystent szefa (11.2026): ekran główny = jedna rozmowa, sprawy, zaplecze w menu, widok techniczny.
   ====================================================================================================== */
.side-fill { flex: 1; min-height: 12px; }
.main-nav .nav-link { font-size: 16px; padding: 10px 10px; }
.back-nav .nav-link { font-size: 14px; padding: 6px 10px; }
.side-btn { margin: 0 4px 6px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--side-ink) 25%, transparent); border-radius: 5px;
  background: none; color: var(--side-ink); font: 500 14px/1.3 var(--f-ui); text-align: left; cursor: pointer; }
.side-btn:hover { border-color: var(--side-ink); }
.side-btn.on { border-color: transparent; background: var(--asphalt-2); color: var(--side-muted); }
.side-btn span { color: var(--accent-side); margin-left: 6px; }
.side-toggle { display: flex; align-items: center; gap: 8px; margin: 2px 10px 8px; font: 13px/1.2 var(--f-ui); color: var(--side-muted); cursor: pointer; }
.side-toggle input { accent-color: var(--accent-side); margin: 0; }

/* widok techniczny: zapytania, wyniki, rozumowanie i koszt widzi tylko ten, kto go włączy */
body:not(.admin) .admin-only, body:not(.admin) .trace .sql, body:not(.admin) .trace .res, body:not(.admin) .trace .think,
body:not(.admin) .trace .comment, body:not(.admin) .trace .tape-head, body:not(.admin) .turn-foot { display: none; }
body:not(.admin) .trace .tape { font-size: 13.5px; }

/* nagłówek rozmowy */
.convo-head { padding: 0 0 6px; }
.convo-head h1 { font: 600 30px/1.1 var(--f-ui); font-stretch: condensed; margin: 0 0 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font: 500 14px/1.25 var(--f-ui); }
.pill:hover { border-color: var(--ink); }
.pill.hot { background: var(--red-soft); border-color: transparent; color: var(--red); }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 26px auto 18px; color: var(--faint); font: 500 13.5px/1 var(--f-ui); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.day-sep span::first-letter { text-transform: uppercase; }
.convo-empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 18px 22px; color: var(--muted); }
.convo-empty p { margin: .3em 0; max-width: 62ch; }
.convo-empty b { color: var(--ink); font-family: var(--f-ui); font-size: 16px; }
.first-note.alarm { color: var(--red); }
.first-note.alarm::before { border-color: var(--red); }

/* wiadomość asystenta: dymek z częścią „na głos”, szczegóły pod przyciskiem, szybkie odpowiedzi */
.bubble-text { background: var(--surface); border: 1px solid var(--line); border-radius: 3px 12px 12px 12px; padding: 13px 18px 14px; max-width: 92%; }
.bubble-text .say { font-size: 16px; line-height: 1.55; }
.more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.more > summary { cursor: pointer; color: var(--blue); font: 600 14px/1.3 var(--f-ui); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "▾"; font-size: 12px; transition: transform .15s; }
.more[open] > summary::after { transform: rotate(180deg); }
.more > .md { margin-top: 8px; font-size: 15px; }
.qa { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qa.old { display: none; }
.qa-b { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 7px 15px;
  cursor: pointer; font: 600 14.5px/1.2 var(--f-ui); }
.qa-b:hover { background: var(--accent); color: #fff; }
.msg-agent .trace { margin: 0 0 8px; }
.msg-agent .trace > summary { font-size: 13.5px; padding: 3px 8px 3px 6px; }
.rate-box { margin: -18px 0 28px; max-width: 92%; background: var(--amber-soft); border-radius: 8px; padding: 10px 16px; }
.rate-box > summary { cursor: pointer; font: 600 14.5px/1.3 var(--f-ui); color: var(--amber); }
.rate-box ul { list-style: none; margin: 8px 0 0; padding: 0; }
.rate-box li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 7px 0;
  border-top: 1px dashed color-mix(in srgb, var(--amber) 30%, transparent); }
.rate-box li > a { color: var(--ink); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
@media (prefers-color-scheme: dark) { .qa-b:hover { color: #10161d; } }

/* sprawy */
.case .meta { gap: 6px 12px; }
.case-zl { font: 600 14.5px/1.3 var(--f-ui); color: var(--ink); }
.case-due { padding: 1px 8px; border-radius: 3px; background: var(--code); color: var(--muted); font: 600 13px/1.4 var(--f-ui); }
.case-due.now { background: var(--red-soft); color: var(--red); }
.case-log { margin-top: 10px; }
.case-log > summary { cursor: pointer; color: var(--muted); font: 500 14px/1.3 var(--f-ui); }
.case-log ol { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px dashed var(--line); }
.case-log li { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; padding: 5px 0; font-size: 14px; }
.case-log .who { font: 600 13.5px/1.4 var(--f-ui); color: var(--muted); }
.case-log .who.boss { color: var(--accent); }
.case-log time { color: var(--faint); font: 13px/1.4 var(--f-ui); white-space: nowrap; }
.rate.ghost { background: none; border-color: transparent; color: var(--blue); text-decoration: none; }
.rate.ghost:hover { border-color: var(--blue); }

/* starsze rozmowy (lista na stronie, nie w ciemnym pasku) */
.page .chats { display: block; }
.page .chat-item { border-bottom: 1px solid var(--line); border-radius: 0; }
.page .chat-item:hover { background: var(--accent-soft); }
.page .chat-link { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; color: var(--ink); white-space: normal; }
.page .chat-link b { font: 600 16px/1.3 var(--f-ui); }
.page .chat-link span { color: var(--faint); font: 14px/1.3 var(--f-ui); white-space: nowrap; }
.page .chat-del { opacity: 1; color: var(--faint); }

@media (max-width: 860px) {
  .convo-head h1 { font-size: 24px; }
  .bubble-text, .rate-box { max-width: 100%; }
  .case-log li { grid-template-columns: 1fr; gap: 0; }
  .rate-box li { grid-template-columns: auto minmax(0, 1fr); }
  .rate-box .qr-f { grid-column: 1 / -1; flex-wrap: wrap; }
  .dock { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* nowe wątki */
.convo-head { position: relative; }
.new-thread { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border: 1px solid var(--line, #d9dcd3); border-radius: 18px; font-size: 14px; color: inherit; text-decoration: none; }
.new-thread:hover { background: rgba(0,0,0,.05); }
.new-thread svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head .btn { margin-top: 0; }
@media (max-width: 760px) { .new-thread span { display: none; } .new-thread { padding: 7px 9px; } }
