/* Mózg - panel sterowania. Ciemny motyw domyślny, jasny przez ustawienia systemu lub przełącznik. */
:root {
  --f-ui: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Unbounded", "Geist", system-ui, sans-serif;
  --f-dot: "Doto", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #060913;
  --panel: #0b1126;
  --panel-hi: #121a3a;
  --sunk: #080d1e;
  --line: rgba(145, 165, 255, 0.17);
  --line-strong: rgba(145, 165, 255, 0.36);
  --ink: #e3e8ff;
  --muted: #8892b8;
  --accent: #8f7bff;
  --accent-ink: #0a0720;
  --accent-glow: rgba(143, 123, 255, 0.5);
  --accent-soft: rgba(143, 123, 255, 0.16);
  --warn: #ffb42e;
  --ok: #3fe0a0;
  --spot: rgba(143, 123, 255, 0.17);
  --dot: rgba(160, 175, 255, 0.2);
  --glow-a: rgba(110, 80, 255, 0.2);
  --glow-b: rgba(255, 176, 46, 0.07);
  --nav-h: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e7eaf4; --panel: #f6f7fc; --panel-hi: #ffffff; --sunk: #eceff8;
    --line: rgba(30, 40, 100, 0.16); --line-strong: rgba(30, 40, 100, 0.34);
    --ink: #0a0f24; --muted: #55608a;
    --accent: #5a3df0; --accent-ink: #ffffff; --accent-glow: rgba(90, 61, 240, 0.35); --accent-soft: rgba(90, 61, 240, 0.12);
    --warn: #b05a00; --ok: #0b7f55; --spot: rgba(90, 61, 240, 0.1); --dot: rgba(30, 40, 100, 0.2);
    --glow-a: rgba(90, 61, 240, 0.12); --glow-b: rgba(255, 150, 20, 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #e7eaf4; --panel: #f6f7fc; --panel-hi: #ffffff; --sunk: #eceff8;
  --line: rgba(30, 40, 100, 0.16); --line-strong: rgba(30, 40, 100, 0.34);
  --ink: #0a0f24; --muted: #55608a;
  --accent: #5a3df0; --accent-ink: #ffffff; --accent-glow: rgba(90, 61, 240, 0.35); --accent-soft: rgba(90, 61, 240, 0.12);
  --warn: #b05a00; --ok: #0b7f55; --spot: rgba(90, 61, 240, 0.1); --dot: rgba(30, 40, 100, 0.2);
  --glow-a: rgba(90, 61, 240, 0.12); --glow-b: rgba(255, 150, 20, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--f-ui); font-size: 16px; line-height: 1.45;
  background:
    radial-gradient(900px 520px at 88% -8%, var(--glow-a), transparent 62%),
    radial-gradient(700px 480px at -10% 108%, var(--glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000, transparent 80%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- ścięte panele ---------- */
.tile, .surface, .proj, .note-item, .gwrap {
  --c: 16px;
  position: relative;
  background: var(--line-strong);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}
.tile::before, .surface::before, .proj::before, .note-item::before, .gwrap::before {
  content: ''; position: absolute; inset: 1px; z-index: 0; pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, -30%), var(--spot), transparent 70%), var(--panel);
  clip-path: polygon(calc(var(--c) - 0.4px) 0, 100% 0, 100% calc(100% - var(--c) + 0.4px), calc(100% - var(--c) + 0.4px) 100%, 0 100%, 0 calc(var(--c) - 0.4px));
}
.tile > *, .surface > *, .proj > *, .note-item > * { position: relative; z-index: 1; }
.tile { padding: 18px; min-width: 0; }
.surface { padding: 4px 16px; }
.proj, .note-item { display: block; width: 100%; text-align: left; border: 0; padding: 14px 18px; margin-bottom: 10px; --c: 12px; transition: transform 0.15s; }
.proj:active, .note-item:active { transform: scale(0.985); }
.proj > *, .note-item > * { position: relative; z-index: 1; }
@media (hover: hover) { .proj:hover, .note-item:hover { background: var(--accent); } }

/* ---------- logowanie ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }
.orb { width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--warn), var(--accent)); filter: blur(0.3px); position: relative; animation: spin 14s linear infinite; }
.orb::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.brand { font-family: var(--f-display); font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin: 6px 0 0; }
.login p { margin: 0; color: var(--muted); }
.login input { height: 52px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--sunk); }
.login input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: 0; }
.err { color: var(--warn); min-height: 1.4em; margin: 0; }

/* ---------- szkielet ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.main { padding: calc(env(safe-area-inset-top) + 16px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 100px); max-width: 1100px; width: 100%; min-width: 0; margin: 0 auto; }
header.top { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
header.top h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(20px, 5.8vw, 28px); letter-spacing: -0.025em; line-height: 1.15; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
header.top .sub { display: block; font-family: var(--f-ui); font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-top: 4px; }
.clock { font-family: var(--f-dot); font-weight: 700; font-size: 26px; color: var(--accent); text-shadow: 0 0 12px var(--accent-glow); letter-spacing: 0.02em; margin-right: 4px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; transition: border-color 0.15s, background 0.15s, transform 0.1s; flex: none; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(0.94); background: var(--accent-soft); }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
nav.tabs button { border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 6px 0; transition: color 0.2s; position: relative; z-index: 1; }
nav.tabs button[aria-current="page"] { color: var(--ink); }
nav.tabs button[aria-current="page"] svg { color: var(--accent); filter: drop-shadow(0 0 6px var(--accent-glow)); }
nav.tabs .ind {
  position: absolute; top: -1px; left: 0; width: calc(100% / 6); height: 2px; background: var(--accent);
  box-shadow: 0 0 14px 1px var(--accent-glow);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 19;
  width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px var(--accent-soft), 0 8px 28px var(--accent-glow);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 0.25s;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.2; transition: transform 0.25s; }
.fab:hover svg { transform: rotate(90deg); }
.fab:active { transform: scale(0.9); }

@media (min-width: 900px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .main { padding: 32px 44px 120px; }
  nav.tabs {
    position: sticky; top: 0; height: 100dvh; grid-template-columns: 1fr; grid-auto-rows: 52px; align-content: start; gap: 4px;
    padding: 28px 12px; border-top: 0; border-right: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--panel);
  }
  nav.tabs button { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; column-gap: 12px; font-size: 15px; padding: 0 16px; }
  nav.tabs .ind { top: 28px; left: 0; width: 3px; height: 52px; transform: translateY(calc(var(--i, 0) * 56px)); border-radius: 0 3px 3px 0; }
  .fab { right: 44px; bottom: 36px; }
  header.top h1 { font-size: 30px; }
}

/* ---------- Dziś ---------- */
.quick { display: flex; gap: 8px; margin-bottom: 8px; }
.quick input { flex: 1; min-width: 0; height: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--sunk); }
.quick input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: 0; }
.quick button { height: 52px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.quick button:active { transform: scale(0.96); }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 18px; }

.bento { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.tile h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile h2 small { font-weight: 400; color: var(--muted); font-size: 13px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 9px var(--ok); display: inline-block; margin-right: 8px; animation: pulse 3.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.tile.hero { --c: 22px; padding: 20px; }
.hero-top { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.hero-top h2 { margin: 0 0 6px; font-family: var(--f-display); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; justify-content: flex-start; }
.hero-top p { margin: 0; color: var(--muted); font-size: 14px; }
.hero-top p b { color: var(--ink); font-weight: 600; }

.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 7px var(--accent-glow)); }
.ring .tk { stroke: var(--line-strong); stroke-width: 2.4; stroke-linecap: round; transition: stroke 0.25s, opacity 0.25s; transition-delay: var(--d, 0ms); }
.ring .tk.on { stroke: var(--accent); }
.ring .rim { fill: none; stroke: var(--line); stroke-width: 1; }
.ring .orbit { transform-origin: 0 0; animation: spin 22s linear infinite; }
.readout { position: absolute; inset: 22px; border-radius: 50%; border: 0; background: none; display: grid; place-content: center; text-align: center; gap: 0; }
.readout .num { font-family: var(--f-dot); font-weight: 800; font-size: 44px; line-height: 0.95; letter-spacing: 0.01em; color: var(--ink); text-shadow: 0 0 14px var(--accent-glow); }
.readout .num small { font-size: 22px; color: var(--muted); text-shadow: none; }
.readout .cap { font-size: 12px; color: var(--muted); margin-top: 2px; }
.readout:active .num { transform: scale(0.94); }

@media (min-width: 700px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bento .hero { grid-column: span 4; grid-row: span 2; }
  .bento .t-events, .bento .t-habits { grid-column: span 2; }
  .bento .t-goals, .bento .t-notes { grid-column: span 3; }
  .ring { width: 168px; height: 168px; }
  .readout { inset: 26px; }
}

/* ---------- listy i zadania ---------- */
.list { display: grid; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > .row:last-child, .surface > .row:last-child { border-bottom: 0; }
.row .body { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; }
.row .title {
  display: block; font-weight: 500; overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 2px; transition: background-size 0.32s ease, opacity 0.4s;
}
.row.completing .title { background-size: 100% 2px; opacity: 0.45; }
.row.done .title { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 13px; color: var(--muted); margin-top: 3px; }
.meta > span + span::before { content: ''; display: inline-block; width: 1px; height: 11px; background: var(--line-strong); margin: 0 9px; vertical-align: -1px; }
.overdue { color: var(--warn); font-weight: 600; }
.muted { color: var(--muted); }
.prio { display: inline-block; width: 7px; height: 7px; background: var(--warn); margin-right: 8px; transform: rotate(45deg); box-shadow: 0 0 8px var(--warn); vertical-align: 1px; }

.check { position: relative; width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line-strong); background: transparent; display: grid; place-items: center; flex: none; padding: 0; margin-top: 1px; transition: border-color 0.15s, background 0.15s; }
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px var(--accent-glow); }
.check svg { width: 15px; height: 15px; stroke-width: 3; }
.check.pop::after { content: ''; position: absolute; inset: -2px; border-radius: 9px; border: 2px solid var(--accent); animation: burst 0.5s ease-out forwards; pointer-events: none; }
@keyframes burst { from { transform: scale(0.8); opacity: 0.9; } to { transform: scale(2.4); opacity: 0; } }

.sw { position: relative; overflow: hidden; touch-action: pan-y; border-bottom: 1px solid var(--line); }
.list > .sw:last-child, .surface > .sw:last-child { border-bottom: 0; }
.sw .row { border-bottom: 0; transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.3s; position: relative; z-index: 1; }
.sw.dragging .row { transition: none; background: var(--panel); }
.sw::before { content: ''; position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; padding: 0 16px; font-weight: 700; font-size: 14px; opacity: var(--p, 0); pointer-events: none; }
.sw[data-dir="r"]::before { content: 'Zrobione'; background: color-mix(in srgb, var(--ok) 24%, transparent); color: var(--ok); justify-content: flex-start; }
.sw[data-dir="l"]::before { content: 'Na jutro'; background: color-mix(in srgb, var(--warn) 24%, transparent); color: var(--warn); justify-content: flex-end; }
.sw.gone .row { opacity: 0; }

.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.empty b { color: var(--ink); font-weight: 600; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: transparent; font-weight: 500; font-size: 14px; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); box-shadow: 0 0 14px var(--accent-soft); }
.group-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 20px 0 8px; }

/* ---------- projekty ---------- */
.proj .name { font-family: var(--f-display); font-weight: 500; font-size: 15px; letter-spacing: -0.01em; display: block; }
.proj .meta { margin-top: 5px; }
.bar { height: 8px; margin-top: 12px; background: var(--line); -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px); mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px); }
.bar > i { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); transition: width 0.7s cubic-bezier(0.2, 0.9, 0.2, 1); }
.back { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }

/* ---------- kalendarz ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head strong { font-family: var(--f-display); font-weight: 500; font-size: 17px; text-transform: capitalize; letter-spacing: -0.01em; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .dow { font-size: 12px; text-align: center; color: var(--muted); padding: 4px 0; }
.cal .day { aspect-ratio: 1 / 1.05; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; padding-top: 7px; gap: 4px; font-weight: 500; font-size: 14px; transition: transform 0.12s, border-color 0.15s; }
.cal .day:active { transform: scale(0.93); }
.cal .day.out { opacity: 0.38; }
.cal .day.today { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-soft) inset, 0 0 10px var(--accent-soft); color: var(--accent); }
.cal .day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 16px var(--accent-glow); }
.dots { display: flex; gap: 3px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dots i.t { background: var(--warn); box-shadow: 0 0 6px var(--warn); border-radius: 1px; transform: rotate(45deg) scale(0.9); }
.cal .day[aria-pressed="true"] .dots i { background: var(--accent-ink); box-shadow: none; }

/* ---------- nawyki ---------- */
.habit { padding: 14px 0; border-bottom: 1px solid var(--line); }
.habit:last-child { border-bottom: 0; }
.habit .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.habit .name { font-weight: 600; background: none; border: 0; padding: 0; text-align: left; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week button { height: 46px; border-radius: 9px; border: 1px solid var(--line-strong); background: transparent; font-size: 12px; color: var(--muted); display: grid; place-items: center; align-content: center; line-height: 1.15; transition: transform 0.12s, background 0.15s; }
.week button:active { transform: scale(0.92); }
.week button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px var(--accent-glow); font-weight: 600; }
.week button.today:not(.on) { border-color: var(--ink); color: var(--ink); }
.mini-habit { display: flex; align-items: center; gap: 12px; padding: 9px 0; width: 100%; background: none; border: 0; text-align: left; }
.mini-habit .check { margin: 0; }
.mini-habit b { font-weight: 500; }

/* ---------- notatki ---------- */
.note-item .title { font-weight: 600; display: block; }
.note-item .snip { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
.tag { display: inline-block; font-size: 12px; font-weight: 500; color: var(--accent); border: 1px solid var(--accent-soft); background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; margin: 8px 6px 0 0; }
.md { overflow-wrap: anywhere; max-width: 68ch; }
.md h1, .md h2, .md h3 { font-family: var(--f-display); font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; margin: 1.2em 0 0.5em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md p { margin: 0 0 0.8em; } .md ul { padding-left: 1.2em; margin: 0 0 0.8em; }
.md code { background: var(--sunk); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }
.md a.wiki { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- arkusz edycji ---------- */
.scrim { position: fixed; inset: 0; background: rgba(3, 5, 12, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  --c: 20px; background: var(--panel-hi); width: min(640px, 100%); max-height: 92dvh; overflow-y: auto; border-top: 2px solid var(--accent);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%, 0 var(--c));
  padding: 20px 20px calc(26px + env(safe-area-inset-bottom)); animation: up 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes up { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c)); border-top: 0; border-left: 2px solid var(--accent); } }
.sheet h2 { margin: 0 0 16px; font-family: var(--f-display); font-weight: 500; font-size: 17px; letter-spacing: -0.01em; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--sunk); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: 0; }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
.field input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.btn { flex: 1; height: 50px; border: 0; font-weight: 700; background: var(--accent); color: var(--accent-ink); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%); border-radius: 10px 10px 0 10px; transition: transform 0.1s, filter 0.15s; }
.btn:hover { filter: brightness(1.1); } .btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--sunk); color: var(--ink); flex: none; padding: 0 18px; }
.btn.danger { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); flex: none; padding: 0 18px; }
.rel { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.rel h3 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; }
.rel button { display: block; background: none; border: 0; text-align: left; padding: 7px 0; font-weight: 500; width: 100%; }
.rel button:hover { color: var(--accent); }
.rel .kind { font-weight: 400; color: var(--muted); font-size: 13px; margin-right: 8px; }

/* ---------- paleta komend ---------- */
.search-box { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); padding: calc(env(safe-area-inset-top) + 14px) 16px 16px; overflow-y: auto; }
.search-box .bar-top { display: flex; gap: 8px; margin: 0 auto 12px; max-width: 720px; }
.search-box input { flex: 1; height: 54px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--accent); background: var(--sunk); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 30px var(--accent-soft); }
.search-box input:focus { outline: 0; }
.search-box .results { max-width: 720px; margin: 0 auto; }
.cmd-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 13px 4px; font-weight: 500; }
.cmd-item .kind { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: auto; }
.cmd-item:hover, .cmd-item:focus-visible { background: var(--accent-soft); outline: 0; }
.cmd-item svg { color: var(--accent); }
kbd { font-family: var(--f-dot); font-weight: 700; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 6px; color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 92px); background: var(--panel-hi); color: var(--ink); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 500; max-width: 90vw; animation: up 0.2s ease-out; }
.offline { border: 1px solid var(--warn); color: var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; }

/* ---------- mapa powiązań ---------- */
.gwrap { --c: 20px; height: calc(100dvh - 280px); min-height: 400px; }
@media (min-width: 900px) { .gwrap { height: calc(100dvh - 210px); } }
.gwrap canvas { position: absolute; inset: 1px; width: calc(100% - 2px); height: calc(100% - 2px); z-index: 1; touch-action: none; cursor: grab; display: block; }
.gwrap canvas.grabbing { cursor: grabbing; }
.gstat { position: absolute; left: 18px; top: 14px; z-index: 2; font-family: var(--f-dot); font-weight: 700; font-size: 17px; color: var(--accent); text-shadow: 0 0 10px var(--accent-glow); pointer-events: none; }
.gcard { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3; background: var(--panel-hi); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; transform: translateY(150%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1); }
.gcard.show { transform: none; }
.gcard .gt { flex: 1; min-width: 0; }
.gcard .gt b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.gcard .gt span { font-size: 13px; color: var(--muted); }
.gcard .btn { flex: none; height: 42px; padding: 0 16px; }
.glegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 2px 0; }
.glegend i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.sw { -webkit-user-select: none; user-select: none; }
.prio.pin { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
