/* Neutrino Panel – szkielet UI. Kolory marki: ciemne tło + fiolet. */
:root {
  --bg: #0a0a0b;
  --bg-2: #0f0f12;
  --surface: #15151a;
  --surface-2: #1b1b22;
  --border: #26262e;
  --border-2: #33333d;
  --text: #f2f1ec;
  --text-2: #b9b9c2;
  --muted: #9b9ba4;
  --muted-2: #6a6a72;
  --accent: #4A3AD9;
  --accent-2: #6a5cf0;
  --accent-soft: rgba(74, 58, 217, .18);
  --accent-text: #c9c2ff;
  --ok: #34d399;   --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .14);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(900px 500px at 15% -10%, rgba(74, 58, 217, .22), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
table { border-collapse: collapse; width: 100%; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.sidebar__brand {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 18px; width: auto; display: block; }
.brand__tag {
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft);
  padding: 2px 7px; border-radius: 999px;
}
.sidebar__brand .sidebar__close { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }
.nav__group + .nav__group { margin-top: 14px; }
.nav__label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); padding: 0 10px 6px;
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--surface); color: var(--text); }
.nav__item.is-active {
  background: var(--accent-soft); color: #fff;
  box-shadow: inset 2px 0 0 var(--accent-2);
}
.nav__item .ico { width: 18px; height: 18px; opacity: .85; }
.nav__item.is-active .ico { color: var(--accent-text); opacity: 1; }

.sidebar__footer { border-top: 1px solid var(--border); padding: 12px; }
.user { display: flex; align-items: center; gap: 10px; }
.user__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user__meta strong { font-size: 13px; font-weight: 600; }
.user__meta span { font-size: 12px; color: var(--muted); }
.sidebar__version { margin-top: 8px; font-size: 11px; color: var(--muted-2); text-align: right; }
.sidebar__backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: rgba(10, 10, 11, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .topbar__menu { display: none; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search {
  display: flex; align-items: center; gap: 8px;
  width: min(460px, 100%);
  height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .ico { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); min-width: 0; }
.search input::placeholder { color: var(--muted-2); }
.search kbd {
  font-family: var(--font); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border-2); border-radius: 4px; padding: 0 5px; line-height: 18px;
}

.content { padding: 28px 24px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- Typografia stron ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-title { font-size: 15px; font-weight: 600; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a { color: var(--accent-text); font-size: 13px; font-weight: 500; }

/* ---------- Komponenty ---------- */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: none; }
.ico--lg { width: 28px; height: 28px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg);
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px;
}
.card--flush { padding: 0; overflow: hidden; }
.card--flush .section-head { padding: 14px 18px; border-bottom: 1px solid var(--border); margin: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* Kafelki statystyk */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat__label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.stat__label .ico { width: 16px; height: 16px; color: var(--muted-2); }
.stat__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat__delta { font-size: 12px; color: var(--muted); }
.stat__delta.up { color: var(--ok); }
.stat__delta.down { color: var(--bad); }

/* Plakietki */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 5px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge--ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.badge--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 500; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px;
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2E2178);
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Pasek filtrów */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.toolbar .search { width: min(320px, 100%); height: 36px; }
.toolbar__spacer { flex: 1; }
.select, .input {
  height: 36px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); outline: 0;
}
.select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select option { background: var(--surface); }

/* Tabele */
.table-wrap { overflow-x: auto; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; white-space: nowrap; }
.table th {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .015);
}
.table td { border-bottom: 1px solid var(--border); color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table td.primary { color: var(--text); font-weight: 500; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell { display: flex; align-items: center; gap: 10px; }
.table .cell small { display: block; color: var(--muted); font-weight: 400; }
.table th.check, .table td.check { width: 36px; padding-right: 0; }
.table input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border);
}
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages a, .pagination .pages span {
  min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--text-2);
}
.pagination .pages a:hover { background: var(--surface-2); }
.pagination .pages .is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* Listy */
.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list__item:last-child { border-bottom: 0; }
.list__item .grow { flex: 1; min-width: 0; }
.list__item .title { color: var(--text); font-weight: 500; }
.list__item .meta { font-size: 12px; color: var(--muted); }
.list__item .time { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.list__icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--accent-text);
}
.list__icon .ico { width: 16px; height: 16px; }

/* Zadania */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.task .grow { flex: 1; min-width: 0; }
.task .title { color: var(--text); font-weight: 500; }
.task.is-done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--muted); }
.task .meta .ico { width: 13px; height: 13px; margin-right: 3px; }
.prio { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }
.prio--high { background: var(--bad); }
.prio--mid { background: var(--warn); }
.prio--low { background: var(--muted-2); }

/* Pasek postępu */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban__col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 320px; }
.kanban__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.kanban__head .count { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.kanban__sum { padding: 8px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px dashed var(--border); }
.kanban__body { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: grab; }
.kcard:hover { border-color: var(--border-2); }
.kcard .title { font-weight: 600; color: var(--text); font-size: 13px; }
.kcard .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.kanban__add { margin: 0 10px 10px; }

/* Kalendarz */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal__dow { padding: 8px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .015); }
.cal__day { min-height: 104px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.cal__day.is-other { color: var(--muted-2); background: rgba(0, 0, 0, .15); }
.cal__day.is-today .d { background: var(--accent); color: #fff; }
.cal__day .d { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; }
.cal__ev { display: block; margin-top: 4px; padding: 3px 6px; border-radius: 5px; font-size: 11px; font-weight: 500; color: var(--text); background: var(--surface-2); border-left: 2px solid var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__ev.ok { border-left-color: var(--ok); }
.cal__ev.warn { border-left-color: var(--warn); }

/* Zakładki */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--accent-2); }

/* Formularze */
.form { display: grid; gap: 14px; }
.form--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .input, .field .select { width: 100%; height: 40px; }
.field .hint { font-size: 12px; color: var(--muted-2); }
.form__actions { display: flex; gap: 8px; justify-content: flex-end; grid-column: 1 / -1; }

/* Placeholder */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 40px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-2); border-radius: var(--radius); background: rgba(255, 255, 255, .01);
}
.placeholder .ico { color: var(--muted-2); margin-bottom: 6px; }
.placeholder strong { color: var(--text-2); }
.placeholder span { font-size: 13px; max-width: 420px; }
.chart-ph { height: 220px; }

/* Definicje (szczegóły) */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); }

/* Logowanie */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__brand { display: flex; justify-content: center; margin-bottom: 26px; }
.auth__brand img { height: 22px; }
.auth h1 { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth p.lead { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth .form { gap: 14px; }
.auth__foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted-2); }

.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- Responsywność ---------- */
@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar__brand .sidebar__close { display: inline-flex; }
  .sidebar__backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 35; }
  body.sidebar-open .sidebar__backdrop { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 16px; }
  .topbar .topbar__menu { display: inline-flex; }
  .content { padding: 20px 16px 40px; }
  .search kbd { display: none; }
}
@media (max-width: 640px) {
  .grid--4, .grid--3, .grid--2, .form--2 { grid-template-columns: 1fr; }
  .topbar .btn span { display: none; }
  .topbar .btn { padding: 0 9px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .cal__day { min-height: 64px; padding: 5px; }
  .cal__ev { display: none; }
  .cal__day .count { display: inline-block; font-size: 10px; margin-left: 4px; color: var(--accent-text); }
}
