/* Project Hub — dark, premium, mobile-first. Bez frameworka; brak stylów inline (CSP). */

:root {
  --bg: #090b12;
  --bg-2: #0e111b;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-solid: #121522;
  --card: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e9ebf2;
  --text-2: #a4abbd;
  --text-3: #6c7489;
  --accent: #8b7cff;
  --accent-2: #c06cff;
  --accent-soft: rgba(139, 124, 255, 0.14);
  --violet: #9b7bff;
  --blue: #5b8cff;
  --cyan: #38d0f0;
  --green: #3ecf8e;
  --grad: linear-gradient(135deg, #7a85ff 0%, #a56cff 55%, #d46cf0 100%);
  --grad-cool: linear-gradient(90deg, #6d7cff 0%, #4fb3ff 55%, #38d0f0 100%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --a1: #8b7cff; --a2: #c06cff; --a-rgb: 139, 124, 255; /* domyślny akcent (nadpisywany klasami acc-*) */
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.12);
  --warn: #f5b041;
  --warn-soft: rgba(245, 176, 65, 0.12);
  --danger: #f25f7a;
  --danger-soft: rgba(242, 95, 122, 0.12);
  --info: #5aa9ff;
  --info-soft: rgba(90, 169, 255, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --sidebar: 232px;
  --bottom-nav: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 20% -12%, rgba(110, 120, 255, 0.11), transparent 62%),
    radial-gradient(800px 460px at 100% -5%, rgba(56, 208, 240, 0.06), transparent 60%),
    radial-gradient(700px 500px at 85% 110%, rgba(165, 108, 255, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
p { margin: 0; }
.num, .stat-value, .pct { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.94); } }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }
.sidebar { display: none; }
.main { padding: 16px 16px calc(var(--bottom-nav) + var(--safe-bottom) + 28px); max-width: 1640px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: rgba(11, 13, 18, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 650; font-size: 17px; flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: url("../icons/icon.svg") center / cover no-repeat; flex: none; }

/* Dolna nawigacja (mobile): Home | Projekty | + | Zadania | Więcej */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--bottom-nav) + var(--safe-bottom));
  padding: 0 4px var(--safe-bottom);
  background: rgba(12, 14, 22, 0.86);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 100%; font-size: 11px; font-weight: 560; color: var(--text-3);
  transition: color 0.18s var(--ease);
}
.bottom-nav a .icon { width: 22px; height: 22px; transition: transform 0.18s var(--ease); }
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active .icon { color: var(--accent); transform: translateY(-1px); }
.bottom-nav a.active::before { content: ""; position: absolute; top: 0; width: 22px; height: 2px; border-radius: 0 0 2px 2px; background: var(--grad); }
.nav-fab {
  justify-self: center;
  width: 50px; height: 50px; margin-top: -18px; border: 0; border-radius: 16px;
  display: grid; place-items: center; color: #fff; cursor: pointer;
  background: var(--grad);
  box-shadow: 0 10px 26px -8px rgba(140, 110, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.nav-fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.nav-fab:active { transform: scale(0.94); }

@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .bottom-nav, .topbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh;
    padding: 18px 12px 16px;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(110, 120, 255, 0.05), rgba(255, 255, 255, 0.01) 40%, rgba(255, 255, 255, 0.01));
  }
  .sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 22px; }
  .sidebar-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 18px -6px rgba(140, 110, 255, 0.7); }
  .sidebar-brand .name { font-weight: 720; font-size: 15.5px; letter-spacing: -0.02em; line-height: 1.15; }
  .sidebar-brand .tag { font-size: 11px; color: var(--text-3); font-weight: 560; letter-spacing: 0.04em; }
  .nav-label { font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding: 4px 12px 8px; }
  .nav-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 560; font-size: 14px;
    transition: background 0.18s var(--ease), color 0.18s var(--ease);
  }
  .nav-link:hover { background: var(--surface); color: var(--text); }
  .nav-link.active { background: linear-gradient(90deg, rgba(139, 124, 255, 0.16), rgba(139, 124, 255, 0.04)); color: var(--text); }
  .nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
  .nav-link.active .icon { color: var(--accent); }
  .sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
  .user-chip { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
  .avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--grad-cool); }
  .version { font-size: 11px; color: var(--text-3); padding: 0 8px; font-variant-numeric: tabular-nums; }
  .main { padding: 30px 32px 64px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; font-size: 14px; }
@media (max-width: 959px) { .page-head h1 { font-size: 22px; } .page-head.desktop-only { display: none; } }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; color: var(--text-2); font-weight: 600; letter-spacing: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; line-height: 1.1; }
.stat-value small { font-size: 15px; color: var(--text-3); font-weight: 600; margin-left: 2px; }
.stat.warn .stat-value { color: var(--warn); }

/* ---------- Akcenty kolorów projektów (klasy — CSP blokuje inline style) ---------- */
.acc-violet { --a1: #9b7bff; --a2: #c56cf5; --a-rgb: 155, 123, 255; }
.acc-blue   { --a1: #5b8cff; --a2: #7a6cff; --a-rgb: 91, 140, 255; }
.acc-cyan   { --a1: #38d0f0; --a2: #4f8dff; --a-rgb: 56, 208, 240; }
.acc-green  { --a1: #3ecf8e; --a2: #2fb3c9; --a-rgb: 62, 207, 142; }
.acc-amber  { --a1: #f5b041; --a2: #f07a5a; --a-rgb: 245, 176, 65; }
.acc-pink   { --a1: #f06cb4; --a2: #a56cff; --a-rgb: 240, 108, 180; }

/* ---------- Dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 22px; }
.dash-main, .dash-side { display: contents; }
.o-head { order: 0; } .o-ai { order: 2; } .o-recs { order: 3; } .o-projects { order: 4; } .o-activity { order: 5; } .o-devices { order: 6; }
@media (min-width: 1180px) {
  .dash { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px 26px; }
  .o-head { grid-column: 1 / -1; }
  .dash-main, .dash-side { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
  .dash-side { position: sticky; top: 24px; gap: 20px; }
}

.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 24px; }
.greeting h1 { font-size: 28px; font-weight: 720; letter-spacing: -0.03em; }
.greeting p { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi {
  min-width: 118px; padding: 12px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
}
.kpi-label { font-size: 11.5px; color: var(--text-2); font-weight: 560; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.kpi-label .icon { width: 14px; height: 14px; }
.kpi-value { font-size: 24px; font-weight: 720; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; color: var(--text-3); margin-left: 1px; }
.kpi .bar { margin-top: 8px; height: 4px; }
.kpi.k-active .icon { color: var(--violet); } .kpi.k-paused .icon { color: var(--warn); }
.kpi.k-done .icon { color: var(--green); } .kpi.k-progress .icon { color: var(--cyan); }
.kpi.k-progress { background: linear-gradient(135deg, rgba(56, 208, 240, 0.09), rgba(110, 120, 255, 0.06)); border-color: rgba(56, 208, 240, 0.2); }
.kpi.k-progress .bar > span { background: var(--grad-cool); }
@media (max-width: 760px) {
  .greeting h1 { font-size: 23px; }
  .dash-head { align-items: stretch; }
  .kpis { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi-value { font-size: 21px; }
  .kpi { min-width: 0; }
  .kpi.k-progress { grid-column: 1 / -1; order: -1; }
  .kpi.k-progress .kpi-value { font-size: 30px; }
}
@media (max-width: 400px) { .kpi:not(.k-progress) .kpi-label .icon { display: none; } }

.panel-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; color: var(--text); margin-bottom: 10px; }
.panel-title .icon { color: var(--accent); }
.panel-title .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 560; }
.panel-title a { margin-left: auto; font-size: 12.5px; color: var(--text-2); font-weight: 560; }
.panel-title a:hover { color: var(--text); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .chip-row { flex: 1; min-width: 0; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.18s var(--ease), color 0.18s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, 0.09); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.seg button .count { margin-left: 5px; color: var(--text-3); font-weight: 560; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.sort select.input { min-height: 34px; height: 34px; padding: 4px 32px 4px 10px; font-size: 13px; width: auto; background-color: rgba(255, 255, 255, 0.04); }
.toolbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
@media (max-width: 640px) {
  .toolbar-end { margin-left: 0; width: 100%; justify-content: space-between; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg button { text-align: center; }
}

/* Siatka projektów: maks. 3 kolumny, min. ~264 px na kartę */
.grid-projects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(236px, calc((100% - 32px) / 3))), 1fr)); }

/* Karta projektu */
.pcard {
  container-type: inline-size;
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 18px 16px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.pcard::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(420px 160px at 0% 0%, rgba(var(--a-rgb), 0.13), transparent 70%);
}
.pcard::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--a1), var(--a2)); opacity: 0.85; }
.pcard:hover { transform: translateY(-2px); border-color: rgba(var(--a-rgb), 0.38); box-shadow: 0 18px 40px -22px rgba(var(--a-rgb), 0.55), var(--shadow); }
.pcard:active { transform: translateY(0) scale(0.995); }
.pcard:focus-visible { outline-offset: 3px; border-radius: 18px; }
.pcard.done::after { background: linear-gradient(90deg, var(--green), #2fb3c9); }
.pcard-head { display: flex; align-items: flex-start; gap: 12px; }
.pcard-title { flex: 1; min-width: 0; }
.pcard-name { font-weight: 680; font-size: 16.5px; letter-spacing: -0.015em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.pcard-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-height: 2.9em; }
.pcard-desc.none { color: var(--text-3); font-style: italic; }
.pcard-progress { display: flex; align-items: flex-end; gap: 12px; }
.pcard-pct { font-size: 34px; font-weight: 760; letter-spacing: -0.045em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.pcard-pct small { font-size: 15px; color: var(--text-3); font-weight: 650; margin-left: 1px; }
.pcard-progress .bar { flex: 1; height: 8px; margin-bottom: 5px; }
.pcard .bar > span { background: linear-gradient(90deg, var(--a1), var(--a2)); box-shadow: 0 0 12px rgba(var(--a-rgb), 0.45); }
.pcard.done .bar > span { background: linear-gradient(90deg, #2fb67c, var(--green)); }
.pcard-stages { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); border: 1px solid rgba(255, 255, 255, 0.04); }
@container (max-width: 250px) { .pcard-stages { grid-template-columns: 1fr; } }
.kv-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 650; display: flex; align-items: center; gap: 5px; }
.kv-label .icon { width: 12px; height: 12px; }
.kv-value { font-size: 13.5px; margin-top: 3px; font-weight: 540; overflow-wrap: anywhere; line-height: 1.35; }
.kv-value.none { color: var(--text-3); font-weight: 450; }
.pcard-alert { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--warn); line-height: 1.4; overflow-wrap: anywhere; }
.pcard-alert .icon { width: 14px; height: 14px; margin-top: 2px; }
.pcard-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12.5px; color: var(--text-2); padding-top: 12px; border-top: 1px solid var(--border); margin-top: auto; }
.pcard-foot .item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pcard-foot .item .icon { color: var(--text-3); }
.pcard-foot .pill { margin-left: auto; }
@container (max-width: 250px) { .pcard-foot .pill { margin-left: 0; } }

.picon {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  font-size: 21px; font-weight: 750; letter-spacing: -0.02em; color: #fff;
  background: linear-gradient(135deg, rgba(var(--a-rgb), 0.32), rgba(var(--a-rgb), 0.1));
  border: 1px solid rgba(var(--a-rgb), 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.picon.text { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; font-size: 15px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.picon.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
.picon.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; }
.picon.text { font-size: 15px; }

/* Progress */
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar.thin { height: 5px; }
.bar.thick { height: 10px; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 0.5s cubic-bezier(.2,.8,.2,1); }
.bar.ok > span { background: linear-gradient(90deg, #2fb67c, var(--ok)); }
.bar.muted > span { background: rgba(255, 255, 255, 0.25); }

/* Pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.in_progress { color: #b3a9ff; background: var(--accent-soft); border-color: rgba(139, 124, 255, 0.25); }
.pill.testing, .pill.waiting { color: var(--info); background: var(--info-soft); border-color: rgba(90, 169, 255, 0.22); }
.pill.ready, .pill.completed, .pill.ok, .pill.done { color: var(--ok); background: var(--ok-soft); border-color: rgba(62, 207, 142, 0.22); }
.pill.paused, .pill.planned, .pill.todo, .pill.low { color: var(--text-2); }
.pill.warning, .pill.high { color: var(--warn); background: var(--warn-soft); border-color: rgba(245, 176, 65, 0.25); }
.pill.blocked, .pill.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(242, 95, 122, 0.25); }
.pill.unknown { color: var(--text-3); }
.pill.demo { color: #f0b3ff; background: rgba(212, 108, 240, 0.12); border-color: rgba(212, 108, 240, 0.3); font-size: 10.5px; letter-spacing: 0.08em; padding: 2px 7px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px; border-radius: 99px; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
}
.chip.on { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.chip .count { color: var(--text-3); margin-left: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { border: 0; background: var(--grad); color: #fff; box-shadow: 0 8px 24px -10px rgba(140, 110, 255, 0.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon-only { width: 38px; padding: 0; }
.btn.sm.icon-only { width: 32px; }
.btn.block { width: 100%; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
a.list-item:hover, .list-item.clickable:hover { background: var(--surface); cursor: pointer; }

.empty { padding: 28px 18px; text-align: center; color: var(--text-3); font-size: 14px; }
.empty .icon { width: 28px; height: 28px; margin-bottom: 8px; opacity: 0.7; }

/* Panele prawej kolumny */
.panel { padding: 6px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 9px; padding: 10px 10px 8px; font-size: 13.5px; font-weight: 660; }
.panel-head .icon { width: 16px; height: 16px; color: var(--accent); }
.panel-head .hint { margin-left: auto; font-size: 11.5px; font-weight: 540; color: var(--text-3); }
.panel .empty { padding: 16px 12px 18px; font-size: 13px; }

/* AI usage */
.ai-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; }
.ai-row + .ai-row { margin-top: 2px; }
.ai-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: 14px; flex: none; }
.ai-logo.claude { background: linear-gradient(135deg, rgba(232, 128, 92, 0.28), rgba(232, 128, 92, 0.1)); color: #f0a07e; border: 1px solid rgba(232, 128, 92, 0.3); }
.ai-logo.cursor { background: linear-gradient(135deg, rgba(56, 208, 240, 0.2), rgba(91, 140, 255, 0.1)); color: #9fe3f5; border: 1px solid rgba(56, 208, 240, 0.25); }
.ai-name { font-size: 13.5px; font-weight: 620; display: flex; justify-content: space-between; gap: 8px; }
.ai-name .num { font-weight: 700; }
.ai-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ai-row .bar { height: 5px; margin-top: 6px; }
.ai-row .bar > span { background: var(--grad-cool); }
.ai-row .bar.hot > span { background: linear-gradient(90deg, var(--warn), var(--danger)); }

/* Rekomendacje */
.rec { display: flex; gap: 11px; align-items: flex-start; padding: 10px; border-radius: 12px; cursor: pointer; transition: background 0.18s var(--ease); }
.rec:hover { background: rgba(255, 255, 255, 0.045); }
.rec-icon { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.rec-icon .icon { width: 15px; height: 15px; }
.rec-icon.accent { background: var(--accent-soft); color: #b9b0ff; }
.rec-icon.warn { background: var(--warn-soft); color: var(--warn); }
.rec-icon.info { background: rgba(56, 208, 240, 0.12); color: var(--cyan); }
.rec-title { font-size: 13.5px; font-weight: 620; line-height: 1.35; overflow-wrap: anywhere; }
.rec-reason { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.4; overflow-wrap: anywhere; }
.rec .chev { margin-left: auto; color: var(--text-3); opacity: 0; transition: opacity 0.18s var(--ease), transform 0.18s var(--ease); }
.rec:hover .chev { opacity: 1; transform: translateX(2px); }

/* Komputery */
.dev-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; transition: background 0.18s var(--ease); }
.dev-row:hover { background: rgba(255, 255, 255, 0.045); }
.dev-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--text-2); position: relative; }
.dev-icon .dev-dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--bg); }
.dev-name { font-size: 13.5px; font-weight: 640; }
.dev-sub { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.dev-state { margin-left: auto; font-size: 11.5px; font-weight: 620; white-space: nowrap; }
.dev-state.on { color: var(--green); } .dev-state.off { color: var(--text-3); }
.dev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.dev-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* Oś aktywności */
.timeline { display: flex; flex-direction: column; padding: 6px 4px; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 9px 12px; font-size: 13.5px; border-radius: 12px; }
.tl-item:not(:last-child)::after { content: ""; position: absolute; left: 27px; top: 40px; bottom: -6px; width: 1px; background: var(--border); }
.tl-icon { width: 31px; height: 31px; border-radius: 10px; flex: 0 0 31px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--border); color: var(--text-2); }
.tl-icon .icon { width: 15px; height: 15px; }
.tl-icon.git { color: var(--green); background: var(--ok-soft); border-color: rgba(62, 207, 142, 0.22); }
.tl-icon.task { color: var(--cyan); background: rgba(56, 208, 240, 0.1); border-color: rgba(56, 208, 240, 0.2); }
.tl-icon.decision { color: #c9a8ff; background: rgba(165, 108, 255, 0.12); border-color: rgba(165, 108, 255, 0.24); }
.tl-icon.stage { color: var(--blue); background: rgba(91, 140, 255, 0.12); border-color: rgba(91, 140, 255, 0.24); }
.tl-icon.device { color: var(--warn); background: var(--warn-soft); border-color: rgba(245, 176, 65, 0.22); }
.tl-body { flex: 1; min-width: 0; padding-top: 1px; }
.tl-text { overflow-wrap: anywhere; line-height: 1.45; }
.tl-text strong { font-weight: 640; }
.tl-text a:hover strong { color: #c2b9ff; }
.tl-meta { color: var(--text-3); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.tl-meta .tag { padding: 0 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.05); font-size: 11px; }

/* Project detail */
.pd-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pd-head .titles { flex: 1; min-width: 200px; }
.pd-head h1 { font-size: 26px; }
.pd-progress { margin-top: 20px; padding: 20px; }
.pd-progress-top { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.pd-progress-top .pct { font-size: 36px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; }
.pd-stages { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); max-width: 100%; }
.link-chip:hover { color: var(--text); border-color: var(--border-strong); }
.link-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: flex; gap: 4px; margin-top: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.tab-body { margin-top: 18px; }

/* Stage rows */
.stage { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); }
.stage:first-child { border-top: 0; }
.stage-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.stage.completed .stage-num { background: var(--ok-soft); color: var(--ok); border-color: rgba(62, 207, 142, 0.3); }
.stage.active .stage-num { background: var(--accent-soft); color: #c2b9ff; border-color: rgba(139, 124, 255, 0.4); }
.stage.blocked .stage-num { background: var(--danger-soft); color: var(--danger); border-color: rgba(242, 95, 122, 0.3); }
.stage-main { min-width: 0; }
.stage-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.stage-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.stage .bar { margin-top: 8px; max-width: 420px; }
.stage-actions { display: flex; gap: 2px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(245, 176, 65, 0.22); }
.notice.info { background: var(--info-soft); color: var(--info); border-color: rgba(90, 169, 255, 0.22); }

/* Tasks */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task.done .task-title { color: var(--text-3); text-decoration: line-through; }
.check {
  width: 22px; height: 22px; border-radius: 7px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--border-strong); background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.check:hover { border-color: var(--accent); }
.check.on { background: var(--grad); border-color: transparent; }
.check .icon { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; }
.check.on .icon { opacity: 1; }
.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.quick-add { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.quick-add input { flex: 1; min-width: 0; }
.quick-add select { max-width: 40%; }

/* Decisions */
.decision { padding: 16px 18px; border-top: 1px solid var(--border); }
.decision:first-child { border-top: 0; }
.decision-head { display: flex; gap: 10px; align-items: flex-start; }
.decision-title { font-weight: 620; flex: 1; overflow-wrap: anywhere; }
.decision-body { margin-top: 8px; color: var(--text-2); font-size: 14px; }
.decision-meta { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }

/* Git */
.git-row { padding: 16px; border-top: 1px solid var(--border); }
.git-row:first-child { border-top: 0; }
.git-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.git-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 12px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12.5px; color: var(--danger); }
.field.invalid .input { border-color: rgba(242, 95, 122, 0.6); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.25); color: var(--text);
  font-size: 15px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
select.input option { background: var(--surface-solid); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-2); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Modal */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 10, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s ease-out;
}
.modal {
  width: 100%; max-height: 92vh; overflow-y: auto;
  background: #141720; border: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  animation: up 0.2s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-foot .left { margin-right: auto; }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 20px; padding: 24px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

.token-box { font-family: var(--mono); font-size: 13px; padding: 12px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.35); border: 1px dashed var(--border-strong); overflow-wrap: anywhere; user-select: all; }

/* Toasts */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-nav) + var(--safe-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { padding: 12px 16px; border-radius: 12px; background: #1b1f2a; border: 1px solid var(--border-strong); font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7); animation: up 0.2s ease-out; pointer-events: auto; }
.toast.error { border-color: rgba(242, 95, 122, 0.45); color: #ffc2cd; }
.toast.ok { border-color: rgba(62, 207, 142, 0.4); }

/* Login */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; padding: 28px 24px; }
.login .brand { justify-content: center; font-size: 20px; margin-bottom: 6px; }
.login .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
.login .sub { text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 24px; }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: #ffc2cd; font-size: 13.5px; margin-bottom: 14px; border: 1px solid rgba(242, 95, 122, 0.3); }

/* Skeleton */
.skel { border-radius: var(--radius); background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.07), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel.h80 { height: 80px; } .skel.h160 { height: 160px; } .skel.h40 { height: 40px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.offline-banner { position: sticky; top: 0; z-index: 40; text-align: center; font-size: 13px; padding: 6px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid rgba(245, 176, 65, 0.25); }

.more-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .more-grid { grid-template-columns: 1fr 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Pozycje list jako przyciski (arkusz „+”, Więcej) */
.list-item.btn { height: auto; min-height: 56px; justify-content: flex-start; text-align: left; border-radius: 0; font-weight: 560; white-space: normal; }
.list-item.btn:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list-item.btn:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* Agent v0.1 — stan Git na karcie i w szczegółach */
.pill.info { color: var(--cyan); background: rgba(56, 208, 240, 0.1); border-color: rgba(56, 208, 240, 0.25); }
.pcard-git { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.pcard-git .icon { color: var(--text-3); }
.pcard-git .mono { overflow-wrap: anywhere; }
.pcard-git .dirty { color: var(--warn); font-size: 12px; }
.pcard-alert.danger { color: var(--danger); padding: 8px 10px; border-radius: 10px; background: var(--danger-soft); border: 1px solid rgba(242, 95, 122, 0.3); font-weight: 560; }
.notice.danger { background: var(--danger-soft); color: #ffb3c1; border-color: rgba(242, 95, 122, 0.35); }
.dev-state.recent { color: var(--warn); }
.git-fresh { margin-top: 6px; }

/* Agent v0.2 — lokalny stan vs aktywnie zweryfikowany remote */
.pcard-remote { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; font-size: 12px; }
.pcard-remote .lbl { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; }
.pcard-remote .pill { justify-self: start; max-width: 100%; white-space: normal; }
.git-levels { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 720px) { .git-levels { grid-template-columns: 1fr 1fr; } }
.git-level { padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); border: 1px solid rgba(255, 255, 255, 0.05); }
.git-level h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 8px; }
.sha-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.sha-row .mono { overflow-wrap: anywhere; text-align: right; }
.sha-row.diff .mono { color: var(--danger); font-weight: 650; }
