/* CMS Peter Gain: tokeny shadcn/ui (styl Nova, paleta neutral), kroje Geist */
/* Geist i Geist Mono z własnego serwera (licencja OFL w fonts/OFL.txt) */
@font-face { font-family: "Geist"; src: url("fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+1E00-1E9F; }
:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --accent: #f5f5f5;
  --destructive: #e7000b;
  --ring: #a1a1a1;
  --sidebar: #fafafa;
  --chart-muted: #e5e5e5;
  --green-bg: #dcfce7; --green-fg: #166534;
  --yellow-bg: #fef9c3; --yellow-fg: #854d0e;
  --blue-bg: #dbeafe; --blue-fg: #1e40af;
  --red-bg: #fee2e2; --red-fg: #991b1b;
  --purple-bg: #f3e8ff; --purple-fg: #6b21a8;
  --neutral-bg: #f5f5f5; --neutral-fg: #404040;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 14px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --font: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #0a0a0a; --foreground: #fafafa; --card: #141414; --muted: #262626; --muted-foreground: #a1a1a1;
    --border: #2a2a2a; --input: #333; --primary: #e5e5e5; --primary-foreground: #171717; --accent: #262626;
    --destructive: #ff6467; --sidebar: #111111; --chart-muted: #3a3a3a;
    --green-bg: #052e16; --green-fg: #86efac; --yellow-bg: #3a2a05; --yellow-fg: #fde047; --blue-bg: #172554; --blue-fg: #93c5fd;
    --red-bg: #450a0a; --red-fg: #fca5a5; --purple-bg: #3b0764; --purple-fg: #d8b4fe; --neutral-bg: #262626; --neutral-fg: #d4d4d4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #0a0a0a; --foreground: #fafafa; --card: #141414; --muted: #262626; --muted-foreground: #a1a1a1;
  --border: #2a2a2a; --input: #333; --primary: #e5e5e5; --primary-foreground: #171717; --accent: #262626;
  --destructive: #ff6467; --sidebar: #111111; --chart-muted: #3a3a3a;
  --green-bg: #052e16; --green-fg: #86efac; --yellow-bg: #3a2a05; --yellow-fg: #fde047; --blue-bg: #172554; --blue-fg: #93c5fd;
  --red-bg: #450a0a; --red-fg: #fca5a5; --purple-bg: #3b0764; --purple-fg: #d8b4fe; --neutral-bg: #262626; --neutral-fg: #d4d4d4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--background); color: var(--foreground); font-family: var(--font); font-size: 14px; line-height: 20px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted-foreground); }
.mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* układ */
.app { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 16px; background: var(--sidebar); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.brand b { display: block; font-weight: 500; }
.brand small, .user small { display: block; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted-foreground); padding: 0 8px 6px; }
.nav a { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--radius-md); }
.nav a:hover { background: var(--accent); }
.nav a.active { background: var(--accent); font-weight: 500; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted-foreground); }
.sidebar .grow { flex: 1; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); }
.user b { display: block; font-weight: 500; }
.snapshot { font-size: 12px; line-height: 16px; color: var(--muted-foreground); padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-md); }

.topbar { position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.crumbs a { color: var(--muted-foreground); }
.crumbs a:hover { color: var(--foreground); }
.crumbs span:last-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vsep { width: 1px; height: 16px; background: var(--border); }
.search { position: relative; width: 300px; }
.search svg { position: absolute; left: 10px; top: 10px; color: var(--muted-foreground); }
.input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); font: inherit; box-shadow: var(--shadow-xs); }
.search .input { padding-left: 32px; }
.input:focus-visible, .btn:focus-visible, a:focus-visible, .tab:focus-visible, .row-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.results { position: absolute; top: 42px; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px; max-height: 380px; overflow: auto; }
.results a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.results a:hover, .results a.sel { background: var(--accent); }
.results .kind { margin-left: auto; font-size: 12px; color: var(--muted-foreground); }

.content { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 240px; }
h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.4px; margin: 0 0 4px; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
p { margin: 0; }

/* elementy */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid transparent; font-weight: 500; cursor: pointer; white-space: nowrap; background: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: .9; }
.btn-outline { border-color: var(--border); background: var(--background); box-shadow: var(--shadow-xs); }
.btn-outline:hover, .btn-ghost:hover { background: var(--accent); }
.btn-sm { height: 32px; padding: 0 10px; }
.btn-icon { width: 36px; padding: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.b-green { background: var(--green-bg); color: var(--green-fg); }
.b-yellow { background: var(--yellow-bg); color: var(--yellow-fg); }
.b-blue { background: var(--blue-bg); color: var(--blue-fg); }
.b-red { background: var(--red-bg); color: var(--red-fg); }
.b-purple { background: var(--purple-bg); color: var(--purple-fg); }
.b-outline { border: 1px solid var(--border); color: var(--foreground); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 500; flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.progress { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-head > div:first-child { flex: 1; min-width: 0; }
.card-head p { color: var(--muted-foreground); margin-top: 2px; }
.card.flush { padding: 0; gap: 0; }
.card.flush .card-head { padding: 20px 24px 16px; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { gap: 6px; padding: 20px; }
.stat .top { display: flex; align-items: center; justify-content: space-between; color: var(--muted-foreground); font-weight: 500; }
.stat .val { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.split { grid-template-columns: minmax(0, 1fr) 400px; align-items: stretch; }
.card > .chart { margin-top: auto; }
.more { font-size: 12px; color: var(--muted-foreground); }
.more:hover { color: var(--foreground); }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* zakładki i filtry */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--muted); border-radius: var(--radius-lg); flex-wrap: wrap; }
.tab { height: 30px; padding: 0 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--muted-foreground); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tab.on { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.tab .c { font-size: 12px; color: var(--muted-foreground); }
.toolbar .input { width: 240px; }
.toolbar .spacer { flex: 1; }

/* tabele */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted-foreground); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th.r, td.r { text-align: right; }
td.r, td.nw, .nowrap td:not(:first-child) { white-space: nowrap; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main b { font-weight: 500; display: block; }
.cell-main small { display: block; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.late { color: var(--destructive); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted-foreground); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty b { color: var(--foreground); font-weight: 500; }
.empty-box { background: var(--muted); border-radius: var(--radius-lg); }

/* listy */
.list > * { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list > *:last-child { border-bottom: 0; }
.li { display: flex; align-items: center; gap: 12px; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .grow small { display: block; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.li .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li .end b { font-weight: 500; }

/* wykres */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 260px; flex: none; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bar-col .lbl { font-size: 12px; line-height: 16px; color: var(--muted-foreground); white-space: nowrap; }
.bar-col .v { font-size: 11px; line-height: 14px; color: var(--muted-foreground); white-space: nowrap; }
.bars { width: 100%; max-width: 40px; display: flex; flex-direction: column; justify-content: flex-end; flex: 1; }
.bars i { display: block; width: 100%; background: var(--primary); }
.bars i.pend { background: var(--chart-muted); }
.bars i.cost { background: var(--destructive); opacity: .55; }
.bars i:first-child { border-radius: 6px 6px 0 0; }
.bar-col.sel .lbl { color: var(--foreground); font-weight: 600; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted-foreground); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend i.pend { background: var(--chart-muted); }

/* karty projektów */
.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pcard { gap: 12px; cursor: pointer; transition: border-color .15s; }
.pcard:hover { border-color: var(--ring); }
.pcard .row { display: flex; align-items: center; gap: 8px; }
.pcard .row .grow { flex: 1; min-width: 0; }
.pcard h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 0; }
.pcard .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-foreground); }

/* tablica zadań */
.board { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.col { background: var(--muted); border-radius: var(--radius-xl); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; font-weight: 500; }
.col-head .c { color: var(--muted-foreground); font-weight: 400; }
.task { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--shadow-xs); }
.task .chk { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ring); flex: none; margin-top: 1px; cursor: pointer; background: none; padding: 0; display: grid; place-items: center; }
.task.done .chk { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.task.done .chk svg { width: 12px; height: 12px; stroke-width: 3; }
.task.done .t { color: var(--muted-foreground); text-decoration: line-through; }
.task .t { flex: 1; }
.task small { display: block; font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.task .mv { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted-foreground); padding: 0; }
.task:hover .mv { opacity: 1; }
.add-task { display: flex; gap: 6px; }
.add-task .input { height: 32px; }
.hidden-note { font-size: 12px; line-height: 16px; color: var(--muted-foreground); padding: 4px; }

/* karta klienta */
.profile { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile .info { flex: 1; min-width: 240px; }
.contact { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted-foreground); margin-top: 6px; }
.contact span, .contact a { display: inline-flex; align-items: center; gap: 6px; }
.contact a:hover { color: var(--foreground); }
.note { background: var(--muted); border-radius: var(--radius-lg); padding: 12px 14px; color: var(--foreground); }

/* panel boczny */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; animation: fade .15s; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--background); border-left: 1px solid var(--border); z-index: 21; display: flex; flex-direction: column; animation: slide .2s ease-out; }
.sheet-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.sheet-head > div { flex: 1; }
.sheet-body { padding: 20px 24px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; }
.dl dt { color: var(--muted-foreground); }
.dl dd { margin: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

.menu-btn { display: none; }
.scrim { display: none; }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 29; }
  .menu-btn { display: inline-flex; }
  .search { width: auto; flex: 0 1 220px; }
  .halves, .board { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .search { display: none; }
  .toolbar .input { width: 100%; }
  .card { padding: 16px; }
  .card.flush .card-head { padding: 16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .chart { gap: 4px; }
  .bar-col .v { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}

/* pomocnicze (zamiast stylów w kodzie HTML, których nie wpuszcza polityka bezpieczeństwa) */
.back { align-self: flex-start; }
.li-col { flex-direction: column; align-items: stretch; gap: 8px; }
.fw5 { font-weight: 500; }
.m0 { margin: 0; }
.pad-x { padding: 0 24px 20px; }
.month-label { min-width: 150px; text-align: center; font-weight: 600; }
.sidebar .user { gap: 10px; }
.sidebar .user > div:nth-child(2) { flex: 1; min-width: 0; }

/* logowanie */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--muted); }
.login .card { width: min(380px, 100%); padding: 28px; gap: 18px; }
.login .brand { padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field small { font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.err { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 8%, transparent); border-radius: var(--radius-md); padding: 8px 12px; }
.err:empty { display: none; }
textarea.input { height: auto; min-height: 96px; padding: 8px 12px; resize: vertical; }
select.input { padding-right: 8px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.form-actions .spacer { flex: 1; }
.btn-danger { color: var(--destructive); }
.btn-danger.armed { background: var(--destructive); color: #fff; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--primary); color: var(--primary-foreground); padding: 10px 16px; border-radius: var(--radius-lg); z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.15); animation: fade .15s; }
.task .t { cursor: pointer; }
.task .t:hover { text-decoration: underline; text-decoration-color: var(--ring); }
.li.clickable { cursor: pointer; }
.li.clickable:hover b { text-decoration: underline; text-decoration-color: var(--ring); }
