/* ============================================================================
   AGENT-CZAT — zakładka CZAT (wyśrodkowana kolumna) + współdzielony wątek (.ct)
   używany również przez boczny panel agenta (agent-panel.css).
   ============================================================================ */
.chat-view{
  flex:1;min-width:0;display:flex;flex-direction:column;
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;
}
.chat-view[hidden]{display:none}
body.app-reveal .chat-view{animation:riseIn .5s ease .18s backwards}

#panelChat:not([hidden]){display:flex;flex-direction:column}

/* --- lista rozmów (panel boczny zakładki) --- */
.chat-list{flex:1;overflow-y:auto;margin-top:8px;padding-right:4px;display:flex;flex-direction:column;gap:2px}
.chat-list-empty{padding:14px 10px;font-size:12px;color:var(--dim);line-height:1.5}
.chat-item{
  position:relative;display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;
  transition:background .13s ease;
}
.chat-item:hover{background:#1B2027}
.chat-item.active{background:#262C34}
.chat-item-ico{
  width:28px;height:28px;border-radius:7px;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  background:rgba(139,92,246,.12);border:1px solid rgba(139,92,246,.35);color:#B79CFF;
}
.chat-item-ico svg{width:14px;height:14px}
.chat-item-txt{display:flex;flex-direction:column;min-width:0;flex:1}
.chat-item-name{font-size:12px;font-weight:600;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-item-when{font-size:10px;color:var(--dim)}
.chat-item-x{
  width:22px;height:22px;border-radius:5px;flex:0 0 auto;font-size:10px;color:var(--dim);
  opacity:0;transition:opacity .12s ease,color .12s ease,background .12s ease;
}
.chat-item:hover .chat-item-x{opacity:1}
.chat-item-x:hover{color:#FF7A8E;background:rgba(244,63,94,.12)}
.chat-rename{
  flex:1;min-width:0;height:24px;background:#0F1216;border:1px solid var(--blue);border-radius:5px;
  color:var(--text);font-size:12px;font-family:inherit;padding:0 8px;outline:none;
}
.chat-rename-title{height:30px;font-size:14px;font-weight:700;width:min(60%,480px)}

/* --- nagłówek zakładki --- */
.chat-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 18px;border-bottom:1px solid #21252C;flex-shrink:0;min-height:60px;
}
.chat-head-l{display:flex;align-items:center;gap:12px;min-width:0}
.chat-title{font-size:14px;font-weight:700;color:#EDF1F6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:text}
.chat-model{font-size:10.5px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);white-space:nowrap}
.chat-model:empty{display:none}
.chat-head-r{display:flex;align-items:center;gap:8px;flex-shrink:0}
.chat-thread{flex:1;min-height:0;display:flex;flex-direction:column}

/* ============================================================================
   Wątek (.ct) — wyśrodkowana kolumna max 760px (jak w ChatGPT); w trybie
   compact (panel boczny) kolumna wypełnia całą szerokość.
   ============================================================================ */
.ct{flex:1;min-height:0;display:flex;flex-direction:column}
.ct-host{flex:1;min-height:0;display:flex;flex-direction:column}
.ct-scroll{flex:1;min-height:0;overflow-y:auto;padding:26px 24px 12px}
.ct-col{width:100%;max-width:760px;margin:0 auto;display:flex;flex-direction:column;gap:18px}
.ct.compact .ct-scroll{padding:16px 14px 8px}
.ct.compact .ct-col{max-width:none;gap:14px}

.ct-empty{margin:auto;max-width:520px;text-align:center;padding:40px 10px 20px;display:flex;flex-direction:column;align-items:center;gap:10px}
.ct-empty-ico{
  width:52px;height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,rgba(139,92,246,.22),rgba(76,159,255,.14));border:1px solid rgba(139,92,246,.45);color:#C4ACFF;
}
.ct-empty-ico svg{width:24px;height:24px}
.ct-empty-t{font-size:15px;font-weight:800;color:#EDF1F6;letter-spacing:.02em}
.ct-empty-s{font-size:12.5px;color:var(--muted);line-height:1.6}
.ct-sugg{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:8px}
.ct-sug{
  height:32px;padding:0 12px;border-radius:8px;background:#12151A;border:1px solid var(--border);color:var(--text-soft);
  font-size:11.5px;font-weight:600;transition:border-color .13s ease,color .13s ease,background .13s ease;
}
.ct-sug:hover{border-color:rgba(139,92,246,.6);color:#fff;background:rgba(139,92,246,.1)}

.ct-msg{display:flex;gap:12px;max-width:100%}
.ct-msg.user{align-self:flex-end;max-width:82%}
.ct-msg.ai{align-self:stretch}
.ct-ava{
  width:30px;height:30px;border-radius:9px;flex:0 0 auto;margin-top:2px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,rgba(139,92,246,.25),rgba(76,159,255,.12));border:1px solid rgba(139,92,246,.45);color:#C4ACFF;
}
.ct-ava svg{width:15px;height:15px}
.ct-body{display:flex;flex-direction:column;gap:8px;min-width:0;flex:1}
.ct-bubble{
  padding:11px 15px;border-radius:12px;font-size:13.5px;line-height:1.62;
  background:#191D23;border:1px solid #262B33;color:#D9DEE6;word-wrap:break-word;overflow-wrap:anywhere;
}
.ct-msg.user .ct-bubble{background:#14263B;border-color:#26405C;color:#DCEAFB;border-bottom-right-radius:4px}
.ct-msg.ai .ct-bubble{border-top-left-radius:4px}
.ct-msg.error .ct-bubble{background:#2A1218;border-color:#4A1C27;color:#FFB4C0}
.ct-bubble p{margin:0}
.ct-bubble p + p,.ct-bubble ul + p,.ct-bubble ol + p,.ct-bubble pre + p,.ct-bubble p + ul,.ct-bubble p + ol,.ct-bubble p + pre{margin-top:10px}
.ct-bubble ul,.ct-bubble ol{margin:0;padding-left:20px}
.ct-bubble li{margin:3px 0}
.ct-bubble h4{font-size:13px;font-weight:800;letter-spacing:.04em;margin:0}
.ct-bubble code{font-family:"JetBrains Mono","Consolas",monospace;font-size:12px;background:#0F1216;border:1px solid #262B33;border-radius:4px;padding:1px 5px;color:#B8E1FF}
.ct-bubble pre{margin:0;background:#0F1216;border:1px solid #262B33;border-radius:8px;padding:10px 12px;overflow-x:auto}
.ct-bubble pre code{background:none;border:none;padding:0;font-size:12px;line-height:1.55;color:#D9DEE6;white-space:pre}
.ct-bubble b{color:#F1F4F8}

.ct-dots{display:inline-flex;gap:4px;vertical-align:middle;margin-right:6px}
.ct-dots i{width:6px;height:6px;border-radius:50%;background:#B79CFF;animation:ctDot 1.1s ease-in-out infinite}
.ct-dots i:nth-child(2){animation-delay:.18s}
.ct-dots i:nth-child(3){animation-delay:.36s}
@keyframes ctDot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.ct-msg.typing .ct-bubble{color:var(--muted);font-size:12.5px}

.ct-steps{display:flex;flex-wrap:wrap;gap:5px}
.ct-step{
  font-size:10px;font-weight:700;letter-spacing:.06em;color:var(--dim);
  background:#12151A;border:1px solid var(--border);border-radius:5px;padding:2px 7px;cursor:default;
  font-family:"JetBrains Mono","Consolas",monospace;
}
.ct-step.err{color:#FF9AAA;border-color:#4A1C27}

/* --- karty zasobów utworzonych przez agenta --- */
.ct-cards{display:flex;flex-direction:column;gap:8px}
.ac-card{
  background:#12151A;border:1px solid #2A3038;border-radius:11px;padding:11px 13px;cursor:pointer;
  display:flex;flex-direction:column;gap:8px;outline:none;
  transition:border-color .14s ease,background .14s ease,transform .14s ease;
}
.ac-card:hover,.ac-card:focus-visible{border-color:rgba(139,92,246,.65);background:#151922;transform:translateY(-1px)}
.ac-head{display:flex;align-items:center;gap:9px;min-width:0}
.ac-ico{
  width:26px;height:26px;border-radius:7px;flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  background:rgba(139,92,246,.12);border:1px solid rgba(139,92,246,.35);color:#C4ACFF;
}
.ac-ico svg{width:14px;height:14px}
.ac-images .ac-ico,.ac-bin .ac-ico{background:rgba(46,229,157,.1);border-color:rgba(46,229,157,.35);color:#7EF0C0}
.ac-template .ac-ico,.ac-note .ac-ico{background:rgba(76,159,255,.1);border-color:rgba(76,159,255,.35);color:#8DC3FF}
.ac-task .ac-ico,.ac-project .ac-ico{background:rgba(242,201,59,.1);border-color:rgba(242,201,59,.35);color:#F2D97A}
.ac-kind{font-size:9.5px;font-weight:800;letter-spacing:.14em;color:var(--dim);flex:0 0 auto}
.ac-title{font-size:13px;font-weight:700;color:#EDF1F6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}
.ac-open{font-size:10.5px;font-weight:700;letter-spacing:.06em;color:#B79CFF;white-space:nowrap;opacity:.75;flex:0 0 auto}
.ac-card:hover .ac-open{opacity:1}
.ac-sum{font-size:12px;color:var(--muted);line-height:1.5}
.ac-text{font-size:12px;color:var(--text-soft);line-height:1.5;white-space:pre-wrap;max-height:96px;overflow:hidden;
  background:#0F1216;border:1px solid #21262E;border-radius:7px;padding:8px 10px}
.ac-mono{font-family:"JetBrains Mono","Consolas",monospace;font-size:11.5px}

/* mini-diagram łańcucha węzłów (canvas) */
.ac-flow{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.ac-node{
  --ac:#8A93A0;
  font-size:10px;font-weight:800;letter-spacing:.1em;color:var(--ac);
  border:1px solid color-mix(in srgb,var(--ac) 55%,transparent);background:color-mix(in srgb,var(--ac) 10%,#0F1216);
  border-radius:6px;padding:4px 8px;white-space:nowrap;
}
.ac-arrow{color:var(--dim);font-size:13px;line-height:1}

.ac-thumbs{display:flex;flex-wrap:wrap;gap:6px}
.ac-thumb{width:76px;height:76px;object-fit:cover;border-radius:7px;border:1px solid #2A3038;background:#0F1216;transition:border-color .13s ease,transform .13s ease}
.ac-thumb:hover{border-color:var(--blue);transform:scale(1.03)}
.ct.compact .ac-thumb{width:64px;height:64px}
.ac-more{width:76px;height:76px;border-radius:7px;border:1px dashed #2A3038;display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--muted)}
.ac-pending{font-size:12px;color:var(--muted);display:flex;align-items:center}

/* --- pole tworzenia (wyśrodkowane jak kolumna rozmowy) --- */
.ct-composewrap{flex-shrink:0;padding:8px 24px 14px;border-top:1px solid #21252C;background:transparent}
.ct.compact .ct-composewrap{padding:8px 14px 12px}
.ct-compose{
  width:100%;max-width:760px;margin:0 auto;display:flex;align-items:flex-end;gap:8px;
  background:var(--card-2);border:1px solid #2C323A;border-radius:14px;padding:8px 8px 8px 16px;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.ct.compact .ct-compose{max-width:none;border-radius:12px}
.ct-compose:focus-within{border-color:rgba(139,92,246,.7);box-shadow:0 0 0 3px rgba(139,92,246,.12)}
.ct-input{
  flex:1;resize:none;max-height:180px;min-height:24px;
  background:transparent;border:none;color:var(--text);font-size:13.5px;font-family:inherit;line-height:1.5;padding:7px 0;outline:none;
}
.ct-input::placeholder{color:var(--dim)}
.ct-send{
  width:38px;height:38px;flex:0 0 auto;border-radius:10px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#8B5CF6,#4C9FFF);color:#fff;transition:filter .15s ease,opacity .15s ease;
}
.ct-send svg{width:17px;height:17px}
.ct-send:hover{filter:brightness(1.1)}
.ct-send:disabled{opacity:.35;cursor:default;filter:none}
.ct-hint{max-width:760px;margin:6px auto 0;font-size:10.5px;color:var(--dim);text-align:center}
.ct.compact .ct-hint{max-width:none;font-size:10px}

/* --- selektor modelu rozmowy (nagłówek zakładki i panelu) --- */
.ct-model-host{display:flex;align-items:center;flex-shrink:0}
.ct-model-host[hidden]{display:none}
.ct-model-seg{display:inline-flex;align-items:center;gap:2px;padding:2px;background:#0F1216;border:1px solid var(--border);border-radius:8px}
.ct-model-opt{
  height:24px;padding:0 9px;border-radius:6px;font-size:10px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;
  color:var(--dim);white-space:nowrap;transition:color .13s ease,background .13s ease;
}
.ct-model-opt:hover{color:var(--text-soft);background:#171B21}
.ct-model-opt.active{color:#fff;background:linear-gradient(135deg,rgba(139,92,246,.6),rgba(76,159,255,.5))}
.ct-model-opt.off{opacity:.38;cursor:not-allowed}
.ct-model-opt.off:hover{color:var(--dim);background:transparent}
.ct-model-opt.off.active{opacity:.6}

/* plakietka modelu przy odpowiedzi agenta */
.ct-mtag{
  font-size:9.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;padding:2px 7px;border-radius:5px;cursor:default;
  color:#C4ACFF;background:rgba(139,92,246,.12);border:1px solid rgba(139,92,246,.4);
}
.ct-mtag.opus{color:#FFD58A;background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.45)}
.ct-mtag.stub{color:var(--muted);background:#12151A;border-color:var(--border)}
