:root {
  --tlo: #f4f7fa; --karta: #ffffff; --tekst: #17222e; --cichy: #5a6a7a; --linia: #d5dde6;
  --akcent: #0f8f84; --akcent-tekst: #ffffff; --claude: #4a63d8; --blad: #c0392b;
  --stoi: #c0392b; --trwa: #0f8f84; --gotowe: #5a6a7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tlo: #0e1620; --karta: #17222e; --tekst: #eaf2f7; --cichy: #93a4b5; --linia: #2a3948;
    --akcent: #3fc4b4; --akcent-tekst: #06211e; --claude: #8fa2ff; --blad: #ff8a7a;
    --stoi: #ff8a7a; --trwa: #3fc4b4; --gotowe: #93a4b5;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--tlo); color: var(--tekst);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 1.6rem 0 .5rem; }
button, input, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--linia); background: var(--karta); border-radius: 10px;
  padding: .6rem .9rem; cursor: pointer; min-height: 44px;
}
button.glowny { background: var(--akcent); color: var(--akcent-tekst); border-color: var(--akcent); font-weight: 600; }
button.cichy { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--akcent); outline-offset: 2px; }
input, textarea {
  border: 1px solid var(--linia); background: var(--karta); border-radius: 10px;
  padding: .6rem .75rem; width: 100%; min-height: 44px;
}
.opis, .uwaga { color: var(--cichy); font-size: .88rem; margin: .4rem 0; }
.blad { color: var(--blad); font-size: .9rem; min-height: 1.2em; margin: .4rem 0; }
.rzad { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rzad input { flex: 1 1 12rem; width: auto; }

.wejscie {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .8rem; padding: 2rem 1.25rem; text-align: center; max-width: 26rem; margin: 0 auto;
}
.wejscie img { border-radius: 16px; }
.wejscie label { width: 100%; text-align: left; font-size: .88rem; color: var(--cichy); }
.wejscie button { width: 100%; }

.aplikacja { height: 100%; display: flex; flex-direction: column; max-width: 46rem; margin: 0 auto; }
header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; border-bottom: 1px solid var(--linia);
}
.plakietka { font-size: .75rem; color: var(--cichy); border: 1px solid var(--linia); border-radius: 999px; padding: .15rem .6rem; white-space: nowrap; }
.widok { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; }
#widok-czat { display: flex; flex-direction: column; padding-bottom: .4rem; }
.czat-lista { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding-bottom: .5rem; }
.dymek { max-width: 86%; padding: .55rem .8rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dymek small { display: block; color: inherit; opacity: .65; font-size: .72rem; margin-top: .15rem; }
.dymek.jakub { align-self: flex-end; background: var(--akcent); color: var(--akcent-tekst); }
.dymek.asystent { align-self: flex-start; background: var(--karta); border: 1px solid var(--linia); }
.dymek.system { align-self: center; color: var(--cichy); font-size: .85rem; text-align: center; max-width: 100%; }
.czat-formularz { display: flex; gap: .5rem; align-items: flex-end; }
.czat-formularz textarea { resize: none; max-height: 9rem; }
.uwaga { text-align: center; margin: .35rem 0 0; }

.zakladki {
  display: flex; border-top: 1px solid var(--linia); background: var(--karta);
  padding-bottom: env(safe-area-inset-bottom);
}
.zakladki button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--cichy); min-height: 52px; }
.zakladki button.aktywna { color: var(--akcent); font-weight: 600; box-shadow: inset 0 2px 0 var(--akcent); }

.potok { background: var(--karta); border: 1px solid var(--linia); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; }
.potok h2 { margin: 0 0 .2rem; }
.potok .przyklad { display: inline-block; font-size: .75rem; border: 1px dashed var(--cichy); color: var(--cichy); border-radius: 999px; padding: .1rem .6rem; margin: .3rem 0 .6rem; }
.graf { width: 100%; height: auto; display: block; }
.graf .krawedz { stroke: var(--cichy); stroke-width: 1.5; fill: none; }
.graf .grot { fill: var(--cichy); }
.graf .wezel rect { fill: var(--tlo); stroke: var(--linia); stroke-width: 1.5; }
.graf .wezel { cursor: pointer; }
.graf .wezel:focus-visible rect { stroke: var(--akcent); stroke-width: 3; }
.graf .wezel.trwa rect { stroke: var(--trwa); stroke-width: 2.5; }
.graf .wezel.stoi rect { stroke: var(--stoi); stroke-width: 2.5; }
.graf .nazwa { fill: var(--tekst); font-size: 14px; font-weight: 600; }
.graf .pod { fill: var(--cichy); font-size: 12px; }
.graf .mozg-lokalny { fill: var(--akcent); }
.graf .mozg-claude { fill: var(--claude); }
.graf .mozg-skrypt { fill: var(--cichy); }
.legenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--cichy); margin-top: .6rem; }
.legenda i { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
.legenda .l { background: var(--akcent); } .legenda .c { background: var(--claude); } .legenda .s { background: var(--cichy); }

.urz-lista { list-style: none; margin: 0 0 .8rem; padding: 0; }
.urz-lista li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--linia); }
.urz-lista small { display: block; color: var(--cichy); }

.arkusz { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.arkusz-tresc {
  background: var(--karta); width: 100%; max-width: 46rem; border-radius: 18px 18px 0 0;
  padding: 1.2rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom));
}
.arkusz-tresc h2 { margin-top: 0; }
.przelacznik { margin: .8rem 0; }
.przelacznik span { display: block; font-size: .88rem; color: var(--cichy); margin-bottom: .4rem; }
.przelacznik button { flex: 1; }
.przelacznik button.wybrany { border-color: var(--akcent); box-shadow: inset 0 0 0 1px var(--akcent); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) { .dymek { animation: wej .15s ease-out; } }
@keyframes wej { from { opacity: 0; transform: translateY(4px); } }
