/* Centrum — jeden arkusz. Telefon (390×844) jest bazą; od 900 px układ komputerowy (szyna + kolumny). */
:root {
  --bg: #0f1420;
  --bg-2: #131a28;
  --surface: #171e2c;
  --surface-2: #212a3b;
  --line: #2a3448;
  --text: #e9edf4;
  --muted: #95a1b6;
  --accent: #f2b33d;     /* Karinka / akcja główna */
  --on-accent: #1b1300;
  --accent-ink: #f2b33d;  /* złoty jako kolor tekstu (w jasnym motywie ciemniejszy, kontrast ≥ 4.5:1) */
  --listen: #6fb8ff;     /* słucha */
  --think: #c9a2ff;      /* myśli */
  --ok: #5fd39c;
  --bad: #ff6b5e;
  --work: #f2b33d;       /* agent pracuje */
  --wait: #6fb8ff;       /* agent czeka na Tomka */
  --done: #657087;
  --shadow: 0 10px 30px rgb(0 0 0 / .35);
  --r-s: 12px;
  --r-m: 16px;
  --r-l: 24px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 56px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6fa; --bg-2: #eceff5; --surface: #ffffff; --surface-2: #eef1f6; --line: #d9dfea;
  --text: #121a2b; --muted: #5a667d; --accent: #e9a21c; --on-accent: #1b1300; --accent-ink: #8a5a00; --listen: #1f7ccc; --think: #7b4fd6;
  --ok: #1d9b62; --bad: #d8402f; --work: #c98a12; --wait: #1f7ccc; --done: #9aa3b2; --shadow: 0 10px 30px rgb(20 30 60 / .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fa; --bg-2: #eceff5; --surface: #ffffff; --surface-2: #eef1f6; --line: #d9dfea;
    --text: #121a2b; --muted: #5a667d; --accent: #e9a21c; --on-accent: #1b1300; --accent-ink: #8a5a00; --listen: #1f7ccc; --think: #7b4fd6;
    --ok: #1d9b62; --bad: #d8402f; --work: #c98a12; --wait: #1f7ccc; --done: #9aa3b2; --shadow: 0 10px 30px rgb(20 30 60 / .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { font: 100%/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
/* Dynamic Type: na iOS baza bierze rozmiar z ustawień systemu; wszystko niżej w rem. */
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--listen); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-weight: 450; }

/* ── logowanie ── */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px 16px; text-align: center; overflow: auto; }
.gate-inner { max-width: 340px; width: 100%; }
.mark { width: 64px; height: 64px; color: var(--accent); margin-bottom: 18px; }
.gate h1 { font-size: 1.9rem; margin-bottom: 8px; }
.gate p { color: var(--muted); }
.err { color: var(--bad) !important; min-height: 1.4em; }
.btn-primary { margin-top: 18px; width: 100%; min-height: 52px; padding: 14px 18px; border: 0; border-radius: var(--r-m);
  background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 1.05rem; }

/* ── rama aplikacji ── */
.app { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "off" "view" "nav"; }
.offline { grid-area: off; margin: 0; padding: calc(var(--safe-t) + 6px) 16px 6px; font-size: .8rem; text-align: center;
  background: color-mix(in srgb, var(--bad) 18%, var(--bg)); color: var(--text); }
.offline:not([hidden]) ~ .view { padding-top: 0; }
.view { grid-area: view; min-height: 0; position: relative; }
.pane-scroll { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.view.pane-scroll { padding: calc(var(--safe-t) + 12px) 16px 24px; }
.view-head { margin-bottom: 14px; }
.view-head h1 { font-size: 1.6rem; display: flex; align-items: baseline; gap: 10px; }
.view-head p { margin: 4px 0 0; font-size: .85rem; }
.h-sec { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }

/* nawigacja: telefon = pasek zakładek */
.nav { grid-area: nav; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); z-index: 5; }
.nav-logo { display: none; }
.nav button { position: relative; min-height: var(--nav-h); background: none; border: 0; padding: 6px 0 4px; font-size: .68rem; font-weight: 550;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.nav svg { width: 26px; height: 26px; }
.nav button[aria-current="page"] { color: var(--accent); }
.badge { position: absolute; top: 4px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .65rem; line-height: 18px; font-weight: 700; font-style: normal; }
.badge.calm { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); line-height: 16px; }
.badge-dot { position: absolute; top: 8px; left: calc(50% + 9px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }

/* ── Karinka: scena z awatarem ── */
.view-home { display: grid; grid-template-columns: minmax(0, 1fr); }
.side-col { display: none; }
.talk-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.stage { --lvl: 0; --tint: var(--accent); position: relative; flex: none; height: clamp(220px, 35dvh, 350px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: calc(var(--safe-t) + 36px) 16px 6px;
  background: radial-gradient(110% 85% at 50% 38%, color-mix(in srgb, var(--tint) 14%, var(--surface-2)), var(--bg) 72%);
  transition: height .28s ease, padding .28s ease; }
.stage[data-state="listen"] { --tint: var(--listen); }
.stage[data-state="think"] { --tint: var(--think); }
.stage-top { position: absolute; top: calc(var(--safe-t) + 8px); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--muted); }
.hello { font-weight: 600; color: var(--text); }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.conn.off i { background: var(--bad); }
.avatar-wrap { position: relative; flex: 1; min-height: 0; aspect-ratio: 780 / 900; max-width: 80%; padding: 0; border: 0; background: none;
  display: grid; place-items: end center; touch-action: manipulation; }
.avatar { position: relative; width: 100%; height: 100%; display: block; overflow: hidden;
  border-radius: 50% 50% 22px 22px / 42% 42% 22px 22px; }
.avatar > svg { width: 100%; height: 100%; display: block; }
.avatar canvas { width: 100% !important; height: 100% !important; object-fit: contain; }
/* pierścień stanu za postacią: kolor = stan, jasność i skala = głośność (ruch + kolor + tekst, nie samo jedno) */
.halo { position: absolute; inset: 6% 2% 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 50%, transparent) 30%, color-mix(in srgb, var(--tint) 18%, transparent) 70%, transparent 100%);
  opacity: calc(.3 + var(--lvl) * .7); transform: scale(calc(.94 + var(--lvl) * .14)); transition: background .4s ease; filter: blur(18px); }
.stage[data-state="listen"] .halo { animation: breathe 2.2s ease-in-out infinite; }
.stage[data-state="think"] .halo { animation: shimmer 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .75; transform: scale(1.03); } }
@keyframes shimmer { 50% { opacity: .55; transform: scale(.97) rotate(8deg); } }
.avatar-state { margin: 6px 0 0; font-size: .85rem; font-weight: 600; color: var(--tint); min-height: 1.3em; text-align: center; }
.stage[data-state="idle"] .avatar-state { color: var(--muted); font-weight: 500; }
.caption { margin: 2px 0 0; max-width: 34ch; font-size: .82rem; color: var(--muted); text-align: center; min-height: 1.2em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Kompakt: przy pisaniu (klawiatura) Karinka zwija się do paska, rozmowa dostaje ekran — jak Siri, nie zasłania treści. */
.stage.compact { height: calc(var(--safe-t) + 76px); flex-direction: row; justify-content: flex-start; gap: 12px; padding: calc(var(--safe-t) + 8px) 16px 8px; }
.stage.compact .stage-top { display: none; }
.stage.compact .avatar-wrap { flex: none; width: 58px; height: 58px; max-width: none; aspect-ratio: 1; }
.stage.compact .avatar { border-radius: 50%; }
.stage.compact .avatar-state { margin: 0; text-align: left; }
.stage.compact .caption { display: none; }

/* przełącznik Uwaga / Rozmowa (tylko telefon) */
.seg { flex: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin: 8px 16px 6px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { min-height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: .9rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
.seg-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; line-height: 20px; }
.panel { position: relative; flex: 1; min-height: 0; }
.panel > .pane-scroll { position: absolute; inset: 0; padding: 6px 16px 12px; }

/* ── Co wymaga mojej uwagi ── */
.att-list { display: flex; flex-direction: column; gap: 8px; }
.att { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 12px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; }
button.att { cursor: pointer; }
.att.urgent { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
.att.alert { border-color: color-mix(in srgb, var(--bad) 65%, var(--line)); }
.att-ic { grid-row: span 2; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.att-ic svg { width: 20px; height: 20px; }
.att.urgent .att-ic { background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); color: var(--accent); }
.att.alert .att-ic { background: color-mix(in srgb, var(--bad) 18%, var(--surface-2)); color: var(--bad); }
.att-t { font-weight: 600; font-size: .95rem; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.att-t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-when { margin-left: auto; flex: none; font-size: .72rem; font-weight: 500; color: var(--muted); }
.att-s { font-size: .85rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.att-s code, .prev { font: .78rem/1.35 ui-monospace, "SF Mono", Menlo, monospace; }
.att-acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--line); border-radius: var(--r-m); }
.att-more { font-size: .82rem; color: var(--muted); text-align: center; padding: 4px; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qa { min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; font-weight: 550;
  display: inline-flex; align-items: center; gap: 8px; }
.qa svg { width: 18px; height: 18px; color: var(--accent); }
.att-mobile .h-sec { margin-top: 18px; }
.att-mobile .h-sec:first-child { margin-top: 4px; }

/* ── rozmowa ── */
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat > :first-child { margin-top: auto; }
.hint { color: var(--muted); font-size: .9rem; margin: 0; text-align: center; padding: 0 8px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; font-size: .97rem; }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); border-bottom-right-radius: 6px; }
.msg.me.partial { opacity: .65; font-style: italic; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.err { border-color: var(--bad); }
.msg.pending { border-color: var(--accent); }
.msg .typing { display: inline-flex; gap: 4px; }
.msg .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; }
.msg .typing i:nth-child(2) { animation-delay: .15s; } .msg .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { opacity: .25; transform: translateY(-2px); } }
.tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tool { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

/* ── pole i mikrofon (strefa kciuka) ── */
.composer { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px; border-top: 1px solid var(--line); background: var(--bg); }
.field { flex: 1; min-width: 0; }
.field input { width: 100%; min-height: 44px; font-size: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 10px 16px; }
.icon-btn { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed="true"] { color: var(--listen); }
.icon-btn[aria-pressed="true"] .slash, .icon-btn[aria-pressed="false"] .waves { display: none; }
.send-btn { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.mic { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; box-shadow: var(--shadow); }
.mic svg { width: 26px; height: 26px; grid-area: 1 / 1; }
.mic .i-stop { display: none; }
.mic.on { background: var(--listen); color: #fff; }
.mic.on .i-mic { display: none; } .mic.on .i-stop { display: block; }
.mic.ptt { background: var(--bad); color: #fff; transform: scale(1.08); }
.mic-ring { position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--listen); opacity: 0; pointer-events: none;
  transform: scale(calc(1 + var(--lvl, 0) * .25)); }
.mic.on .mic-ring, .mic.ptt .mic-ring { opacity: .7; }
.mic-hint { flex: none; margin: 0; padding: 0 16px 6px; min-height: 1.1em; font-size: .75rem; color: var(--muted); text-align: center; background: var(--bg); }

/* ── agenci ── */
.view-agents { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-col { display: flex; flex-direction: column; min-height: 0; padding-top: calc(var(--safe-t) + 12px); }
.list-col .view-head { padding: 0 16px; margin-bottom: 8px; }
.detail-col { display: none; }
.filters { display: flex; gap: 6px; margin: 10px 0 8px; overflow-x: auto; scrollbar-width: none; }
.fchip { flex: none; min-height: 36px; padding: 6px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 600; }
.fchip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search input { width: 100%; min-height: 40px; font-size: 16px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.agents { flex: 1; min-height: 0; padding: 4px 16px 20px; }
.group-label { font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; display: flex; gap: 8px; align-items: center; }
.group-label.off { color: var(--bad); }
.agent { width: 100%; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 11px 12px; margin-bottom: 8px; min-height: 60px; }
.agent[aria-current="true"] { border-color: var(--accent); }
.agent .dot { grid-row: span 2; align-self: start; margin-top: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--done); }
.dot.working { background: var(--work); animation: pulse 1.6s infinite; }
.dot.waiting { background: var(--wait); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--work) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.agent-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.agent-state { font-size: .75rem; font-weight: 600; color: var(--muted); justify-self: end; }
.agent-state.working { color: var(--work); } .agent-state.waiting { color: var(--wait); }
.agent-meta { grid-column: 2 / 4; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prev { grid-column: 2 / 4; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--bg-2); color: var(--muted);
  white-space: pre-wrap; overflow: hidden; display: block; max-height: calc(2 * 1.35em + 12px); word-break: break-word; }
.gd { font-size: .65rem; font-weight: 700; color: var(--bad); border: 1px solid currentColor; border-radius: 6px; padding: 0 5px; margin-left: 6px; vertical-align: 2px; }

/* szczegóły agenta (arkusz na telefonie, kolumna na komputerze) */
.ad { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.ad-head { display: flex; align-items: center; gap: 10px; }
.ad-head h2 { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.screen { font: .75rem/1.38 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-word; margin: 0;
  background: #0b0f17; color: #d7dde8; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px; height: 44dvh; overflow: auto; }
.keys { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.keys .btn { flex: none; min-width: 48px; }
.send { display: flex; gap: 8px; align-items: flex-end; }
.send textarea { flex: 1; min-height: 48px; max-height: 30dvh; font-size: 16px; resize: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { min-height: 44px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-s); padding: 9px 14px; font-size: .92rem; font-weight: 550; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn.warn { color: var(--bad); }
.btn.go { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 650; }
.btn:disabled { opacity: .55; }
.ghost { min-height: 44px; border: 0; background: none; color: var(--listen); font-weight: 600; padding: 0 4px; }
.kv { margin: 0 0 12px; white-space: pre-wrap; color: var(--muted); font-size: .88rem; }
.md { font-size: .9rem; white-space: pre-wrap; }

/* ── dom ── */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.alert { border-color: var(--bad); }
.card-h { display: flex; align-items: center; gap: 12px; }
.card-h .att-ic { grid-row: auto; }
.card-h h2 { font-size: 1.05rem; }
.card-v { font-size: .9rem; color: var(--muted); }
.card-more { margin-left: auto; }

/* ── ustawienia ── */
.group { margin-bottom: 22px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-btn { min-height: 48px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; font-size: .95rem; }
.row-btn.warn { color: var(--bad); }
.row-set { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 10px 14px; margin-bottom: 8px; font-size: .95rem; }
.row-set small { display: block; color: var(--muted); font-size: .78rem; }
.row-set input { width: 44px; height: 26px; flex: none; accent-color: var(--accent); }
.row-info { font-size: .82rem; color: var(--muted); margin: 4px 2px 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.segmented button { min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
.integ { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 10px 12px; min-height: 56px; }
.integ small { display: block; color: var(--muted); font-size: .78rem; }

/* ── arkusz (bottom sheet) ── */
.sheet { width: 100%; max-width: 720px; margin: auto auto 0; border: 0; padding: 0; background: var(--surface); color: var(--text);
  border-radius: var(--r-l) var(--r-l) 0 0; max-height: 92dvh; box-shadow: var(--shadow); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 16px 6px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head h3 { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sheet-body { padding: 4px 16px calc(20px + var(--safe-b)); }

/* ── komunikaty ── */
.toasts { position: fixed; left: 50%; bottom: calc(var(--safe-b) + var(--nav-h) + 90px); transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: .9rem; font-weight: 550; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── komputer: szyna po lewej, Karinka + rozmowa w środku, „Uwaga” po prawej ── */
@media (min-width: 900px) {
  .app { grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "nav off" "nav view"; }
  .nav { grid-template-columns: none; grid-auto-rows: min-content; align-content: start; gap: 6px; padding: 18px 8px; border-top: 0; border-right: 1px solid var(--line); }
  .nav-logo { display: grid; place-items: center; color: var(--accent); margin-bottom: 14px; }
  .nav-logo svg { width: 34px; height: 34px; }
  .nav button { border-radius: 14px; min-height: 64px; font-size: .72rem; }
  .nav button[aria-current="page"] { background: var(--surface-2); }
  .view-home { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
  .side-col { display: flex; flex-direction: column; gap: 22px; padding: 22px 20px; border-left: 1px solid var(--line); overflow-y: auto; background: var(--bg-2); }
  .seg { display: none; }
  .seg.seg-2 { display: grid; margin: 0 0 6px; }
  #att-pane { display: none !important; }
  #chat[hidden] { display: flex !important; }
  .stage { height: clamp(260px, 42dvh, 420px); padding-top: 44px; }
  .stage-top { top: 12px; left: 24px; right: 24px; font-size: .85rem; }
  .panel > .pane-scroll { padding: 12px max(24px, calc((100% - 760px) / 2)); }
  .composer { padding: 12px max(24px, calc((100% - 760px) / 2)) 6px; }
  .view-agents { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
  .list-col { border-right: 1px solid var(--line); padding-top: 22px; }
  .detail-col { display: flex; flex-direction: column; min-height: 0; padding: 22px 24px; }
  .detail-col .screen { flex: 1; height: auto; min-height: 200px; }
  .detail-col .ad { flex: 1; }
  .empty-detail { margin: auto; color: var(--muted); max-width: 32ch; text-align: center; }
  .view.pane-scroll { padding: 26px 32px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .view-more > * { max-width: 640px; }
  .toasts { bottom: 40px; }
  .sheet { margin: auto; border-radius: var(--r-l); max-height: 84dvh; }
  .grabber { display: none; }
}

/* linki wyglądające jak przyciski (OAuth to pełna strona, więc <a>, nie <button>) */
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
a.btn.go { color: var(--on-accent); }

/* przełącznik: ten sam wygląd w Safari (input switch) i w Chrome na komputerze */
.row-set input[type="checkbox"] { appearance: none; -webkit-appearance: none; position: relative; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; background: var(--line); transition: background .2s ease; cursor: pointer; }
.row-set input[type="checkbox"]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .25); transition: transform .2s ease; }
.row-set input[type="checkbox"]:checked { background: var(--ok); }
.row-set input[type="checkbox"]:checked::before { transform: translateX(20px); }

.msg code { font: .85em ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* złoty tekst i ikony: wariant „ink” (w jasnym motywie ciemniejszy) */
.nav button[aria-current="page"], .att.urgent .att-ic, .qa svg, .nav-logo, .mark { color: var(--accent-ink); }
.stage[data-state="speak"] .avatar-state, .stage[data-state="idle"] .avatar-state { color: var(--muted); }
.stage[data-state="speak"] .avatar-state { color: var(--accent-ink); }
:root[data-theme="light"] .stage[data-state="listen"] .avatar-state { color: var(--listen); }
.avatar-photo { width: 100%; height: 100%; display: block; object-fit: contain; transition: transform .08s linear; transform-origin: 50% 70%; }
.avatar .persona-box { position: absolute; inset: 0; }
.stage.compact .avatar-photo { object-fit: cover; object-position: 50% 25%; }

/* ── agenci: czytelna lista (23.11) ── */
.agent { gap: 4px 12px; padding: 14px 14px; }
.agent-title { font-size: 1.05rem; display: flex; align-items: baseline; gap: 8px; }
.agent-proj { font-size: .8rem; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.agent-state { font-size: .82rem; white-space: nowrap; }
.agent-desc { grid-column: 2 / 4; font-size: .92rem; line-height: 1.4; color: var(--text); opacity: .85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.agent.asks { border-color: var(--wait); }
.agent.asks .agent-desc { opacity: 1; font-weight: 550; }
.agent-opts { grid-column: 2 / 4; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.agent .dot { grid-row: span 3; }

/* szczegóły agenta */
.ad-sub { margin: -4px 0 0; font-size: .85rem; color: var(--muted); }
.ad-ask { background: color-mix(in srgb, var(--wait) 14%, var(--surface)); border: 1px solid var(--wait); border-radius: var(--r-m); padding: 12px 14px; }
.ad-ask p { margin: 0 0 8px; font-weight: 600; line-height: 1.4; }
.ad-ask .row { flex-wrap: wrap; }
.ad-answer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; max-height: 40dvh; overflow-y: auto; }
.ad-answer h3 { font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.ad-answer-t { font-size: 1rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ad-term summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--muted); }
.ad-raw { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); margin: 0 0 6px; }
.ad-term .screen { font-size: .8rem; line-height: 1.45; height: auto; max-height: 50dvh; overflow-x: hidden; }

/* klawiatura iOS: wysokość aplikacji = widoczna część ekranu (visualViewport), bez przesuwania dokumentu */
html, body { overscroll-behavior: none; }
/* tylko przy otwartej klawiaturze — bez klawiatury iOS (PWA) podaje wysokość bez paska home, co dawało ~2 cm przerwy pod nawigacją */
.app.kb { bottom: auto; height: var(--app-h, 100dvh); }
.app.kb .nav { display: none; }
.stage { transition: none; }

/* ── zlecenia ── */
.tasks { padding: 4px 16px 20px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 10px; }
.task.waiting { border-color: var(--wait); }
.task.bad { border-color: var(--bad); }
.task-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; }
.task-h strong { font-size: 1rem; line-height: 1.35; font-weight: 600; }
.task-nr { min-width: 26px; height: 26px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; }
.task-st { font-size: .8rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.task-st.working { color: var(--work); } .task-st.waiting { color: var(--wait); } .task-st.ok { color: var(--ok, #2f9e64); } .task-st.bad { color: var(--bad); }
.task-time { margin: 4px 0 0 36px; font-size: .8rem; color: var(--muted); }
.task-res { margin: 6px 0 0 36px; font-size: .92rem; line-height: 1.4; }
.task-q { margin: 8px 0 0 36px; }
.task-q p { margin: 0 0 8px; font-weight: 550; line-height: 1.4; }
.task-q .row { flex-wrap: wrap; }
.task-push { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-m); padding: 10px 12px; margin: 4px 0 12px; font-size: .9rem; }

/* ── tryb samochodowy: wszystko duże, jeden kciuk, bez patrzenia ── */
.car { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 18px;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); background: #0d1117; color: #f3f5f8; text-align: center; --c: #8a93a3; }
.car[data-state="listen"] { --c: #3ea0ff; } .car[data-state="think"] { --c: #a77bff; } .car[data-state="speak"] { --c: #f2b33d; }
.car-state { margin: 0 0 auto; padding-top: 8vh; font-size: clamp(2.6rem, 13vw, 4.2rem); font-weight: 800; line-height: 1.05; color: var(--c); }
.car-text { margin: 0; font-size: 1.35rem; line-height: 1.4; max-height: 30vh; overflow: hidden; color: #d5dae3; max-width: 34ch; }
.car-mic { width: min(150px, 40vw); height: min(150px, 40vw); flex: none; border-radius: 50%; border: 0; background: var(--c); color: #0d1117;
  display: grid; place-items: center; box-shadow: 0 0 0 calc(10px + var(--lvl, 0) * 26px) color-mix(in srgb, var(--c) 28%, transparent); transition: background .2s, box-shadow .08s; touch-action: manipulation; }
.car-mic svg { width: 46%; height: 46%; }
.car[data-state="think"] .car-mic { animation: pulse 1.6s infinite; }
.car-hint { margin: 0; font-size: 1rem; color: #9aa3b2; max-width: 30ch; }
.car-end { width: 100%; max-width: 420px; min-height: 64px; border-radius: 18px; border: 2px solid #e2553f; background: none; color: #ff7a66; font-size: 1.3rem; font-weight: 700; }
.car-open { margin-left: auto; margin-right: 10px; min-height: 32px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: .85rem; }

/* ── telefon: trzy przyciski — klawiatura | duży mikrofon | dźwięk; pole tekstowe dopiero po stuknięciu klawiatury (zlecenie 15) ── */
.kbd-btn { display: none; }
@media (max-width: 899px) {
  .composer { justify-content: space-between; padding: 8px 20px 4px; gap: 10px; }
  .composer .kbd-btn { display: grid; width: 56px; height: 56px; }
  .composer .kbd-btn svg { width: 26px; height: 26px; }
  .composer #speak-toggle { width: 56px; height: 56px; }
  .composer #speak-toggle svg { width: 26px; height: 26px; }
  .composer .kbd-btn .i-x { display: none; }
  .composer .mic { order: 1; width: 112px; height: 112px; flex: 0 0 112px; }
  .composer .kbd-btn { order: 0; } .composer #speak-toggle { order: 2; } .composer .field { order: 1; } .composer #send { order: 2; }
  .composer .mic svg { width: 44px; height: 44px; }
  .composer .mic-ring { inset: -8px; border-width: 4px; }
  .composer:not(.typing) .field, .composer:not(.typing) #send { display: none; }
  .composer:not(.typing) #speak-toggle[hidden] { display: grid !important; }   /* wpisany tekst nie chowa dźwięku, gdy pole zamknięte */
  .composer.typing { padding: 8px 12px 6px; }
  .composer.typing .mic, .composer.typing #speak-toggle { display: none; }
  .composer.typing .kbd-btn { order: 3; width: 44px; height: 44px; }
  .composer.typing .kbd-btn .i-kbd { display: none; } .composer.typing .kbd-btn .i-x { display: block; }
  .mic-hint { font-size: .85rem; padding-bottom: 2px; }
  .mic-hint:empty { min-height: 0; padding: 0; }
}
@media (max-width: 899px) and (max-height: 780px) {
  .stage { height: clamp(170px, 27dvh, 300px); }
}

/* iOS PWA (pasek stanu black-translucent): iOS daje stronie 812 zamiast 874 pt. Rozciągamy html, body i aplikację do pełnej
   wysokości ekranu (sama aplikacja była przycinana przez body: position fixed + overflow hidden). Patrz fixIosGap w app.js. */
html.ios-gap, html.ios-gap body { height: var(--full-h, 100%); }
html.ios-gap body { bottom: auto; }
html.ios-gap .app:not(.kb), html.ios-gap .car { bottom: auto; height: var(--full-h, 100dvh); }
.glos p { line-height: 1.45; }
.glos-zd { font-size: 1.2rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px; }
.glos-t { min-height: 1.4em; font-size: 1.1rem; font-weight: 700; color: var(--listen); }

/* Skrzynka: podgląd treści na karcie i w arkuszu */
.att-q { grid-column: 2; font-size: .84rem; line-height: 1.4; color: var(--text); opacity: .82; padding: 6px 10px; border-left: 3px solid var(--line);
  background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; }
.mail-meta { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.mail-why { margin: 0 0 12px; font-weight: 600; }
.mail-m { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px; }
.mail-h { margin: 0 0 6px; display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.mail-h span { color: var(--muted); white-space: nowrap; }
.mail-b { white-space: pre-wrap; word-break: break-word; font-size: .92rem; line-height: 1.45; user-select: text; -webkit-user-select: text; }
.mail-sug { margin: 10px 0; padding: 8px 10px; border-left: 3px solid var(--accent); font-size: .88rem; }
.mail-acts { flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }

/* Zakładka Zlecenia: przełącznik Zlecenia / Agenci */
.seg.seg-2 { margin: 0 0 6px; }
.list-col > .tasks { flex: 1; min-height: 0; }
.task-pv { margin: 6px 0 0 36px; }

/* Zakładka Skrzynka */
.inbox-head { display: flex; align-items: baseline; gap: 10px; }
.inbox-head .btn { margin-left: auto; }
.inbox-list { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.inbox-list .h-sec { margin: 14px 0 2px; }
.inbox-list .h-sec:first-child { margin-top: 0; }
.ib { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.ib:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ib.urgent { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
.ib-top { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--muted); }
.ib-from { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-when { white-space: nowrap; }
.ib-subj { font-weight: 650; font-size: .98rem; }
.ib-why { font-size: .86rem; color: var(--muted); }
.ib-ex { font-size: .86rem; line-height: 1.4; padding: 6px 10px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 8px 8px 0;
  white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; word-break: break-word; }
.ib-meta { font-size: .75rem; color: var(--muted); }
.ib-talk { margin-top: 12px; align-self: flex-start; }
.mail-do { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.mail-do textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); resize: vertical; }
.task-rep { margin: 6px 0 0 36px; font-size: .88rem; }
.task-rep summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.task-rep .mail-b { margin-top: 6px; font-size: .85rem; }
.task[data-task] { cursor: pointer; min-height: 44px; }
.task[data-task]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-go { margin-left: 4px; font-size: 1.4rem; line-height: 1; color: var(--muted); align-self: center; }
.z-hist { margin: 0 0 12px; padding-left: 18px; font-size: .85rem; color: var(--muted); }
.z-hist li { margin: 3px 0; }
.z-hist span { color: var(--text); font-variant-numeric: tabular-nums; }
.mail-acts .btn, .mail-do .btn { min-height: 44px; }
#sheet-body .task-rep { margin-left: 0; }
/* Ślad zlecenia w wątku */
.ib-chip { all: unset; box-sizing: border-box; display: block; font-size: .8rem; line-height: 1.35; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); color: var(--text); margin: 2px 0; min-height: 32px; }
.ib-chip.gotowe { background: color-mix(in srgb, var(--ok, #1f9d55) 16%, var(--surface-2)); }
.ib-chip.blad { background: color-mix(in srgb, var(--bad) 16%, var(--surface-2)); }
#sheet-body .ib-chip { min-height: 44px; margin: 6px 0; }

/* Jedna rzecz naraz: karta na pierwszym planie + zwinięta kolejka */
.att.focus { padding: 16px; gap: 8px 12px; border-width: 1.5px; box-shadow: 0 6px 24px color-mix(in srgb, var(--text) 8%, transparent); }
.att.focus .att-t { font-size: 1.08rem; }
.att.focus .att-t span:first-child { white-space: normal; }
.att.focus .att-s { -webkit-line-clamp: 3; font-size: .9rem; }
.att.focus .att-q { -webkit-line-clamp: 6; }
.att-prop { grid-column: 1 / -1; display: block; padding: 10px 12px; border-radius: 12px; border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-size: .92rem; line-height: 1.45; white-space: pre-line; max-height: 14em; overflow-y: auto; }
.att-prop b { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.att.focus .att-acts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.att.focus .att-acts .btn { min-height: 48px; font-size: .95rem; }
.att.focus .att-acts .btn.go { grid-column: 1 / -1; }
.att.focus.enter { animation: focus-in .32s ease-out; }
@keyframes focus-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .att.focus.enter { animation: none; } }
.queue { margin-top: 10px; }
.queue summary { cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); padding: 10px 2px; min-height: 44px; display: flex; align-items: center; }
.queue ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.queue li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); min-height: 44px; }
.queue .q-ic svg { width: 18px; height: 18px; color: var(--muted); }
.queue .q-t { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) {
  .talk-col.seg-att .stage { height: clamp(120px, 17dvh, 160px); padding-top: 34px; }
  .talk-col.seg-att .avatar-state, .talk-col.seg-att .caption { display: none; }
}
@media (max-width: 899px) { .att.focus .att-q { -webkit-line-clamp: 3; } .att.focus .att-t { font-size: 1rem; } }

@media (min-width: 900px) {
  .task-detail { overflow-y: auto; height: 100%; max-width: 760px; }
  .td-h { font-size: 1.3rem; margin: 0 0 8px; }
  .task-detail .mail-why { font-size: 1.05rem; }
  .task.sel { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
}
#tasks .task-res { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#tasks .task-h strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ── Widok sprawy (wzór: Superhuman) — kolejka | sprawa | o nadawcy; akcje u góry, odpowiedź przyklejona na dole ── */
html.case-open, html.case-open body { overflow: hidden; }
.case { position: fixed; inset: 0; z-index: 40; background: var(--surface); color: var(--text); display: grid; grid-template-columns: minmax(0, 1fr); height: var(--full-h, 100dvh);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
.case[hidden] { display: none; }
.case kbd { font: 600 .68rem/1 ui-sans-serif, system-ui, sans-serif; padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); background: var(--bg); }
.case-q, .case-ctx { display: none; }
.case-main { position: relative; display: flex; flex-direction: column; min-height: 0; height: 100%; }
/* pasek akcji */
.case-top { display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-t, 0px) + 6px) 8px 6px; border-bottom: 1px solid var(--line); background: var(--surface); position: relative; }
.case-top .icon-btn { width: 40px; height: 40px; flex: none; border: 0; background: none; }
.case-top .icon-btn svg { width: 20px; height: 20px; }
.case-tools { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.case-tools button { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 8px; font-size: .86rem; color: var(--text); white-space: nowrap; }
.case-tools button:hover, .case-tools button:focus-visible { background: var(--surface-2); }
.case-tools svg { width: 18px; height: 18px; color: var(--muted); }
.case-tools kbd { display: none; }
.case-nav { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.case-pos { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; white-space: nowrap; }
.case-snooze { position: absolute; top: 100%; left: 50px; z-index: 5; display: grid; gap: 2px; padding: 6px; min-width: 220px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 48px rgba(0,0,0,.16); }
.case-snooze[hidden] { display: none; }
.case-snooze button { all: unset; cursor: pointer; height: 40px; padding: 0 12px; border-radius: 8px; font-size: .92rem; display: flex; align-items: center; }
.case-snooze button:hover, .case-snooze button:focus-visible { background: var(--surface-2); }
/* treść */
.case-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.case-col { max-width: 720px; margin: 0 auto; padding: 20px 18px 28px; }
.case-subj { font-size: 1.35rem; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.case-meta { margin: 4px 0 14px; font-size: .82rem; color: var(--muted); }
.case-meta .hot { color: var(--bad); font-weight: 600; }
.case-ai { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.case-ai p { margin: 0; font-size: .92rem; line-height: 1.5; }
.case-ai b { font-weight: 600; }
.ai-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.case-load { color: var(--muted); font-size: .88rem; margin: 12px 0; }
.case-thread { margin-top: 10px; border-top: 1px solid var(--line); }
.cm { border-bottom: 1px solid var(--line); }
.cm > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 32px minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 2px; min-height: 52px; }
.cm > summary::-webkit-details-marker { display: none; }
.cm-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 .76rem/1 system-ui, sans-serif; color: #fff; background: hsl(var(--h, 210) 45% 52%); }
.cm-av.big { width: 52px; height: 52px; font-size: 1.05rem; }
.cm.me .cm-av { background: var(--accent); }
.cm-who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cm-who b { font-size: .95rem; font-weight: 600; white-space: nowrap; }
.cm-em { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-peek { font-size: .88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm[open] .cm-peek { visibility: hidden; }
.cm:not([open]) .cm-em { display: none; }
.cm-when { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.cm-text { padding: 0 2px 6px 44px; font-size: 16px; line-height: 1.62; word-break: break-word; user-select: text; -webkit-user-select: text; }
.cm-text p { margin: 0 0 12px; }
.cm-text a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.cm-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: .95rem; }
.cm-kv dt { color: var(--muted); }
.cm-kv dd { margin: 0; font-weight: 500; }
.cm-btn { display: inline-block; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: .88rem; font-weight: 600; }
.cm-quote { margin: 0 0 12px 44px; }
.cm-quote summary { list-style: none; cursor: pointer; display: inline-block; padding: 0 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .8rem; letter-spacing: 2px; }
.cm-quote .cm-text { padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: .92rem; margin-top: 8px; }
.cm-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 2px 14px 44px; }
.cm-att { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; }
.cm-att svg { width: 15px; height: 15px; color: var(--muted); } .cm-att i { font-style: normal; color: var(--muted); }
/* odpowiedź — zawsze widoczna na dole */
.case-compose { flex: none; margin: 0 auto; width: min(100%, 760px); box-sizing: border-box; padding: 8px 12px calc(var(--safe-b, 0px) + 10px); }
.case-compose > * { box-sizing: border-box; }
.case-compose { display: flex; flex-direction: column; }
.cc-to { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 6px; font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.cc-to b { color: var(--text); font-weight: 600; }
.cc-to em { font-style: normal; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--text); }
.cc-notes { all: unset; cursor: pointer; font-size: .78rem; text-decoration: underline; margin-left: auto; }
#case-draft { width: 100%; font: inherit; font-size: 16px; line-height: 1.55; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px 12px 0 0; border-bottom: 0;
  background: var(--surface); color: var(--text); resize: none; min-height: 76px; box-shadow: 0 -1px 0 transparent; }
#case-draft:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.cc-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 8px; border: 1px solid var(--line); border-top: 1px dashed var(--line); border-radius: 0 0 12px 12px; background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,.07); }
#case-draft:focus + .cc-bar { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.cc-b { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border-radius: 8px; font-size: .84rem; color: var(--muted); }
.cc-b:hover, .cc-b:focus-visible { background: var(--surface-2); color: var(--text); }
.cc-b svg { width: 15px; height: 15px; }
.mic-chip[aria-pressed="true"] { background: var(--bad); color: #fff; }
.cc-send { margin-left: auto; min-height: 38px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; }
.cc-send kbd { background: transparent; border-color: color-mix(in srgb, currentColor 30%, transparent); color: inherit; opacity: .75; }
.cc-notes-l { margin: 8px 4px 0; padding-left: 18px; font-size: .82rem; line-height: 1.5; max-height: 20vh; overflow: auto; }
.cc-notes-l[hidden] { display: none; }
/* o nadawcy (telefon: zwinięte pod wątkiem) */
.case-ctx-d { margin-top: 18px; }
.case-ctx-d > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: .92rem; color: var(--muted); }
.cx-card { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 8px 0 14px; }
.cx-name { margin: 6px 0 0; font-size: 1.05rem; }
.cx-mail { font-size: .85rem; color: var(--muted); text-decoration: none; word-break: break-all; }
.cx-kb { font-size: .86rem; line-height: 1.55; color: var(--text); }
.case-ctx h4, .case-ctx-d h4 { font-size: .74rem; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin: 18px 0 6px; }
.cx-d summary { cursor: pointer; font-size: .88rem; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.cx-prev { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.cx-prev li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cx-prev li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-prev time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.cx-open { font-size: .88rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.case-dim { color: var(--muted); font-size: .86rem; text-align: center; }
@media (max-width: 899px) {
  .case-tools span { display: none; }               /* telefon: same ikony, podpisy w title */
  .case-tools { justify-content: space-around; }
  .case-tools button { padding: 0 12px; }
  .case-tools svg { width: 21px; height: 21px; color: var(--text); }
  .cc-b[data-v] { padding: 0 8px; }
  .mic-chip span { display: none; }
}
@media (min-width: 900px) {
  .case { left: 84px; grid-template-columns: 340px minmax(0, 1fr) 300px; }
  .case-back { display: none !important; }
  .case-q, .case-ctx { display: block; overflow-y: auto; }
  .case-q { border-right: 1px solid var(--line); background: var(--bg); }
  .case-ctx { border-left: 1px solid var(--line); padding: 20px 20px; background: var(--bg); }
  .case-ctx-m { display: none; }
  .case-h { display: flex; align-items: baseline; gap: 8px; font-size: 1.05rem; font-weight: 650; margin: 0; padding: 18px 18px 10px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
  .case-h span { font-size: .8rem; color: var(--muted); font-weight: 500; }
  .case-q ol { list-style: none; margin: 0; padding: 0 0 16px; }
  .case-q button { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 2px; width: 100%; padding: 10px 18px 10px 16px; border-left: 3px solid transparent; }
  .case-q button:hover { background: var(--surface-2); }
  .case-q button[aria-current] { background: var(--surface); border-left-color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
  .case-q .q-top { display: flex; justify-content: space-between; gap: 8px; }
  .case-q .q-top b { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .case-q button.hot .q-top b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 6px; vertical-align: middle; }
  .case-q time { font-size: .76rem; color: var(--muted); white-space: nowrap; }
  .case-q .q-subj { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .case-q .q-snip { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .case-top { padding: 8px 16px; }
  .case-tools kbd { display: inline-block; }
  .case-col { padding: 26px 32px 32px; }
  .case-subj { font-size: 1.55rem; }
  .case-compose { padding: 8px 24px 16px; }
}
@media (max-width: 899px) { .case-pos, .cc-send kbd, .cm-em { display: none; } .case-tools { gap: 0; } .case-tools button { padding: 0 9px; } .cm-text { padding-left: 2px; } .cm-quote, .cm-atts { margin-left: 0; padding-left: 2px; } }

/* ── Przestrzenie: GD (domyślna), TNX, Prywatne — wyraźny kolor i etykieta ── */
:root { --sp-gd: #2563eb; --sp-tnx: #8b5cf6; --sp-prywatne: #16a34a; --sp: var(--sp-gd); }
html[data-space="tnx"] { --sp: var(--sp-tnx); }
html[data-space="prywatne"] { --sp: var(--sp-prywatne); }
.nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.space-btn { position: relative; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 550; color: var(--muted); min-height: var(--nav-h); cursor: pointer; }
.space-btn b { display: inline-grid; place-items: center; min-width: 34px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--sp); color: #fff; font-size: .72rem; letter-spacing: .02em; }
html:not([data-space="gd"]) .app { box-shadow: inset 0 3px 0 var(--sp); }
html:not([data-space="gd"]) .space-btn span { color: var(--sp); font-weight: 700; }
.space-pick { display: grid; gap: 8px; padding-bottom: 8px; }
.space-pick button { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); min-height: 64px; }
.space-pick button b { grid-row: span 2; display: grid; place-items: center; height: 40px; border-radius: 10px; color: #fff; font-size: .85rem; }
.space-pick .sp-gd b { background: var(--sp-gd); } .space-pick .sp-tnx b { background: var(--sp-tnx); } .space-pick .sp-prywatne b { background: var(--sp-prywatne); }
.space-pick span { font-weight: 650; } .space-pick small { color: var(--muted); font-size: .82rem; }
.space-pick button[aria-current] { border-color: var(--sp); background: color-mix(in srgb, var(--sp) 8%, var(--surface)); }
@media (min-width: 900px) {
  .nav { grid-auto-flow: row; grid-auto-columns: auto; }
  .space-btn { min-height: 56px; margin-bottom: 8px; border-radius: 14px; }
  html:not([data-space="gd"]) .nav { box-shadow: inset -3px 0 0 var(--sp); }
  .case { box-shadow: inset 0 3px 0 transparent; }
  html:not([data-space="gd"]) .case { box-shadow: inset 0 3px 0 var(--sp); }
}
.nav button[hidden] { display: none !important; }
a.cm-btn { color: var(--text); text-decoration: none; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
a.cm-btn:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
/* Szybka uwaga do Karinki */
.qk { position: fixed; inset: 0; z-index: 60; background: rgba(15, 18, 25, .35); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.qk[hidden] { display: none; }
.qk-box { width: min(640px, 100%); background: var(--surface); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.25); padding: 14px 14px 10px; display: grid; gap: 8px; }
.qk-top { display: flex; align-items: center; gap: 10px; }
.qk-top b { font-size: 1rem; }
.qk-ctx { font-size: .8rem; color: var(--muted); padding: 3px 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.qk kbd { font: 600 .68rem/1 system-ui, sans-serif; padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
#qk-text { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); resize: vertical; }
#qk-text:focus { outline: none; border-color: var(--accent); }
.qk-bar { display: flex; align-items: center; gap: 8px; }
.qk-hint { font-size: .78rem; color: var(--muted); flex: 1; }
.qk-bar .btn { display: inline-flex; gap: 8px; align-items: center; }
.qk-bar .btn kbd { border-color: color-mix(in srgb, currentColor 30%, transparent); color: inherit; }
.qk-out { margin: 4px 2px 2px; font-size: .92rem; line-height: 1.45; }
@media (max-width: 899px) { .qk { padding-top: calc(var(--safe-t, 0px) + 12px); } .qk-hint { display: none; } }
/* Karty dopasowane do sprawy: zaproszenie, oferta CRM */
.ev-card, .of-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 6px 0 14px; background: var(--surface); }
.ev-when { margin: 0; font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: none; }
.ev-title { margin: 4px 0 2px; font-size: 1.2rem; }
.ev-org { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
.ev-org b { color: var(--text); font-weight: 600; }
.ev-warn { margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; font-size: .88rem; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.ev-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.ev-acts .btn { min-height: 44px; padding: 0 16px; text-decoration: none; display: inline-flex; align-items: center; }
.ev-acts .btn.on { background: color-mix(in srgb, var(--ok, #16a34a) 15%, var(--surface)); border-color: var(--ok, #16a34a); }
.ev-join { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.ev-people { margin-top: 10px; font-size: .88rem; }
.ev-people summary { cursor: pointer; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.ev-people ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.ev-people li { display: flex; gap: 8px; align-items: baseline; }
.ev-people li span { width: 14px; text-align: center; font-weight: 700; }
.ev-people li em { font-style: normal; color: var(--muted); font-size: .78rem; margin-left: auto; }
.u-accepted span { color: var(--ok, #16a34a); } .u-declined span { color: var(--bad); }
.ev-desc { margin: 10px 0 0; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.of-sum { font-size: 1.6rem; font-weight: 700; margin: 4px 0 10px; } .of-sum span { font-size: .9rem; color: var(--muted); font-weight: 500; }
.of-pos { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 10px; }
.of-pos td { padding: 6px 4px; border-top: 1px solid var(--line); } .of-pos td:nth-child(2) { text-align: center; color: var(--muted); } .of-pos td:last-child { text-align: right; white-space: nowrap; }
.of-res { margin: 8px 0 0; font-size: .9rem; font-weight: 600; }
.snz { display: grid; gap: 8px; padding-bottom: 8px; } .snz .btn { min-height: 48px; justify-content: flex-start; }
.crm-form { display: grid; gap: 8px; margin-top: 8px; }
.crm-form input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.cm-fwd { margin: 4px 0 12px 44px; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.cm-fwd .cm-text { padding-left: 0; }
.cm-fwd-h { margin: 0 0 6px; font-size: .78rem; font-weight: 650; color: var(--muted); }
@media (max-width: 899px) { .cm-fwd { margin-left: 0; } }
.task-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.case-refresh { all: unset; cursor: pointer; margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--accent); padding: 4px 8px; border-radius: 8px; }
.case-refresh:hover { background: var(--surface-2); }
.case-last { margin: -6px 18px 8px; font-size: .74rem; color: var(--muted); }
.case-h .case-refresh { font-size: .78rem; font-weight: 600; margin-left: auto; }
.case-last { margin: 0 18px 8px; }
/* Notatki przy osobie (mini-CRM) */
.nt { padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 6px; font-size: .86rem; line-height: 1.45; }
.nt.done { opacity: .55; }
.nt p { margin: 0 0 4px; } .nt-h { font-size: .74rem; color: var(--muted); } .nt-u { font-weight: 600; }
.nt-add { display: grid; gap: 6px; margin: 6px 0 4px; }
.nt-add textarea, .nt-add input, .nt-add select { font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.nt-row { display: flex; gap: 6px; } .nt-row select { width: auto; } .nt-row input { flex: 1; min-width: 0; }
.case-cmd { display: flex; gap: 6px; align-items: center; margin: 0 0 10px; padding: 6px 6px 6px 12px; border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--line)); border-radius: 12px; background: var(--surface); }
.case-cmd input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 15px; color: var(--text); padding: 6px 0; }
.case-cmd input:focus { outline: none; }
.case-cmd-out { margin: -4px 0 12px; font-size: .9rem; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.cm-rcpt { margin: -6px 2px 10px 44px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.cm-rcpt b { color: var(--text); }
.cm-old { border-left: 2px solid var(--line); padding-left: 10px; margin: 8px 0; }
.case-meta .dw { color: var(--muted); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.case-ai .btn { margin-left: auto; flex: none; align-self: center; }
.case-info-more > summary { cursor: pointer; font-size: .86rem; color: var(--muted); min-height: 40px; display: flex; align-items: center; }
@media (max-width: 899px) { .cm-rcpt { margin-left: 2px; } }
.case-tools .sh-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 8px; font-size: .86rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.case-tools .sh-link:hover { background: var(--surface-2); }
.case-tools .sh-link svg { width: 18px; height: 18px; color: var(--muted); }
.case-tools .sh-link kbd { display: none; }
@media (min-width: 900px) { .case-tools .sh-link kbd { display: inline-block; } }
@media (max-width: 899px) { .case-tools .sh-link span { display: none; } .case-tools .sh-link svg { color: var(--text); width: 21px; height: 21px; } }
.case-last.warn { color: var(--bad); font-weight: 600; }

/* ── Nawigacja v2 (UX 23.11): przestrzeń jako filtr, Dziś z małym awatarem ── */
.space-chips { display: inline-flex; gap: 4px; padding: 2px; border-radius: 999px; background: var(--surface-2); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.spc { all: unset; cursor: pointer; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; color: var(--muted); white-space: nowrap; min-height: 24px; display: inline-flex; align-items: center; }
.spc[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.spc-gd[aria-checked="true"] { color: var(--sp-gd); } .spc-tnx[aria-checked="true"] { color: var(--sp-tnx); } .spc-prywatne[aria-checked="true"] { color: var(--sp-prywatne); }
html[data-space="all"] { --sp: var(--text); }
html[data-space="prywatne"] { --sp: var(--sp-prywatne); }
.stage-top { gap: 8px; }
@media (max-width: 899px) {
  .talk-col.seg-att .stage { height: calc(var(--safe-t) + 92px); padding: calc(var(--safe-t) + 44px) 16px 6px; flex-direction: row; justify-content: flex-start; align-items: center; gap: 10px; background: var(--bg); }
  .talk-col.seg-att .avatar-wrap { flex: none; width: 40px; height: 40px; max-width: none; aspect-ratio: 1; }
  .talk-col.seg-att .avatar, .talk-col.seg-att .avatar-photo { border-radius: 50%; }
  .talk-col.seg-att .avatar-photo { object-fit: cover; object-position: 50% 25%; }
  .talk-col.seg-att .avatar-state { display: block !important; margin: 0; font-size: .85rem; text-align: left; }
  .talk-col.seg-att .halo { display: none; }
  .stage-top .hello { display: none; }
  .stage-top .conn span { display: none; }
  .stage-top .space-chips { flex: 1; min-width: 0; }
}
/* Karta v2 */
.att.focus .att-acts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.att.focus .att-acts .btn.go { grid-column: auto; }
.att.focus .att-acts .btn:only-child, .att.focus .att-acts .btn.go:nth-last-child(2):first-child { grid-column: 1 / 3; }
.att.focus .more-btn { min-width: 48px; font-size: 1.2rem; letter-spacing: 1px; }
.att-prop-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.att.focus .att-t span:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.att.focus .att-s { -webkit-line-clamp: 1; }
.toast.undo { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.toast.undo button { all: unset; cursor: pointer; font-weight: 700; color: var(--accent); padding: 4px 8px; border-radius: 6px; }
@media (max-width: 899px) { .att-block:has(#quick) { display: none; } }   /* szybkie akcje dublowały nawigację — na telefonie mikrofon wystarcza */
.agents-rest > summary { cursor: pointer; padding: 12px 16px; font-size: .85rem; font-weight: 600; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.sama-line { margin: 10px 2px 0; font-size: .82rem; color: var(--muted); }
.linkbtn { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.row-set select { font: inherit; font-size: .85rem; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); max-width: 55%; }
.tool-more { display: none !important; }
.case-more { position: absolute; top: 100%; right: 8px; z-index: 6; display: grid; gap: 2px; padding: 6px; min-width: 220px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 48px rgba(0,0,0,.16); }
.case-more > * { all: unset; cursor: pointer; height: 44px; padding: 0 12px; border-radius: 8px; font-size: .95rem; display: flex; align-items: center; color: var(--text); }
.case-more > *:hover { background: var(--surface-2); }
@media (max-width: 899px) {
  .case-tools .tool-x { display: none !important; }
  .tool-more { display: inline-flex !important; }
  .case-tools span { display: inline !important; font-size: .78rem; }      /* podpisy pod ikonami na telefonie */
  .case-tools button { flex-direction: column; height: 52px; gap: 2px; padding: 0 8px; }
  .case-tools { justify-content: space-between; }
}
/* Brief poranny i przed spotkaniem */
.brief { display: grid; gap: 8px; margin-bottom: 12px; }
.brief-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.brief-card.meet { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.brief-h { margin: 0 0 6px; font-size: .9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brief-h .linkbtn { margin-left: auto; font-size: .8rem; }
.brief-i { margin: 4px 0; font-size: .86rem; line-height: 1.45; }
.brief-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .88rem; line-height: 1.4; }
.brief-t { flex: 1; min-width: 0; }
.brief-rate { display: inline-flex; gap: 2px; flex: none; }
.brief-rate button { all: unset; cursor: pointer; font-size: .9rem; padding: 4px; border-radius: 6px; opacity: .45; }
.brief-rate button[aria-pressed="true"], .brief-rate button:hover { opacity: 1; background: var(--surface-2); }
details.brief-card > summary { list-style: none; cursor: pointer; margin: 0; min-height: 32px; }
details.brief-card > summary::-webkit-details-marker { display: none; }
details.brief-card[open] > summary { margin-bottom: 6px; }
.brief-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.powrot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-size: .88rem; }
.powrot p { margin: 0; flex: 1; } .powrot[hidden] { display: none; }
.obiet { margin: 4px 0 12px; } .obiet > summary { cursor: pointer; font-weight: 650; font-size: .9rem; min-height: 44px; display: flex; align-items: center; }
.why-box { margin-top: 12px; font-size: .88rem; } .why-box summary { cursor: pointer; color: var(--muted); min-height: 36px; display: flex; align-items: center; }
/* Dziś na komputerze (UX 23.11): sprawy w szerokiej kolumnie po lewej, rozmowa z Karinką w węższej po prawej, mały awatar */
@media (min-width: 900px) {
  .view-home { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
  .view-home .side-col { order: -1; border-left: 0; border-right: 1px solid var(--line); padding: 26px max(24px, calc((100% - 760px) / 2)); background: var(--bg); }
  .view-home .talk-col { background: var(--bg-2); }
  .view-home .stage { height: auto; min-height: 0; flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; padding: 64px 20px 12px; background: none; }
  .view-home .stage .avatar-wrap { flex: none; width: 56px; height: 56px; max-width: none; aspect-ratio: 1; }
  .view-home .stage .avatar, .view-home .stage .avatar-photo { border-radius: 50%; }
  .view-home .stage .avatar-photo { object-fit: cover; object-position: 50% 25%; }
  .view-home .stage .halo { display: none; }
  .view-home .stage .avatar-state { margin: 0; text-align: left; }
  .view-home .stage .caption { display: none; }
  .view-home .stage-top { left: 20px; right: 20px; flex-wrap: wrap; }
  .view-home .stage-top .hello { flex-basis: 100%; }
  .view-home .panel > .pane-scroll { padding: 12px 20px; }
  .view-home .composer { padding: 10px 20px 14px; }
  .view-home .att.focus { max-width: 760px; }
}
@media (min-width: 900px) {
  .view-home .stage { flex-wrap: wrap; padding: 16px 20px 12px; }
  .view-home .stage-top { position: static; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
  .view-home .stage-top .hello { flex-basis: auto; margin-right: auto; }
  .view-home .stage-top .space-chips { order: 3; flex-basis: 100%; justify-content: space-between; }
}
.qk-res { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow-y: auto; border-top: 1px solid var(--line); }
.qk-res[hidden] { display: none; }
.qk-res button { all: unset; box-sizing: border-box; cursor: pointer; display: grid; width: 100%; padding: 8px 10px; border-radius: 8px; }
.qk-res button:hover, .qk-res button:focus-visible { background: var(--surface-2); }
.qk-res b { font-size: .9rem; font-weight: 600; } .qk-res span { font-size: .78rem; color: var(--muted); }
.next-meet { margin: 0 2px 2px; font-size: .86rem; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .next-meet b { color: var(--text); font-weight: 600; }
.fab-mic { display: none; }
@media (max-width: 899px) {
  .fab-mic { position: fixed; right: 16px; bottom: calc(var(--safe-b) + var(--nav-h) + 16px); z-index: 30; width: 60px; height: 60px; border-radius: 50%; border: 0; display: grid; place-items: center;
    background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.22); cursor: pointer; }
  .fab-mic[hidden], html.case-open .fab-mic { display: none; }
  .fab-mic svg { width: 26px; height: 26px; }
}

/* ZLECENIE #39: przy otwartej klawiaturze aplikacja = widoczny obszar (wysokość i przesunięcie), także w trybie PWA z poprawką ios-gap */
.app.kb, html.ios-gap .app.kb { top: var(--app-top, 0px); bottom: auto; height: var(--app-h, 100dvh); }
.app.kb .fab-mic { display: none; }
.att-why { grid-column: 2 / -1; font-size: .78rem; color: var(--muted); margin-top: -2px; }
/* DEMO: dane z makiety wyraźnie oznaczone (UX 4.5) */
.att.demo { border-style: dashed; }
.att.demo::before { content: "DEMO — dane przykładowe, nic nie trafi do CRM"; grid-column: 1 / -1; font-size: .72rem; font-weight: 700; color: var(--wait, #b7791f); letter-spacing: .02em; }
.snz-pick { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 12px; } .snz-pick label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); flex: 1; } .snz-pick input { font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.pamiec-q { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); margin: 6px 0 10px; box-sizing: border-box; } .pam { margin: 8px 0; } .pam summary { cursor: pointer; min-height: 40px; display: flex; gap: 8px; align-items: center; } .pam summary small { color: var(--muted); } .pam .mail-b { max-height: 40vh; overflow-y: auto; white-space: pre-wrap; font-size: .85rem; } .pam-kor { display: flex; gap: 8px; margin-top: 8px; } .pam-kor input { flex: 1; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
/* zasady treści: na liście na telefonie bez cytatów maila (cytat dopiero w widoku sprawy) */ @media (max-width: 899px) { .ib-ex { display: none; } }
.ask-body { max-height: 45vh; overflow-y: auto; white-space: pre-wrap; margin-bottom: 12px; } .ask-row { display: flex; gap: 10px; } .ask-row .btn { flex: 1; min-height: 48px; }
