/* Pulpit Parseknas (dom.parseknas.com) - v14 (Klucznik 20.10.2026, brief 2110b pkt 3, 5, 7, 9).
   Wyglad w standardzie konta 2DR3: TE SAME tokeny (css/tokeny.css = kopia /styl/tokeny.css z serwera 2DR3), czcionki
   systemowe, motyw jak w systemie / jasny / ciemny, karty jak w koncie, znak w naglowku, pelne logo Parseknas na dole.
   Zero stylow w tresci strony (kolor kafelka ustawia skrypt przez style.setProperty). */

html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--f-sans); font-size: var(--t-base); line-height: var(--lh-base);
  color: var(--c-text); background: var(--c-bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--c-accent); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--c-text-2); }
.ik { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ik-sm { width: 16px; height: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* ---------- niebo nad domem (js/niebo.js); bez niego zwykle tlo strony ---------- */
#niebo { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); }
body.z-niebem #niebo { opacity: 1; }

/* ---------- pasek gorny (jak konto 2DR3: znak + nazwa, akcje po prawej) ---------- */
header.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--c-surface) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--c-border); }
.top-in { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: 0 24px; max-width: 1240px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--c-text); font-weight: var(--fw-bold); font-size: var(--t-md);
  letter-spacing: -.01em; text-decoration: none; flex-shrink: 0; }
.brand img { width: 32px; height: 32px; }
.brand span { line-height: 1.1; }
.brand small { display: block; font-size: var(--t-xs); font-weight: var(--fw-medium); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-3); }
.gap { flex: 1; min-width: 0; }
.top-btn { position: relative; display: inline-grid; place-items: center; width: var(--hit); height: var(--hit); flex-shrink: 0; border: 1px solid transparent;
  border-radius: var(--r-md); background: none; color: var(--c-text-2); cursor: pointer; }
.top-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.licznik { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--c-warn); color: var(--c-surface); font-size: 11px; font-weight: var(--fw-bold); line-height: 18px; text-align: center; }
.user { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--hit); padding: 0 var(--s-2) 0 4px; border-radius: var(--r-pill);
  color: var(--c-text); font-size: var(--t-sm); font-weight: var(--fw-medium); }
.awatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent);
  font-size: var(--t-xs); font-weight: var(--fw-bold); letter-spacing: .02em; }

/* ---------- pasek powiadomien (pkt 3) ---------- */
.alert { border-bottom: 1px solid color-mix(in srgb, var(--c-warn) 35%, transparent); background: var(--c-warn-soft); color: var(--c-text); }
.alert-in { display: flex; align-items: center; gap: var(--s-3); max-width: 1240px; margin: 0 auto; padding: 10px 24px; flex-wrap: wrap; }
.alert-ic { color: var(--c-warn); display: inline-grid; place-items: center; }
.alert-t { flex: 1 1 260px; min-width: 0; font-size: var(--t-sm); font-weight: var(--fw-semi); }
.alert-t small { display: block; font-weight: var(--fw-regular); color: var(--c-text-2); }
.alert-akcje { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.alert.zle { background: var(--c-bad-soft); border-bottom-color: color-mix(in srgb, var(--c-bad) 35%, transparent); }
.alert.zle .alert-ic { color: var(--c-bad); }

/* ---------- przyciski i pola ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
  font: inherit; font-size: var(--t-sm); font-weight: var(--fw-semi); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--c-surface-2); }
.btn-primary { background: var(--c-accent-solid); border-color: var(--c-accent-solid); color: var(--c-on-accent); }
.btn-primary:hover { background: var(--c-accent-solid); filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--c-bad); border-color: color-mix(in srgb, var(--c-bad) 45%, transparent); background: var(--c-bad-soft); }
.btn-sm { min-height: 34px; padding: 0 var(--s-3); }
input[type="text"], input[type="url"], input[type="search"], select {
  width: 100%; min-height: var(--hit); padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text); font: inherit; font-size: var(--t-base); }
input[type="color"] { width: 100%; height: var(--hit); padding: 4px; border-radius: var(--r-md); border: 1px solid var(--c-border-strong); background: var(--c-surface); cursor: pointer; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; border-color: var(--c-focus); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.field > span { font-size: var(--t-sm); font-weight: var(--fw-semi); color: var(--c-text-2); }
.check { display: flex; align-items: flex-start; gap: var(--s-3); font-size: var(--t-sm); color: var(--c-text); margin-bottom: var(--s-3); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--c-accent-solid); flex: none; }
.check small { display: block; color: var(--c-text-3); }
.error { margin-top: var(--s-3); padding: 10px 12px; border-radius: var(--r-sm); background: var(--c-bad-soft); color: var(--c-bad); font-size: var(--t-sm); }

/* ---------- tresc ---------- */
main.dash { width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--s-6) 24px var(--s-6); flex: 1; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.clock { font-size: clamp(40px, 7vw, 64px); font-weight: 300; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--c-text); }
.date { margin-top: 6px; color: var(--c-text-2); text-transform: capitalize; }
.greet { font-size: var(--t-lg); font-weight: var(--fw-semi); letter-spacing: -.01em; }
.greet small { display: block; font-size: var(--t-sm); font-weight: var(--fw-regular); color: var(--c-text-2); }
.toolbar { display: flex; gap: var(--s-3); margin-bottom: var(--s-5); }
.search { position: relative; flex: 1; }
.search .ik { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); }
.search input { padding-left: 42px; border-radius: var(--r-pill); }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-text-3); font: var(--fw-semi) 11px/1 var(--f-mono); }

/* ---------- kafelki ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: var(--s-4); }
.tile { position: relative; display: flex; align-items: center; gap: var(--s-4); min-width: 0; min-height: 84px; padding: var(--s-4); border-radius: var(--r-lg);
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-1); color: var(--c-text); text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--c-border-strong); text-decoration: none; }
.tile.dragging { opacity: .45; }
.tile.drag-over { border-color: var(--c-accent); }
.tile-ic { position: relative; flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  background: var(--c-accent-soft); color: var(--c-accent);
  background: color-mix(in srgb, var(--tint, var(--c-accent)) 16%, transparent);
  color: color-mix(in srgb, var(--tint, var(--c-accent)) 82%, var(--c-text)); }
.tile-ic .ik { width: 24px; height: 24px; }
.tile-body { min-width: 0; flex: 1; }
.tile-name { display: flex; align-items: center; gap: var(--s-2); font-weight: var(--fw-semi); font-size: var(--t-md); line-height: var(--lh-tight); }
.tile-name b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tile-desc, .tile-url { display: block; font-size: var(--t-sm); color: var(--c-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tile-url { font-size: var(--t-xs); color: var(--c-text-3); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c-text-3); }
.dot.online { background: var(--c-ok); }
.dot.degraded { background: var(--c-warn); }
.dot.offline { background: var(--c-bad); }
.dot.checking { opacity: .45; }
.dot.online.puls { animation: puls 2.4s var(--ease) infinite; }
@keyframes puls { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-ok) 55%, transparent); } 60% { box-shadow: 0 0 0 6px transparent; } }
.tile-edit { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--c-text-3); cursor: pointer; opacity: 0; transition: opacity var(--dur) var(--ease); }
.tile:hover .tile-edit, .tile:focus-within .tile-edit { opacity: 1; }
.tile-edit:hover { background: var(--c-surface-2); color: var(--c-text); }
.tile-kbd { position: absolute; right: 10px; bottom: 10px; opacity: 0; transition: opacity var(--dur) var(--ease); }
body.skroty .tile-kbd { opacity: .9; }
@media (hover: none) { .tile-edit { opacity: 1; } body.skroty .tile-kbd, #skrotyInfo { display: none !important; } }

/* kafelek 2DR3 z zywymi danymi (pkt 1) - dwie kolumny na komputerze */
.tile.t2dr3 { grid-column: span 2; align-items: flex-start; }
.zywe { display: flex; flex-wrap: wrap; gap: 6px var(--s-2); margin-top: var(--s-2); }
.pigu { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: var(--r-pill); background: var(--c-surface-2);
  border: 1px solid var(--c-border); font-size: var(--t-xs); font-weight: var(--fw-semi); color: var(--c-text-2); white-space: nowrap; }
.pigu b { color: var(--c-text); font-weight: var(--fw-bold); }
.pigu .dot { width: 8px; height: 8px; }
.zywe-nota { width: 100%; font-size: var(--t-xs); color: var(--c-text-3); }

.empty { text-align: center; padding: var(--s-7) 0; color: var(--c-text-2); }
.podsum { margin-top: var(--s-5); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); justify-content: center; font-size: var(--t-sm); color: var(--c-text-2); }

/* ---------- stopka wydawcy: pelne logo Parseknas ZAWSZE NA DOLE (wersja wg motywu) ---------- */
footer.foot { border-top: 1px solid var(--c-border); background: color-mix(in srgb, var(--c-surface) 82%, transparent); }
.foot-in { max-width: 1240px; margin: 0 auto; padding: var(--s-4) 24px; display: flex; align-items: center; gap: var(--s-3) var(--s-5); flex-wrap: wrap; }
.powered { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--c-text-3); font-size: var(--t-xs); text-decoration: none; }
.pk-logo { height: 26px; width: auto; }
.logo-jasne { display: none; }
:root[data-theme="dark"] .logo-ciemne { display: none; }
:root[data-theme="dark"] .logo-jasne { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-ciemne { display: none; }
  :root:not([data-theme="light"]) .logo-jasne { display: inline; }
}
.foot-info { flex: 1; min-width: 0; font-size: var(--t-xs); color: var(--c-text-3); text-align: right; }
.motyw-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--c-border); border-radius: var(--r-pill);
  background: none; color: var(--c-text-2); cursor: pointer; }
.motyw-btn .ic-slonce, .motyw-btn .ic-ksiezyc, .motyw-btn .ic-auto { display: none; }
.motyw-btn[data-motyw-stan="light"] .ic-slonce, .motyw-btn[data-motyw-stan="dark"] .ic-ksiezyc, .motyw-btn[data-motyw-stan="system"] .ic-auto,
.motyw-btn:not([data-motyw-stan]) .ic-auto { display: block; }

/* ---------- okna (dodaj/edytuj, zdarzenia, ustawienia) ---------- */
.okno-tlo { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--s-5); background: var(--c-overlay); }
.okno { width: 100%; max-width: 480px; max-height: calc(100vh - 48px); overflow-y: auto; padding: var(--s-5); border-radius: var(--r-lg);
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-2); }
.okno.szerokie { max-width: 640px; }
.okno h2 { margin: 0 0 var(--s-4); font-size: var(--t-lg); }
.okno h3 { margin: var(--s-5) 0 var(--s-2); font-size: var(--t-base); }
.okno-akcje { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-5); }
.spacer { flex: 1; }
.row { display: grid; grid-template-columns: 1fr 110px; gap: var(--s-3); }
.lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lista li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-2) var(--s-3); align-items: start; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--c-surface-2); font-size: var(--t-sm); }
.lista li small { display: block; color: var(--c-text-3); font-size: var(--t-xs); }
.lista .ik { width: 18px; height: 18px; margin-top: 1px; }
.z-offline .ik, .z-cert_wygasa .ik { color: var(--c-bad); }
.z-online .ik, .z-cert_odnowiony .ik { color: var(--c-ok); }
.z-start .ik { color: var(--c-accent); }
.c-zle { color: var(--c-bad); font-weight: var(--fw-semi); }
.c-uwaga { color: var(--c-warn); font-weight: var(--fw-semi); }
.c-ok { color: var(--c-ok); font-weight: var(--fw-semi); }

/* ---------- pasek dolny (telefon, jak konto 2DR3) ---------- */
.dol { display: none; }

/* ---------- telefon (pkt 5): jedna kolumna, akcje w zasiegu kciuka ---------- */
@media (max-width: 640px) {
  .top-in { padding: 0 16px; min-height: 56px; }
  .brand small, .user, #logoutBtn .t { display: none; }
  .top-in { gap: 6px; }
  #logoutBtn { min-height: 40px; padding: 0 10px; }
  .alert-in { padding: 10px 16px; }
  main.dash { padding: var(--s-5) 16px calc(88px + env(safe-area-inset-bottom, 0px)); }
  .hero { margin-bottom: var(--s-4); }
  .toolbar #addBtn { display: none; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .tile.t2dr3 { grid-column: auto; }
  .tile { min-height: 72px; }
  .foot-in { padding: var(--s-4) 16px calc(var(--s-4) + 64px + env(safe-area-inset-bottom, 0px)); justify-content: center; }
  .foot-info { text-align: center; flex-basis: 100%; }
  .dol { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--c-surface); border-top: 1px solid var(--c-border); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dol button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
    border: 0; background: none; color: var(--c-text-2); font: inherit; font-size: var(--t-xs); font-weight: var(--fw-semi); cursor: pointer; }
  .dol button .ik { width: 22px; height: 22px; }
  .dol button:active { color: var(--c-accent); }
  .dol .licznik { top: 6px; right: calc(50% - 22px); }
  .okno-tlo { align-items: end; padding: 0; }
  .okno { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 88vh; padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- logowanie / wylogowanie (ten sam wyglad, znak strony, logo Parseknas na dole) ---------- */
body.wejscie main.wejscie-in { flex: 1; display: grid; place-items: center; padding: var(--s-6) 16px; }
.karta-wejscia { width: 100%; max-width: 420px; padding: var(--s-6) var(--s-5) var(--s-5); border-radius: var(--r-lg); text-align: center;
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-2); }
.karta-wejscia > img { width: 56px; height: 56px; margin: 0 auto var(--s-3); display: block; }
.karta-wejscia h1 { margin: 0; font-size: var(--t-xl); letter-spacing: -.01em; }
.karta-wejscia .muted { margin: 4px 0 var(--s-5); }
.karta-wejscia .btn { width: 100%; min-height: 48px; font-size: var(--t-base); margin-bottom: var(--s-2); }
.karta-wejscia ol { text-align: left; color: var(--c-text-2); font-size: var(--t-sm); padding-left: 20px; margin: 0 0 var(--s-4); }
.karta-wejscia .lewo { text-align: left; color: var(--c-text-2); font-size: var(--t-sm); margin: 0 0 var(--s-3); }
.link-cichy { display: inline-block; margin-top: var(--s-2); color: var(--c-text-2); font-size: var(--t-sm); text-decoration: none; }
.link-cichy:hover { color: var(--c-text); text-decoration: underline; }
.drobne { margin: var(--s-4) 0 0; font-size: var(--t-xs); color: var(--c-text-3); }

/* ---------- grupy kafelkow (pkt 4): Produkcja / Narzedzia / Kopie / Makiety + Ostatnio uzywane ---------- */
.grupa { margin-bottom: var(--s-5); }
.grupa-h { margin: 0 0 var(--s-2); font-size: inherit; }
.grupa-h button { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 0 var(--s-2) 0 0; border: 0; background: none;
  color: var(--c-text-2); font: inherit; font-size: var(--t-xs); font-weight: var(--fw-semi); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.grupa-h button::before { content: "\25be"; font-size: 12px; transition: transform var(--dur) var(--ease); }
.grupa.zwinieta .grupa-h button::before { transform: rotate(-90deg); }
.grupa.zwinieta > .grid { display: none; }
.grupa-h .ile { color: var(--c-text-3); font-weight: var(--fw-regular); letter-spacing: 0; text-transform: none; }
.pusta { grid-column: 1 / -1; display: grid; place-items: center; min-height: 64px; border: 1.5px dashed var(--c-border); border-radius: var(--r-lg);
  color: var(--c-text-3); font-size: var(--t-sm); }
.grid.cel { outline: 2px dashed var(--c-accent); outline-offset: 6px; border-radius: var(--r-lg); }
.tile.mini { min-height: 56px; padding: var(--s-2) var(--s-3); gap: var(--s-3); }
.tile.mini .tile-ic { flex-basis: 36px; width: 36px; height: 36px; border-radius: 10px; }
.tile.mini .tile-ic .ik { width: 20px; height: 20px; }
.tile.mini .tile-ic img { width: 22px; height: 22px; }
.tile.mini .tile-name { font-size: var(--t-base); }
.ostatnie > .grid { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: var(--s-3); }
@media (max-width: 640px) { .ostatnie > .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
