/* Kamienica — powloka: scena (telefon/ramka/panel), chrome urzadzenia, warstwy (arkusze, toasty, push). */

html, body { height: 100%; }
body { background: var(--stage-bg); overflow: hidden; }
.stage { position: relative; height: 100%; }

/* ---------- urzadzenie (#app w ramce albo na calym ekranie) ---------- */
.app {
  --sb-h: 0px;
  --db-h: 0px;
  --ab-h: 56px;
  --tb-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --view-top: calc(var(--sb-h) + var(--safe-t) + var(--db-h) + var(--ab-h));
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--bg); color: var(--ink);
  container-type: inline-size;
}
.app.is-framed { --sb-h: 48px; --safe-t: 0px; --safe-b: 18px; width: 390px; height: 844px; border-radius: 46px; }
.app.has-demobar { --db-h: 44px; }
.in-artifact .app { --safe-t: 0px; }
.in-artifact .app:not(.is-framed) { --safe-b: 0px; }

/* pasek statusu w ramce (dekoracyjny) */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--sb-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 38px;
  font-size: 15px; font-weight: 800; color: var(--ink); pointer-events: none;
}
.app:not(.is-framed) .statusbar { display: none; }
.sb-island { position: absolute; top: 11px; left: 50%; width: 118px; height: 33px; margin-left: -59px; border-radius: 20px; background: #000000; }
.sb-icons { display: flex; align-items: center; gap: 6px; }

/* pasek demo (tylko na telefonie) */
.demobar {
  position: absolute; left: 0; right: 0; top: calc(var(--sb-h) + var(--safe-t)); height: var(--db-h); z-index: 14;
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.app:not(.has-demobar) .demobar { display: none; }
.demo-tag {
  flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; padding: 4px 7px; border-radius: 7px;
  background: var(--ink); color: var(--surface);
}
.demobar .seg { flex: 1 1 auto; padding: 2px; }
.demobar .seg > button { min-height: 30px; font-size: 13px; }
.demobar-help {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink); font-weight: 800;
}

/* pasek aplikacji */
.appbar {
  position: absolute; left: 0; right: 0; top: calc(var(--sb-h) + var(--safe-t) + var(--db-h)); height: var(--ab-h); z-index: 12;
  display: flex; align-items: center; gap: 2px; padding: 0 6px 0 16px;
  background: var(--bg); transition: box-shadow .2s ease, background-color .2s ease;
}
.app:not(.is-framed):not(.has-demobar) .appbar { box-shadow: 0 calc(-1 * var(--safe-t)) 0 var(--bg); }
.appbar.is-scrolled { box-shadow: 0 1px 0 var(--line); }
.appbar.has-back { padding-left: 4px; }
.ab-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ab-title { font-size: 21px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar.has-back .ab-title { font-size: 17px; }
.ab-sub { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-actions { display: flex; align-items: center; gap: 0; flex: none; }
.ab-avatar { width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; }
.ab-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; text-align: left; border-radius: 12px; }
.ab-brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-brand-sub { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.ab-brand .icon-chev { color: var(--muted); }

/* tresc ekranu */
.view {
  position: absolute; left: 0; right: 0; bottom: 0; top: var(--view-top);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }
.screen {
  display: flex; flex-direction: column; gap: 20px;
  padding: 6px 16px calc(var(--tb-h) + var(--safe-b) + 28px);
  min-height: 100%;
}
.app.has-dock .screen { padding-bottom: calc(var(--tb-h) + var(--safe-b) + var(--dock-h, 76px) + 24px); }
.screen.is-enter { animation: fade-up .2s ease-out; }
.screen-tight { gap: 14px; }

/* dok nad nawigacja (pole wiadomosci, akcja glowna) */
.dock {
  position: absolute; left: 0; right: 0; bottom: calc(var(--tb-h) + var(--safe-b)); z-index: 11;
  padding: 10px 16px; background: var(--glass); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.dock-row { display: flex; align-items: flex-end; gap: 8px; }
.dock .input { min-height: 44px; padding: 10px 14px; border-radius: 22px; }
.dock-send { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.dock-send:disabled { background: var(--surface-3); color: var(--muted); }

/* dolna nawigacja */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 12;
  height: calc(var(--tb-h) + var(--safe-b)); padding: 5px 4px var(--safe-b);
  display: flex; align-items: stretch;
  background: var(--glass); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
}
.tab {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: -0.005em;
  -webkit-tap-highlight-color: transparent;
}
.tab-ic { position: relative; width: 52px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background-color .18s ease; }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab[aria-current="page"] .tab-ic { background: var(--accent-soft); }
.tab .badge { top: -3px; right: 6px; box-shadow: 0 0 0 2px var(--surface); }
.tab .badge-dot { top: 2px; right: 13px; }
.tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- warstwy: push, arkusze, toasty ---------- */
.layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.pushes {
  position: absolute; top: calc(var(--sb-h) + var(--safe-t) + 6px); left: 8px; right: 8px; z-index: 3;
  display: flex; flex-direction: column; gap: 8px;
}
.push {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 11px; width: 100%; padding: 12px 14px;
  border-radius: 22px; background: var(--push-bg); color: var(--ink); text-align: left;
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: var(--shadow-2); border: 1px solid var(--line);
  animation: push-in .45s cubic-bezier(.2, .9, .25, 1.12);
}
.push.is-urgent { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger), var(--shadow-2); }
.push.is-out { transform: translateY(-130%); opacity: 0; transition: transform .3s ease-in, opacity .3s ease-in; }
@keyframes push-in { from { transform: translateY(-130%); opacity: 0; } to { transform: none; opacity: 1; } }
.push-mark { flex: none; margin-top: 2px; }
.push-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.push-app { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.push-title { font-size: 15px; font-weight: 800; line-height: 1.3; }
.push-text { font-size: 14px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.push-more { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-top: 2px; }

.sheets { position: absolute; inset: 0; z-index: 2; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .22s ease; pointer-events: auto; }
.scrim.is-open { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; pointer-events: auto;
  max-height: calc(100% - var(--sb-h) - var(--safe-t) - 20px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-2);
  padding-bottom: var(--safe-b);
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.sheet.is-open { transform: none; }
.sheet-grab { flex: none; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; }
.sheet-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 4px 8px 0 20px; }
.sheet-title { flex: 1 1 auto; min-width: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 20px 14px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1 1 0; }

.toasts {
  position: absolute; left: 16px; right: 16px; z-index: 4;
  bottom: calc(var(--tb-h) + var(--safe-b) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.app.has-dock .toasts { bottom: calc(var(--tb-h) + var(--safe-b) + var(--dock-h, 76px) + 12px); }
.app.has-sheet .toasts { top: calc(var(--sb-h) + var(--safe-t) + 10px); bottom: auto; }
.app.has-sheet .toast { animation-name: fade-in; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 12px 16px; border-radius: 16px; background: var(--toast-bg); color: var(--toast-ink);
  font-size: 14.5px; font-weight: 700; line-height: 1.35; box-shadow: var(--shadow-2);
  animation: fade-up .2s ease-out;
}
.toast .icon { flex: none; }
.toast.t-ok .icon { color: var(--ok); }
.toast.t-danger .icon { color: var(--danger); }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }

/* ---------- ekran powitalny (telefon) ---------- */
.welcome {
  position: absolute; inset: 0; z-index: 60; pointer-events: auto; overflow-y: auto;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 22px;
  padding: calc(var(--safe-t) + 36px) 22px calc(var(--safe-b) + 24px);
  animation: fade-in .2s ease-out;
}
.welcome.is-out { opacity: 0; transition: opacity .2s ease; }
.welcome-hero { display: flex; flex-direction: column; gap: 14px; }
.welcome-title { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.welcome-text { font-size: 16px; color: var(--ink-2); max-width: 34ch; }
.welcome-roles { display: flex; flex-direction: column; gap: 10px; }
.role-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left;
  border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.role-card:active { background: var(--surface-2); }
.role-card-title { display: block; font-size: 17px; font-weight: 800; }
.role-card-sub { display: block; font-size: 13.5px; color: var(--muted); }
.welcome-note { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }

/* ---------- scena na komputerze: ramki telefonow + panel ---------- */
.stage.is-framed {
  display: flex; align-items: center; justify-content: center; gap: 40px;
  padding: 24px 32px; overflow: auto;
  background: radial-gradient(1100px 760px at 32% 18%, var(--stage-glow), var(--stage-bg));
}
.phones { display: flex; align-items: flex-start; gap: 36px; flex: none; }
.phone { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; zoom: var(--z, 1); }
.frame {
  padding: 12px; border-radius: 58px; background: var(--bezel);
  box-shadow: 0 0 0 1.5px var(--bezel-edge), 0 40px 80px rgba(10, 12, 30, .26), 0 12px 24px rgba(10, 12, 30, .16);
}
.phone-cap { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 6px 4px 4px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.phone-cap-role { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.phone[data-role="manager"] .phone-cap-role { background: var(--ink); color: var(--surface); }
.phone-cap-name { font-size: 13.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.phone-cap .btn { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 14px; }

.panel {
  width: 356px; flex: none; align-self: center; max-height: calc(100dvh - 48px); overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 20px; padding: 24px;
  background: var(--surface); color: var(--ink); border-radius: 28px; border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.panel-brand { display: flex; align-items: center; gap: 14px; }
.panel-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.panel-tag { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.panel-text { font-size: 14.5px; color: var(--ink-2); }
.panel-block { display: flex; flex-direction: column; gap: 10px; }
.panel-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-label .count { letter-spacing: 0; text-transform: none; font-size: 12.5px; color: var(--accent-text); }
.panel hr { border: 0; height: 1px; background: var(--line); margin: 0; }

.guide { display: flex; flex-direction: column; gap: 2px; }
.guide-step { display: flex; align-items: flex-start; gap: 11px; padding: 9px 8px; border-radius: 14px; }
.guide-step.is-next { background: var(--surface-2); }
.guide-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px;
  box-shadow: inset 0 0 0 2px var(--line-2); color: transparent; font-size: 12px; font-weight: 800;
}
.guide-step.is-done .guide-check { background: var(--ok); box-shadow: none; color: #FFFFFF; animation: pop-in .35s ease-out; }
.guide-step.is-next .guide-check { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-text); }
.guide-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.guide-title { font-size: 14px; font-weight: 800; line-height: 1.3; }
.guide-step.is-done .guide-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.guide-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.guide-go { flex: none; align-self: center; }
.guide-done { padding: 14px; border-radius: 16px; background: var(--ok-soft); color: var(--ok-text); font-weight: 700; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }

.qr-row { display: flex; align-items: center; gap: 14px; }
.qr-box { flex: none; width: 112px; height: 112px; border-radius: 14px; background: #FFFFFF; padding: 8px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.credit { font-size: 12.5px; color: var(--muted); font-weight: 600; text-align: center; }
.credit a { color: var(--ink-2); font-weight: 800; text-decoration: none; }
.credit a:hover { text-decoration: underline; }

/* okno modalne na komputerze (formularz kontaktu) */
.modal-layer {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: var(--scrim); animation: fade-in .18s ease-out;
}
.modal {
  width: min(500px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--surface); color: var(--ink); border-radius: 26px; box-shadow: var(--shadow-2); border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.modal .sheet-body { overflow: visible; }

@media (max-width: 899px) {
  body { overflow: hidden; background: var(--bg); }
  .stage { height: 100dvh; }
  .in-artifact .stage { height: 100%; }
  .stage > .app { width: 100%; height: 100%; }
}
