/* ===== Układ aplikacji: splash, logowanie, pasek boczny, topbar, nawigacja mobilna ===== */
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; filter: drop-shadow(0 6px 14px hsl(var(--ah) 80% 60% / .35)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }

/* ---- splash ---- */
.splash { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bg); padding: 24px;
  background-image: radial-gradient(600px 400px at 50% 30%, hsl(var(--ah) 80% 60% / .13), transparent 70%); }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; max-width: 360px; }
.splash-logo { width: 64px; height: 64px; filter: drop-shadow(0 12px 30px hsl(var(--ah) 80% 60% / .5)); animation: float 3s ease-in-out infinite; }
.splash-logo svg { width: 100%; height: 100%; }
.splash-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.splash-msg { color: var(--text-2); }
.splash-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.splash-actions:empty { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---- logowanie ---- */
.auth-root { position: fixed; inset: 0; z-index: 80; overflow-y: auto; background: var(--bg); }
.auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 56px clamp(32px, 5vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 22px;
  background: radial-gradient(900px 520px at 10% 0%, hsl(var(--ah) 85% 55% / .28), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(62, 198, 255, .18), transparent 60%), var(--bg-2);
  border-right: 1px solid var(--line); }
.auth-brand { display: flex; align-items: center; gap: 12px; position: absolute; top: 36px; left: clamp(32px, 5vw, 80px); }
.auth-headline { font-size: clamp(32px, 3.6vw, 52px); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; margin-top: 40px; }
.auth-lead { font-size: 17px; color: var(--text-2); max-width: 520px; }
.auth-features { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 14px; max-width: 520px; }
.auth-features li { display: flex; gap: 14px; align-items: flex-start; }
.auth-features b { display: block; font-weight: 650; }
.auth-features span:not(.af-ico) { color: var(--text-3); font-size: 13.5px; }
.af-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.auth-preview { margin-top: 12px; max-width: 420px; transform: rotate(-2deg); }
.ap-card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 16px; box-shadow: var(--shadow-lg); display: grid; gap: 10px; }
.ap-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--card-2); }
.ap-row i { width: 36px; height: 36px; border-radius: 12px; background: hsl(var(--h) 72% 60% / .25); border: 2px solid hsl(var(--h) 72% 60%); flex: none; }
.ap-row div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.ap-row span { color: var(--text-3); font-size: 12.5px; }
.ap-row em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 2px 9px; border-radius: 999px; }
.ap-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-kpi div { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.ap-kpi span { font-size: 12px; color: var(--text-3); } .ap-kpi b { font-size: 20px; letter-spacing: -.02em; }

.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 410px; display: flex; flex-direction: column; }
.auth-card-brand { display: none; margin-bottom: 18px; }
.auth-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.auth-sub { color: var(--text-2); margin: 6px 0 24px; }
.auth-msg { min-height: 20px; margin-bottom: 12px; font-size: 13.5px; }
.auth-msg.err { color: var(--danger); } .auth-msg.ok { color: var(--good); }
.auth-links { text-align: center; margin-top: 14px; }
.auth-or { display: flex; align-items: center; gap: 14px; color: var(--text-3); font-size: 12.5px; margin: 20px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.g-mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.auth-switch { text-align: center; margin-top: 22px; color: var(--text-2); }
.auth-demo { margin-top: 20px; padding: 13px; border-radius: var(--r); border: 1px dashed var(--line-2); color: var(--text-2); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s; }
.auth-demo:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
@media (max-width: 960px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-card-brand { display: block; } .auth-card-brand .brand-mark { width: 48px; height: 48px; } }

/* ---- powłoka aplikacji ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--bg-2); }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.sb-search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px; margin-bottom: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--text-3); transition: all .15s; }
.sb-search:hover { border-color: var(--line-2); color: var(--text-2); }
.sb-search span { flex: 1; text-align: left; }
.sb-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; font-weight: 550; color: var(--text-2); transition: background .15s, color .15s; }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--warn); color: #231700; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); text-align: left; color: var(--text-3); transition: border-color .15s; }
.sb-user:hover { border-color: var(--line-2); }
.sb-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb-user-text b { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 clamp(14px, 3vw, 32px); background: var(--glass); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid var(--line); }
.tb-brand, .tb-title, .tb-search { display: none; }
.tb-title { font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.tb-spacer { flex: 1; }
.tb-avatar { display: none; }
.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; } :root[data-theme="dark"] .ico-moon { display: none; }
.sync-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 550; color: var(--text-3); padding: 5px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.sync-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.sync-chip[data-state="saving"] .dot { background: var(--warn); animation: pulse 1s infinite; }
.sync-chip[data-state="offline"] .dot { background: var(--text-3); }
.sync-chip[data-state="error"] { color: var(--danger); } .sync-chip[data-state="error"] .dot { background: var(--danger); }
.sync-chip[data-state="local"] .dot { background: var(--info); }
@keyframes pulse { 50% { opacity: .35; } }
#main { flex: 1; min-width: 0; }
.view-enter { animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bottom-nav { display: none; }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tb-brand { display: inline-grid; margin-right: 4px; } .tb-brand .brand-mark { width: 30px; height: 30px; }
  .tb-title { display: block; }
  .tb-search { display: inline-grid; }
  .tb-avatar { display: inline-grid; }
  .tb-add span { display: none; } .tb-add { width: 36px; padding: 0; }
  .sync-chip span { display: none; } .sync-chip { padding: 8px; }
  .sync-chip[data-state="error"] span, .sync-chip[data-state="offline"] span { display: inline; }
  #main { padding-bottom: calc(76px + var(--safe-b)); }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b)); background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--line); }
  .bn-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; border-radius: 14px; font-size: 11px; font-weight: 600; color: var(--text-3); transition: color .15s; text-align: center; }
  .bn-item.active { color: var(--accent-text); }
  .bn-item.active svg { transform: translateY(-1px); }
  .bn-item.active::after { content: ""; position: absolute; top: 2px; width: 22px; height: 3px; border-radius: 3px; background: var(--accent); }
  .bn-item .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 17px; height: 17px; font-size: 10px; }
  .toast-host { bottom: calc(86px + var(--safe-b)) !important; }
}
.avatar.me { background: linear-gradient(135deg, var(--accent-hi), #3ec6ff); color: #fff; border: 0; }
.tb-avatar { padding: 0; border-radius: 50%; }
