
/* Układ: start od listy „Na dziś”, drugi widok to macierz 2×2, pod nią archiwum. Szczegóły zadania w panelu z prawej. */
:root {
  --bg: #ffffff;
  --fg: #1a1d23;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e7e9ee;
  --soft: #f6f7f9;
  --accent: #3b4fd8;
  --ok: #1f8a55;
  --late: #b45309;
  --warn: #b26b00;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #15171b; --fg: #eceef2; --muted: #a0a6b1; --faint: #6b7280; --line: #2a2e36; --soft: #1d2026; --accent: #8b9bff; --ok: #5cc98f; --late: #f0a35a; --warn: #f0ae4a; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #15171b; --fg: #eceef2; --muted: #a0a6b1; --faint: #6b7280; --line: #2a2e36; --soft: #1d2026; --accent: #8b9bff; --ok: #5cc98f; --late: #f0a35a; --warn: #f0ae4a; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 960px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 56px; }


header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-block: 24px 20px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 3px; }
.seg button { padding: 4px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.viewsel { border: 0; background: var(--soft); border-radius: 8px; padding: 6px 28px 6px 12px; font-size: 13px; font-weight: 500; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; position: relative; }
.me > b { font-weight: 500; }
.ico { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); position: relative; }
.ico:hover { background: var(--soft); color: var(--fg); }
.ico svg { width: 17px; height: 17px; }
.badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; color: var(--bg); background: var(--fg); }
.notif { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 420px; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.14); z-index: 15; padding: 6px; }
.notif h2 { margin: 6px 10px 6px; font-size: 13px; font-weight: 600; }
.nhead { display: flex; align-items: center; justify-content: space-between; margin: 6px 10px; }
.nhead h2 { margin: 0 !important; }
.nhead button { font-size: 12.5px; color: var(--muted); }
.nhead button:hover { color: var(--fg); }
.nitem { position: relative; touch-action: pan-y; user-select: none; }
.nitem .nx { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 6px; color: var(--faint); font-size: 12px; text-align: center; }
.nitem .nx:hover { background: var(--line); color: var(--fg); }
.notif .nbody { padding-right: 34px !important; }
.notif .nbody { display: grid; grid-template-columns: 8px 1fr; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--muted); align-items: start; }
.notif .nbody:hover { background: var(--soft); }
.notif .nbody.new { color: var(--fg); }
.notif .nt { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.notif .tt { color: var(--fg); }
.notif .nbody:not(.new) .tt { color: var(--muted); }
.notif .nbody.new .tt { font-weight: 600; }
.notif .co.ok { color: var(--ok); }
.notif .co.warn { color: var(--warn); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--accent); }
.notif .dot.read { visibility: hidden; }
.notif b { font-weight: 600; color: var(--fg); }
.notif time { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.notif .none { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.ask { position: fixed; z-index: 31; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100% - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.18); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ask h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ask .now { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.ask input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--bg); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; font-size: 12.5px; color: var(--muted); }
.quick button:hover { color: var(--fg); border-color: var(--muted); }
.scrim.top { z-index: 30; }
.login { max-width: 340px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 16px; }
.login h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.login p { margin: -8px 0 0; color: var(--muted); }
.login .seg { align-self: flex-start; }
.login input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--bg); }
.login .btn { align-self: flex-start; }
.login .err { margin: -6px 0 0; color: var(--late); font-size: 13px; }

.av { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 9.5px; letter-spacing: .02em; font-weight: 600; background: var(--soft); color: var(--muted); border: 1px solid var(--line); flex: none; }
.av.blank { visibility: hidden; }
.lock { width: 12px; height: 12px; flex: none; color: var(--muted); vertical-align: -1px; }

/* wiersz zadania */
.row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 7px; }
.row:hover { background: var(--soft); }
.row.dragging { opacity: .4; }
.chk { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; display: grid; place-items: center; }
.chk:hover { border-color: var(--ok); }
.chk[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.chk[aria-pressed="true"]::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.open { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 36px 72px 24px 104px; align-items: center; column-gap: 14px; }
.open.bezpola { grid-template-columns: minmax(0, 1fr) 28px 24px 96px; column-gap: 10px; }
.open.bezpola > .prog { width: 28px; }
.open > .prog { justify-self: start; }
.cell { min-width: 0; }
.open .t { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.row.done .t { text-decoration: line-through; color: var(--faint); }
.small { color: var(--faint); font-size: 12px; white-space: nowrap; }
.d { color: var(--muted); font-size: 12.5px; text-align: right; white-space: nowrap; }
.late { color: var(--late) !important; }
.row.late-row .t { color: var(--late); }
.d.late { font-weight: 500; }

/* na dziś */
.today-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.today-head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.today-head span { color: var(--muted); font-size: 13px; }
.bar { height: 3px; background: var(--soft); border-radius: 2px; overflow: hidden; margin: 10px 0 14px; }
.bar b { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.sep { border-top: 1px solid var(--line); margin: 10px 0 6px; }
.empty { color: var(--muted); padding: 18px 0; }

/* macierz */
.grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.q { padding: 18px 18px 12px; min-height: 220px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.q:nth-child(odd) { border-right: 1px solid var(--line); }
.q:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.q.drop { background: var(--soft); }
.q h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.q h2 small { font-weight: 400; color: var(--faint); font-size: 12px; }
.matrix-title { margin: 0 0 14px; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }

.add { color: var(--faint); padding: 7px 0; font-size: 13.5px; }
.add:hover { color: var(--fg); }
.addf { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 4px; }
.addf input[type=text] { border: 0; border-bottom: 1px solid var(--accent); padding: 4px 0; background: transparent; outline: none; width: 100%; }
.addf .ctls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.ctl { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--bg); font-size: 13px; }
.ctl.bad { border-color: var(--late); }
.hint { font-size: 12px; color: var(--faint); }
.pv { display: inline-flex; align-items: center; gap: 8px; }
.lockbtn { display: inline-grid; place-items: center; width: 28px; height: 26px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--bg); }
.lockbtn .lock { color: inherit; width: 13px; height: 13px; }
.lockbtn:hover { border-color: var(--muted); }
.lockbtn[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.tip { font-size: 12.5px; color: var(--muted); }

/* panel zadania */
.scrim { position: fixed; inset: 0; background: rgba(15,17,21,.25); z-index: 20; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--bg); z-index: 21; display: flex; flex-direction: column; border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(0,0,0,.08); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); }
.p-body { overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 22px; flex: 1; }
.p-top { display: flex; align-items: flex-start; gap: 10px; }
.p-top textarea { flex: 1; font-size: 18px; font-weight: 600; border: 0; resize: none; background: transparent; padding: 0; line-height: 1.35; outline: none; field-sizing: content; }
.x { color: var(--faint); font-size: 18px; line-height: 1; padding: 4px; }
.facts { display: grid; grid-template-columns: 70px 1fr; gap: 10px 12px; align-items: center; font-size: 13.5px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.facts .ctl { padding: 4px 8px; }
.moved { font-size: 12px; color: var(--muted); }
h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.subs label { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.subs input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--ok); margin: 0; }
.subs .ok { text-decoration: line-through; color: var(--faint); }
.subadd { border: 0; padding: 4px 0 4px 25px; width: 100%; background: transparent; outline: none; }
.subadd::placeholder, textarea::placeholder { color: var(--faint); }
.prog { display: inline-block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; flex: none; }
.prog b { display: block; height: 100%; background: var(--ok); border-radius: 2px; transition: width .3s; }
.prog.wide { display: block; width: 100%; margin: 2px 0 8px; }
h3 .cnt { font-weight: 400; color: var(--faint); margin-left: 6px; }

.arch { margin-top: 32px; }
.arch > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 0; }
.arch > summary::-webkit-details-marker { display: none; }
.arch > summary::before { content: ""; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s; }
.arch[open] > summary::before { transform: rotate(45deg); }
.arch > summary .cnt { color: var(--faint); font-weight: 400; }
.arch-q { display: block; width: 100%; max-width: 320px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--bg); margin: 12px 0 8px; }
.ahead, .arow { display: grid; grid-template-columns: minmax(0, 1fr) 24px 64px 132px; column-gap: 14px; align-items: center; }
.ahead { font-size: 11.5px; color: var(--faint); padding: 8px; border-bottom: 1px solid var(--line); }
.ahead span:nth-child(n+3), .arow .ad, .arow .ap { text-align: right; }
.agroup { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 1; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); padding: 16px 8px 6px; }
.agroup span { font-weight: 400; color: var(--faint); margin-left: 4px; }
.arow { width: 100%; padding: 7px 8px; border-radius: 7px; }
.arow:hover { background: var(--soft); }
.arow .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .ad { color: var(--muted); font-size: 12.5px; }
.arow .ap { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.amore { margin: 10px 8px 0; color: var(--muted); font-size: 13px; }
.amore:hover { color: var(--fg); }
.aempty { padding: 12px 8px; color: var(--muted); margin: 0; }
.subf { display: flex; align-items: center; gap: 8px; }
.subf .btn.sm { display: none; }
.subf:has(.subadd:not(:placeholder-shown)) .btn.sm { display: inline-flex; }
.btn.sm { padding: 4px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.btn.tall { height: 38px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.fbtns { margin-left: auto; display: inline-flex; gap: 6px; }
kbd { font-family: var(--font); font-size: 11px; line-height: 1; padding: 2px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .7; min-width: 18px; text-align: center; }
.btn.primary kbd { border-color: rgba(255,255,255,.6); }
.row.sel { background: var(--soft); }
.keys-btn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); display: inline-grid; place-items: center; font-size: 12px; text-align: center; }
.keys-btn:hover { color: var(--fg); border-color: var(--muted); }
.keys { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100% - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.18); padding: 18px 20px; }
.keys h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 13.5px; align-items: center; }
.keys dt { display: flex; gap: 4px; }
.keys dd { margin: 0; color: var(--muted); }
@media (hover: none) { .keys-btn, .btn kbd { display: none; } }
.note { padding: 6px 0; }
.note .h { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.note p, .note .file { margin-left: 32px; }
.note p { margin: 1px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note a, .file a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.file { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; color: var(--muted); max-width: 100%; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .rm { color: var(--faint); padding: 0 2px; }
.nrow { display: flex; gap: 6px; align-items: flex-start; }
.clip { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; flex: none; }
.clip:hover { border-color: var(--muted); color: var(--fg); }
.clip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.section-title { margin: 30px 0 4px; font-size: 13px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.section-title small { font-weight: 400; color: var(--faint); font-size: 12px; }
.comment textarea { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: none; background: var(--bg); field-sizing: content; min-height: 38px; }
.origin { font-size: 12.5px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.origin .who { display: inline-flex; align-items: center; gap: 8px; }
.origin button { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.hist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.hist li { display: grid; grid-template-columns: 48px 24px 1fr; gap: 10px; padding: 3px 0; align-items: center; }
.hist li span:first-child { color: var(--faint); }
.p-foot { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); }
.btn { border-radius: 7px; padding: 7px 14px; font-weight: 500; border: 1px solid var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.link { color: var(--faint); font-size: 13px; margin-left: auto; }
.link:hover, .link.armed { color: var(--late); }
.donebar { font-size: 13px; color: var(--ok); }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .q { min-height: 0; border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .q:last-child { border-bottom: 0; }
  .panel { top: auto; height: 90%; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; padding-right: 0; }
  header { padding-block: 16px 14px; gap: 10px; }
  .me > b { display: none; }
  .notif { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; }
  .open .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
  .row { padding-block: 8px; }
  .small.kw { display: none; }
  .open, .open.bezpola { grid-template-columns: minmax(0, 1fr) 28px 24px 96px; column-gap: 10px; row-gap: 2px; }
  .ahead { display: none; }
  .arow { grid-template-columns: minmax(0, 1fr) 24px 64px auto; column-gap: 10px; row-gap: 2px; }
  .arow .t { grid-column: 1 / -1; white-space: normal; }
  .arow .av { grid-column: 2; width: 20px; height: 20px; font-size: 8.5px; }
  .arow .ad { grid-column: 3; font-size: 12px; }
  .arow .ap { grid-column: 4; font-size: 12px; }
  .open .t { grid-column: 1 / -1; }
  .me { order: 2; }
  .viewsel { order: 3; }
  .row { align-items: flex-start; }
  .row .chk { margin-top: 1px; }
  .open > .prog, .open > .cell { grid-column: 2; width: 28px; }
  .open > .av { grid-column: 3; width: 20px; height: 20px; font-size: 8.5px; }
  .open > .d { grid-column: 4; font-size: 12px; }
}

/* potwierdzenia na dole ekranu, z cofnięciem */
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); background: var(--fg); color: var(--bg); border-radius: 8px; padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast button { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* podzadania: usuwanie */
.subs label { position: relative; }
.subs .sdel { margin-left: auto; color: var(--faint); font-size: 12px; padding: 0 4px; visibility: hidden; }
.subs label:hover .sdel, .subs .sdel:focus-visible { visibility: visible; }
.subs .sdel:hover { color: var(--fg); }
@media (hover: none) { .subs .sdel { visibility: visible; } }
.file.wait { color: var(--faint); }
