/* Układ: wąski pasek nawigacji, pod nim tydzień jako "taśma" 7 dni; formularz i lista obok siebie, PM dostaje macierz osoby × dni. */
:root {
  --brand: #5ccd23;
  --brand-ink: #2f7a0c;
  --brand-soft: #e6f6dc;
  --ink: #121a14;
  --muted: #5b6a5d;
  --bg: #f3f6f1;
  --surface: #ffffff;
  --surface-2: #f8faf6;
  --line: #dfe6da;
  --line-strong: #c9d4c3;
  --warn: #b26b00;
  --warn-soft: #fff3dc;
  --danger: #c4321f;
  --danger-soft: #fde8e4;
  --on-brand: #0f1a0a;
  --heat: 92, 205, 35; /* RGB zieleni do skali intensywności */
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 26, 20, .04), 0 2px 8px rgba(18, 26, 20, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-ink: #86e357; --brand-soft: #1d2f15; --ink: #e7eee4; --muted: #97a596; --bg: #0c110d;
    --surface: #141b15; --surface-2: #10160f; --line: #243026; --line-strong: #334235;
    --warn: #f0b23c; --warn-soft: #2e2410; --danger: #ff7a66; --danger-soft: #34160f;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
.wrap {
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
h2.mt, .mt { margin-top: 28px; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.eyebrow { font: 600 12px/1.2 var(--font-body); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 6px; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--ink); }

/* Nagłówek */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark { font: 700 19px/1 var(--font-display); letter-spacing: -0.02em; }
.mark b { color: var(--brand); }
.brand-sep { width: 1px; height: 20px; background: var(--line-strong); }
.brand-app { font: 500 12px/1 var(--font-body); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--brand-soft); box-shadow: inset 0 -2px 0 var(--brand); }
.me { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.me-name { color: var(--ink); text-decoration: none; font-weight: 500; }
.role { font: 500 11px/1 var(--font-body); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 6px; border-radius: 99px; margin-left: 4px; }
.me form { margin: 0; }

.main { flex: 1; display: grid; gap: 20px; align-content: start; padding-block: 28px 48px; }
.foot { display: flex; justify-content: space-between; padding-block: 0 24px; font-size: 12.5px; color: var(--muted); }

/* Nagłówek strony */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head .muted { margin-top: 6px; max-width: 70ch; }
.datenav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.datenav input[type="date"] { width: auto; }
.export { display: flex; gap: 6px; margin-left: 8px; flex-wrap: wrap; }
.big-total { text-align: right; }
.big-total .num { font-size: 30px; font-weight: 500; display: block; line-height: 1; }
.big-total small { color: var(--muted); }

/* Karty */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 520px; width: 100%; justify-self: center; display: grid; gap: 14px; }
.card.narrow h1 { margin-bottom: 2px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head.pad { padding: 16px 20px 0; }
.total { font-size: 22px; font-weight: 500; }
.total small { font-size: 13px; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.empty { color: var(--muted); padding: 18px 20px; text-align: center; }
.card .empty { padding-inline: 0; }
.card.flush .empty { padding: 24px 20px; }

/* Formularze */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 600; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.new-task { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; background: var(--surface-2); }
.new-task legend { font: 600 12px/1 var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 6px; }
.js .new-task.is-hidden { display: none; }

.duration { display: grid; gap: 8px; }
.duration input { font-family: var(--font-mono); font-size: 18px; font-weight: 500; letter-spacing: .02em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 500 12.5px/1 var(--font-body); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 99px; padding: 7px 11px; cursor: pointer; }
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip-clear { color: var(--muted); }
html:not(.js) .chips { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  font: 600 14px/1 var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand); border-radius: 8px; padding: 0 16px;
}
.btn:hover { filter: brightness(.95); color: var(--on-brand); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); filter: none; }
.btn-icon { width: 40px; padding: 0; font-size: 20px; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.is-disabled { opacity: .35; pointer-events: none; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.linkish:hover { color: var(--ink); }
.linkish.danger { color: var(--danger); }
form.inline { display: inline; margin-left: 10px; }

.flash { border-radius: 8px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.flash-err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--ink); }
.secret { display: grid; gap: 8px; }
.pw { font-size: 17px; padding: 4px 8px; user-select: all; }

/* Tydzień */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(120px, 1.2fr); gap: 6px; }
.wd { display: grid; gap: 6px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.wd:hover { border-color: var(--line-strong); color: var(--ink); }
.wd-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wd-date { font-weight: 400; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.wd-total { font-size: 17px; font-weight: 500; }
.wd.is-weekend { background: var(--surface-2); }
.wd.is-future { opacity: .5; }
.wd.is-today .wd-name::after { content: "dziś"; margin-left: 6px; font: 600 10px/1 var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--brand-ink); }
.wd.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.wd-sum { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.wd-sum .wd-name { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.week-links { display: flex; gap: 10px; font-size: 12px; }
.week-links a { color: var(--bg); opacity: .75; }
.week-links a:hover { opacity: 1; color: var(--bg); }

.meter { display: block; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--brand); border-radius: 4px; width: 0; }
.meter-fill.lvl-1 { width: 10%; } .meter-fill.lvl-2 { width: 20%; } .meter-fill.lvl-3 { width: 30%; }
.meter-fill.lvl-4 { width: 40%; } .meter-fill.lvl-5 { width: 50%; } .meter-fill.lvl-6 { width: 60%; }
.meter-fill.lvl-7 { width: 70%; } .meter-fill.lvl-8 { width: 80%; } .meter-fill.lvl-9 { width: 90%; }
.meter-fill.lvl-10 { width: 100%; }

/* Wpisy dnia */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; padding-top: 4px; }
.entry-title { font-weight: 600; }
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { text-decoration: underline; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 3px; font-size: 13.5px; }
.note { color: var(--muted); overflow-wrap: anywhere; }
.entry-time { font-size: 17px; font-weight: 500; align-self: start; }
.entry-actions { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 13px; }
.entry-actions form { margin: 0; }
.ext { text-decoration: none; font-size: 13px; margin-left: 4px; }
.tag { display: inline-block; font: 500 12px/1.3 var(--font-body); background: var(--brand-soft); color: var(--brand-ink); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.tag-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
h1 .tag { vertical-align: middle; font-size: 13px; }

/* Filtry */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px; }
.filters .field-inline { width: auto; }
.filters .field-inline select, .filters .field-inline input { min-width: 140px; }
.filters .grow { flex: 1; min-width: 180px; }
.quick, .seg { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.quick a, .seg a { font-size: 13px; font-weight: 500; text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; }
.quick a:hover, .seg a:hover { color: var(--ink); border-color: var(--line-strong); }
.quick a[aria-current="true"], .seg a[aria-current="true"] { color: var(--on-brand); background: var(--brand); border-color: var(--brand); }
.seg { width: auto; align-self: center; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form .grow { flex: 1; min-width: 200px; }
.inline-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.inline-controls select { width: auto; min-height: 34px; padding: 5px 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.rename { display: flex; align-items: center; gap: 10px; margin: 0; }
.rename input { min-height: 34px; padding: 5px 8px; max-width: 360px; }

.summary-line { display: flex; flex-wrap: wrap; gap: 6px 24px; color: var(--muted); }
.summary-line strong { color: var(--ink); font-size: 18px; font-weight: 500; margin-right: 4px; }

/* Tabele */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font: 600 12px/1.2 var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; vertical-align: bottom; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table .r { text-align: right; }
.table td:first-child, .table th:first-child { padding-left: 20px; }
.table td:last-child, .table th:last-child { padding-right: 20px; }
.table .wrap-cell { min-width: 200px; max-width: 420px; overflow-wrap: anywhere; }
.table tr.is-done td { color: var(--muted); }
.table tr.is-done a { color: var(--muted); }
.table tr.sep td { border-top: 2px solid var(--line-strong); }
.table td form { margin: 0; }

.matrix th[scope="row"] { font-weight: 600; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix tbody th[scope="row"] a { color: var(--ink); text-decoration: none; }
.matrix tbody th[scope="row"] a:hover { text-decoration: underline; }
.matrix thead th:first-child { position: sticky; left: 0; z-index: 2; }
.matrix .day-col a { color: inherit; text-decoration: none; display: grid; gap: 2px; justify-items: end; }
.matrix .day-col a span:first-child { color: var(--ink); }
.matrix .day-col.is-today { box-shadow: inset 0 -2px 0 var(--brand); }
.matrix td.cell { padding: 0; height: 44px; min-width: 64px; vertical-align: middle; }
.matrix td.cell a, .matrix td.cell .dash { display: flex; align-items: center; justify-content: flex-end; height: 100%; padding: 0 12px; text-decoration: none; color: var(--ink); }
.matrix td.cell a:hover { box-shadow: inset 0 0 0 2px var(--brand); }
.matrix td.cell .dash { color: var(--line-strong); }
.matrix .is-weekend { background: var(--surface-2); }
.matrix td.is-missing { background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--warn) 14%, transparent) 5px 7px); }
.matrix tfoot th, .matrix tfoot td { border-top: 2px solid var(--line-strong); font-weight: 600; background: var(--surface-2); }
/* intensywność komórki względem dziennego celu */
.cell.lvl-1, .sw.lvl-1 { background-color: rgba(var(--heat), .08); }
.cell.lvl-2, .sw.lvl-2 { background-color: rgba(var(--heat), .12); }
.cell.lvl-3, .sw.lvl-3 { background-color: rgba(var(--heat), .16); }
.cell.lvl-4, .sw.lvl-4 { background-color: rgba(var(--heat), .2); }
.cell.lvl-5, .sw.lvl-5 { background-color: rgba(var(--heat), .24); }
.cell.lvl-6, .sw.lvl-6 { background-color: rgba(var(--heat), .28); }
.cell.lvl-7, .sw.lvl-7 { background-color: rgba(var(--heat), .32); }
.cell.lvl-8, .sw.lvl-8 { background-color: rgba(var(--heat), .36); }
.cell.lvl-9, .sw.lvl-9 { background-color: rgba(var(--heat), .4); }
.cell.lvl-10, .sw.lvl-10 { background-color: rgba(var(--heat), .46); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 12px 20px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); margin: 0; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); }
.sw-missing { background-image: repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--warn) 30%, transparent) 3px 5px); }

.bars-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; }
.bars-list li > span:first-child { overflow-wrap: anywhere; }
.bars-list .meter { grid-column: 1 / -1; height: 6px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; padding-top: 0; }
.rank a { color: var(--ink); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.rank a:hover { text-decoration: underline; }
.rank .num { margin-left: auto; padding-left: 8px; }

.login { margin-top: 6vh; }

@media (max-width: 960px) {
  .split, .split-even { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .wd-sum { grid-column: 1 / -1; grid-template-columns: auto auto 1fr; align-items: center; }
  .wd-sum .week-links { justify-content: flex-end; }
}
@media (max-width: 640px) {
  .top-in { gap: 8px 16px; }
  .nav { order: 3; width: 100%; flex: none; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  .me { margin-left: auto; }
  .role { display: none; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .wd { padding: 8px 6px; gap: 4px; text-align: center; }
  .wd-date { display: none; }
  .wd-total { font-size: 13px; }
  .wd.is-today .wd-name::after { display: none; }
  .wd-sum { text-align: left; padding: 10px 12px; }
  .row-2 { grid-template-columns: 1fr; }
  .export { margin-left: 0; }
  .filters .field-inline { width: 100%; }
  .filters .field-inline select, .filters .field-inline input { min-width: 0; }
  .card { padding: 16px; }
  .rename input { max-width: 180px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
