/* ==========================================================================
   Panel Zleceń — style
   Bazuje 1:1 na zatwierdzonej makiecie (Sora + Manrope + IBM Plex Mono).
   Dopisane: ekran logowania, ekran ustawień/branż, toast, stany puste/ładowania.
   Motyw jasny/ciemny przez data-theme + prefers-color-scheme.
   ========================================================================== */

:root {
  --ground: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #FAFBFD;
  --border: #E7E9F0;
  --border-strong: #D6D9E4;
  --ink: #171A21;
  --ink-2: #454C5A;
  --muted: #78808F;
  --brand: #4C5BD4;
  --brand-soft: #EEF0FC;
  --shadow: 0 1px 2px rgba(20,24,40,.04), 0 8px 24px rgba(20,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(20,24,40,.14);

  --ok: #1FA971;
  --warn: #E0A400;
  --crit: #E2445C;

  --radius: 16px;
  --radius-sm: 11px;
  font-synthesis: none;
}
:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --ground: #0F1116;
    --surface: #171A21;
    --surface-2: #1C202A;
    --border: #262B36;
    --border-strong: #333949;
    --ink: #ECEEF4;
    --ink-2: #B4BAC7;
    --muted: #838B9B;
    --brand: #8B97F0;
    --brand-soft: #21243A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --ground: #0F1116;
  --surface: #171A21;
  --surface-2: #1C202A;
  --border: #262B36;
  --border-strong: #333949;
  --ink: #ECEEF4;
  --ink-2: #B4BAC7;
  --muted: #838B9B;
  --brand: #8B97F0;
  --brand-soft: #21243A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
h1,h2,h3,h4 { font-family: 'Sora', system-ui, sans-serif; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brand); color: #fff; }

[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 20px;
}
.brand .glyph {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), #6E7BEC);
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 4px 12px rgba(76,91,212,.35);
}
.brand .glyph svg { width: 19px; height: 19px; }
.brand b { font-family: 'Sora'; font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: .02em; }

.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.nav-item .count { margin-left: auto; font-size: 12px; background: var(--surface-2); color: var(--muted); padding: 1px 8px; border-radius: 20px; font-weight: 700; }
.nav-item.active .count { background: var(--brand); color: #fff; }

.side-foot { margin-top: auto; }
.gcal {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; background: var(--surface-2); font-size: 12.5px;
}
.gcal .row { display: flex; align-items: center; gap: 8px; }
.gcal .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.gcal .dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.gcal b { font-size: 12.5px; }
.gcal p { margin: 7px 0 0; color: var(--muted); line-height: 1.4; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 30px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--ground) 70%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .h { min-width: 0; }
.topbar h1 { font-size: 21px; font-weight: 700; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2); display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--brand); border-color: var(--border-strong); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; border: none;
  padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 14px rgba(76,91,212,.3);
}
.btn-primary svg { width: 17px; height: 17px; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .55; cursor: default; filter: none; }

.view { padding: 26px 30px 60px; max-width: 1180px; }
.view[hidden] { display: none; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .lab { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .lab svg { width: 15px; height: 15px; }
.kpi .val { font-family: 'Sora'; font-weight: 700; font-size: 27px; margin-top: 9px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .val .cur { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi .sub { font-size: 12px; margin-top: 4px; color: var(--muted); }
.kpi .sub .up { color: var(--ok); font-weight: 700; }
.kpi.accent { background: linear-gradient(150deg, var(--brand), #6A77E8); border: none; color: #fff; }
.kpi.accent .lab, .kpi.accent .sub { color: rgba(255,255,255,.82); }
.kpi.accent .val { color: #fff; }
.kpi.accent .cur { color: rgba(255,255,255,.7); }

/* ---------- Panels ---------- */
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 4px; }
.panel-h h3 { font-size: 15.5px; font-weight: 600; }
.panel-h .link { margin-left: auto; color: var(--brand); font-size: 13px; font-weight: 600; background: none; border: none; }
.panel-b { padding: 12px 18px 18px; }

/* bar chart */
.bars { display: flex; flex-direction: column; gap: 13px; padding-top: 6px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 12px; }
.bar-row .name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bar-track { height: 9px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; }
.bar-row .amt { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ---------- Order rows ---------- */
.orders { display: flex; flex-direction: column; }
.order {
  display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center;
  padding: 13px 4px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.order:last-child { border-bottom: none; }
.order:hover { background: var(--surface-2); border-radius: 10px; }
.br-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.order .who { min-width: 0; }
.order .who b { font-weight: 600; font-size: 14.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order .who span { color: var(--muted); font-size: 12.5px; }
.order .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.order .amt { font-family: 'IBM Plex Mono'; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .01em; white-space: nowrap; display: inline-block; }

/* ---------- Filter bar ---------- */
.filters { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-width: 210px; flex: 1; max-width: 320px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input { border: none; background: none; outline: none; color: var(--ink); font-size: 14px; width: 100%; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  padding: 8px 13px; border-radius: 20px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .cdot { width: 8px; height: 8px; border-radius: 3px; }
.chip:hover { border-color: var(--border-strong); }
.chip.on { border-color: transparent; color: #fff; }
.chip.sel { background: var(--surface); border: 1px solid var(--border); }
.chip.sel svg { width: 14px; height: 14px; margin-left: 2px; opacity: .6; }
.filter-date {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  border-radius: 10px; padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none;
}
.filter-date:focus { border-color: var(--brand); }
.filter-select {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  border-radius: 20px; padding: 8px 13px; font-family: inherit; font-size: 13px; font-weight: 600; outline: none;
}

/* full table (Zlecenia view) */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.thead {
  display: grid; grid-template-columns: 2fr 1.1fr 1fr 1fr auto;
  gap: 13px; padding: 12px 18px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
  background: var(--surface-2);
}
.trow {
  display: grid; grid-template-columns: 2fr 1.1fr 1fr 1fr auto;
  gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: center; cursor: pointer;
}
.trow:last-child { border-bottom: none; }
.trow:hover { background: var(--surface-2); }
.trow .title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.trow .title b { font-weight: 600; font-size: 14.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .title span { color: var(--muted); font-size: 12.5px; }
.trow .cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.trow .date { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.trow .date small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.trow .amt { font-family: 'IBM Plex Mono'; font-weight: 600; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Calendar ---------- */
.cal-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.cal-top h2 { font-size: 19px; font-weight: 600; }
.cal-nav { display: flex; gap: 6px; margin-left: auto; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cal-legend .cdot { width: 9px; height: 9px; border-radius: 3px; }
.cal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-dow span { padding: 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 8px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: var(--surface-2); }
.cal-cell .dnum { font-size: 12.5px; font-weight: 600; color: var(--ink-2); align-self: flex-start; }
.cal-cell.today .dnum { background: var(--brand); color: #fff; width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; }
.ev { font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 6px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; cursor: pointer; }

/* ---------- Ustawienia / branże ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 18px; max-width: 720px; }
.set-list { display: flex; flex-direction: column; }
.set-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-row input[type="color"] { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); padding: 2px; cursor: pointer; }
.set-row .bname { border: 1px solid transparent; background: none; color: var(--ink); font-family: inherit; font-size: 14.5px; font-weight: 600; padding: 6px 8px; border-radius: 8px; width: 100%; }
.set-row .bname:focus { border-color: var(--brand); background: var(--surface-2); outline: none; }
.set-row .muted-lab { font-size: 12px; color: var(--muted); }
.set-del { width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; color: var(--muted); font-size: 17px; line-height: 1; flex: none; }
.set-del:hover { color: var(--crit); border-color: var(--crit); }
.set-add { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.set-add input[type="text"] { flex: 1; min-width: 160px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; color: var(--ink); outline: none; }
.set-add input[type="text"]:focus { border-color: var(--brand); }
.set-add input[type="color"] { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 2px; }
.gcal-panel .panel-b { display: flex; flex-direction: column; gap: 12px; }
.gcal-panel .status-line { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.gcal-panel .status-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.gcal-panel .status-line .dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.gcal-panel p.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- Drawer (form) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15,17,22,.5); backdrop-filter: blur(2px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .22s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 92vw;
  background: var(--surface); z-index: 50; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-h { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.drawer-h h3 { font-size: 17px; font-weight: 700; }
.drawer-b { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 14px; color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { resize: vertical; min-height: 62px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-opt { border: 1.5px solid var(--border); background: var(--surface-2); padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.cat-opt .cdot { width: 9px; height: 9px; border-radius: 3px; }
.cat-opt.pick { border-color: currentColor; }
.gcal-toggle { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.gcal-toggle svg { width: 20px; height: 20px; flex: none; }
.gcal-toggle.disabled { opacity: .55; }
.cost-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 9px; }
.cost-row { display: flex; gap: 8px; align-items: center; }
.cost-row input:first-child { flex: 1; }
.cost-row input.cmoney { max-width: 120px; text-align: right; }
.cost-del { width: 34px; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; color: var(--muted); font-size: 19px; line-height: 1; flex: none; }
.cost-del:hover { color: var(--crit); border-color: var(--crit); }
.add-cost { background: none; border: 1.5px dashed var(--border-strong); color: var(--brand); font-weight: 600; font-size: 13px; padding: 9px; border-radius: 9px; width: 100%; }
.add-cost:hover { background: var(--brand-soft); }
.cost-sum { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding: 11px 13px; background: var(--surface-2); border-radius: 10px; font-size: 13px; font-weight: 600; }
.cost-sum .lab2 { color: var(--muted); }
.cost-sum .kv { color: var(--ink-2); }
.cost-sum .zysk { margin-left: auto; color: var(--ok); font-size: 14.5px; }
.gcal-toggle .t { flex: 1; }
.gcal-toggle b { font-size: 13.5px; }
.gcal-toggle small { color: var(--muted); font-size: 12px; }
.switch { width: 42px; height: 25px; border-radius: 20px; background: var(--border-strong); position: relative; border: none; flex: none; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .18s; }
.switch.on { background: var(--brand); }
.switch.on::after { left: 20px; }
.drawer-f { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.btn-ghost { flex: 1; padding: 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 14px; }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-danger { padding: 11px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--crit) 45%, var(--border)); background: var(--surface); color: var(--crit); font-weight: 700; font-size: 14px; }
.btn-danger:hover { background: color-mix(in srgb, var(--crit) 12%, transparent); }
.drawer-f .btn-primary { flex: 1.4; justify-content: center; }

/* ---------- Ekran logowania ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 30px 28px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .glyph {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(140deg, var(--brand), #6E7BEC);
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 6px 16px rgba(76,91,212,.4);
}
.login-brand .glyph svg { width: 23px; height: 23px; }
.login-brand b { font-family: 'Sora'; font-weight: 700; font-size: 19px; display: block; letter-spacing: -.02em; }
.login-brand small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.login-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; padding: 12px; }
.login-err {
  background: color-mix(in srgb, var(--crit) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--crit) 35%, transparent);
  color: var(--crit); font-size: 13px; font-weight: 600;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 14px;
}

/* ---------- Stany: puste / ładowanie / błąd ---------- */
.state { padding: 40px 20px; text-align: center; color: var(--muted); }
.state svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 10px; }
.state b { display: block; color: var(--ink-2); font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.state p { margin: 0; font-size: 13px; }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-row { height: 54px; margin: 8px 0; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--ground); font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease; max-width: 90vw;
}
.toast.err { background: var(--crit); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile ---------- */
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 16px 18px; }
  .topbar h1 { font-size: 18px; }
  .topbar p { display: none; }
  .view { padding: 18px 16px 96px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .thead { display: none; }
  .trow { grid-template-columns: 1fr auto; grid-template-areas: "t a" "c d"; gap: 6px 10px; }
  .trow .title { grid-area: t; }
  .trow .cat { grid-area: c; }
  .trow .date { grid-area: d; text-align: right; }
  .trow .amt { grid-area: a; }
  .trow .st-cell { display: none; }
  .cal-cell { min-height: 62px; }
  .ev { font-size: 0; padding: 3px; height: 6px; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 10px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .mnav { flex: 1; background: none; border: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; font-size: 11px; font-weight: 600; border-radius: 10px; }
  .mnav svg { width: 21px; height: 21px; }
  .mnav.active { color: var(--brand); }
  .mnav.add { color: #fff; }
  .mnav.add .badge { width: 44px; height: 44px; border-radius: 14px; background: var(--brand); display: grid; place-items: center; box-shadow: 0 5px 16px rgba(76,91,212,.4); margin-top: -18px; }
  .mnav.add .badge svg { width: 24px; height: 24px; }
  .drawer-f .btn-ghost span, .btn-ghost { font-size: 14px; }
}

/* ---- Pasek okresu na Pulpicie (Miesiąc/Rok + nawigacja) ---- */
.period-bar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:18px;}
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:3px;gap:3px;}
.seg-btn{border:none;background:none;color:var(--muted);font-weight:600;font-size:13.5px;padding:7px 15px;border-radius:8px;transition:background .15s,color .15s;}
.seg-btn:hover{color:var(--ink);}
.seg-btn.active{background:var(--surface);color:var(--brand);box-shadow:var(--shadow);}
.period-nav{display:flex;align-items:center;gap:8px;}
.period-label{font-family:'Sora',system-ui,sans-serif;font-weight:600;font-size:15px;min-width:150px;text-align:center;letter-spacing:-.01em;}
.period-now{padding:8px 14px;font-size:13px;}
@media (max-width:860px){.period-label{min-width:120px;font-size:14px;}}

/* ---- Dziennik aktywności (Logi) ---- */
.logs{display:flex;flex-direction:column;}
.log-row{display:flex;align-items:center;gap:13px;padding:12px 4px;border-bottom:1px solid var(--border);}
.log-row:last-child{border-bottom:none;}
.log-ic{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;flex:none;}
.log-ic svg{width:17px;height:17px;}
.log-main{min-width:0;}
.log-summary{font-weight:600;font-size:14px;}
.log-meta{color:var(--muted);font-size:12.5px;margin-top:2px;}
