:root {
  --ink-ui: #182944;
  --muted: #51647b;
  --panel: #fff;
  --line: #dce4ef;
  --soft: #f0f4fa;
  --page: #f4f7fc;
  --brand: #096c74;
  --tint: #e6f6f2;
  --danger: #b33150;
  --shadow: 0 4px 14px #17345609;
  --nav: linear-gradient(165deg, #142d50, #101e39 65%, #123c49);
  --rail: 244px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink-ui: #eff6ff;
  --muted: #b7c8da;
  --panel: #19283e;
  --line: #344965;
  --soft: #22354c;
  --page: #101b2c;
  --brand: #64e2cf;
  --tint: #164442;
  --danger: #ff91a7;
  --shadow: none;
}
body {
  background: var(--page);
  color: var(--ink-ui);
  font:
    15px/1.5 Inter,
    system-ui,
    "Segoe UI",
    sans-serif;
  font-variant-numeric: tabular-nums;
}
.uiIcon {
  width: 20px;
  height: 20px;
  flex: none;
  pointer-events: none;
}
button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
  min-width: 0;
  border-radius: 10px;
}
button {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 15px;
  background: #08776f;
  border: 1px solid transparent;
  color: white;
  min-height: 41px;
}
button:hover:not(:disabled) {
  filter: none;
  background: #075f5c;
  color: white;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
:focus-visible {
  outline: 3px solid #159fba;
  outline-offset: 2px;
}
input:not([type="checkbox"], [type="radio"]),
select,
textarea {
  background: var(--panel);
  color: var(--ink-ui);
  border: 1px solid var(--line);
  padding: 10px 12px;
  min-height: 43px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
input {
  accent-color: #08776f;
}
label {
  font-size: 14px;
  font-weight: 550;
}
label :is(input, select, textarea) {
  margin-top: 5px;
  font-weight: 400;
}
small,
.row small {
  color: var(--muted);
}
a,
summary,
span {
  color: var(--brand);
}
.late,
[role="alert"],
#gate [role="alert"],
#accountDialog [role="alert"] {
  color: var(--danger);
}
[role="alert"]:empty {
  display: none;
}
.light,
#identity button,
header button,
.row > button:not(:last-child),
#issue + #add:not([hidden]):is(main[data-page="invoices"] *) {
  color: var(--brand);
  background: var(--panel);
  border: 1px solid var(--line);
}
body > header {
  margin-left: var(--rail);
  min-height: 76px;
  padding: 14px 28px;
  background: var(--panel);
  color: inherit;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  justify-content: flex-start;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  letter-spacing: -0.7px;
  color: white;
}
.brand img {
  width: 46px;
  height: 46px;
}
header > .brand,
#menu {
  display: none;
}
#theme {
  display: grid;
  place-items: center;
  padding: 9px;
  margin-left: auto;
}
#identity:not(:empty) {
  margin-left: auto;
  flex-wrap: wrap;
}
#identity:not(:empty) + #theme {
  margin-left: 0;
}
#companyPicker {
  width: auto;
  margin: 0;
  min-width: 0;
}
#companyPicker label {
  margin: 0;
  color: var(--muted);
}
#companyPicker select {
  width: auto;
  max-width: min(220px, 55vw);
  font-weight: 600;
}
#rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  background: var(--nav);
  color: white;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #536984 transparent;
  z-index: 5;
}
.railBrand {
  padding: 24px;
  border-bottom: 1px solid #ffffff21;
}
.railBrand div,
.welcome small,
#version {
  color: #bfd1e7;
  font-size: 13px;
}
.railBrand div {
  margin-top: 10px;
}
#version {
  display: block;
  padding: 18px 22px;
  border-top: 1px solid #ffffff21;
}
nav {
  display: grid;
  gap: 18px;
  padding: 20px 12px;
}
nav h2,
#category {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 750;
}
nav h2 {
  margin: 0 12px 7px;
  color: #9bb4d0;
}
nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  background: transparent;
  color: #c4d5ec;
  padding: 10px 12px;
  border-radius: 11px;
}
nav button:hover:not(:disabled) {
  background: #ffffff16;
}
nav button[aria-pressed="true"] {
  color: white;
  background: #116864;
  border-color: #23847d;
  box-shadow: inset 3px 0 #61f2cf;
}
nav button[aria-pressed="true"] svg {
  color: #6ff3d7;
}
nav button:focus-visible {
  outline-color: #93f9e4;
}
main {
  width: auto;
  margin: 0 0 0 var(--rail);
  padding: 28px clamp(18px, 2.5vw, 44px) 54px;
}
main > :not(#rail) {
  max-width: 1376px;
  margin-inline: auto;
}
.titleBlock {
  margin-right: auto;
}
#category {
  color: var(--brand);
}
h1 {
  font-size: 30px;
  letter-spacing: -0.8px;
  line-height: 1.25;
  margin: 5px 0;
}
h1[tabindex]:focus {
  outline: none;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.35px;
}
.bar {
  margin-bottom: 20px;
  justify-content: flex-start;
}
#metrics {
  margin: 0 auto 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
#metrics div,
article,
dialog,
.overview > section,
.lists > section,
#gate:not(:empty) {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
#metrics div {
  padding: 18px;
  overflow-wrap: anywhere;
}
#metrics span {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  font-size: 14px;
}
#metrics svg {
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 10px;
  color: #8971ed;
  background: color-mix(in srgb, currentColor 13%, transparent);
}
#metrics div:nth-child(2) {
  background: linear-gradient(120deg, #124b69, #096f70);
  color: white;
  border-color: transparent;
}
#metrics div:nth-child(2) svg {
  color: #81ffe0;
}
#metrics div:last-child svg {
  color: #e04d68;
}
#metrics div:last-child strong {
  color: var(--ink-ui);
}
#metrics strong {
  font-size: clamp(21px, 2vw, 30px);
  letter-spacing: -0.035em;
}
main:not([data-page="dashboard"]) #metrics div {
  padding: 11px 16px;
}
main:not([data-page="dashboard"]) #metrics strong {
  font-size: 19px;
}
.tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.tools:has(:not([hidden])) {
  margin-bottom: 16px;
}
.tools > * {
  flex: 1 1 210px;
  max-width: 390px;
}
article {
  overflow-wrap: anywhere;
}
article > :first-child,
dialog h2 {
  margin-top: 0;
}
article > :last-child {
  margin-bottom: 0;
}
main[data-page="dashboard"] article {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.overview > section,
.lists > section {
  padding: 20px;
}
.overview h2,
.lists h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  margin: 0 0 14px;
}
.overview h2 svg {
  color: var(--brand);
}
.overview p {
  color: var(--muted);
  font-size: 14px;
}
.shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.overview button {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  color: var(--ink-ui);
  background: var(--panel);
  border-color: var(--line);
  width: 100%;
  padding: 12px;
  font-weight: 500;
}
.overview button:hover:not(:disabled) {
  background: var(--tint);
  color: var(--brand);
}
.overview button svg {
  color: var(--brand);
}
.overview button svg:last-child {
  width: 15px;
  color: var(--muted);
  margin-left: auto;
}
.balance {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 18px;
  flex-wrap: wrap;
}
.balance svg {
  width: 138px;
  max-width: 100%;
  fill: none;
  stroke-width: 14px;
}
.balance .empty {
  stroke: var(--soft);
}
.balance .current {
  stroke: #099e89;
}
.balance .overdue {
  stroke: #df4967;
}
.balance text {
  fill: var(--ink-ui);
  font-size: 25px;
  font-weight: 700;
  text-anchor: middle;
}
.balance .caption {
  font-size: 12px;
  font-weight: 450;
  fill: var(--muted);
}
.balance dt {
  font-size: 13px;
  color: var(--muted);
}
.balance dt:before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #099e89;
  margin-right: 7px;
}
.balance dt:last-of-type:before {
  background: #df4967;
}
.balance dd {
  margin: 2px 0 12px;
  font-weight: 700;
  font-size: 19px;
}
.subhead {
  margin: 26px 0 14px;
}
.summaries {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}
.summaries button {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
  color: var(--muted);
}
.summaries strong {
  margin-left: auto;
  color: var(--ink-ui);
  text-align: right;
}
.summaries button svg:last-child {
  margin-left: 0;
}
.lists {
  gap: 18px;
}

.row + .row,
td,
th,
#trade fieldset,
fieldset,
#accountDialog form + form {
  border-color: var(--line);
}
.row {
  gap: 9px;
  padding: 18px 0;
}
.row small {
  font-size: 14px;
}
.row > span:not(.late) {
  background: var(--tint);
  color: var(--brand);
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 13px;
}
.row > span:empty {
  display: none;
}
dialog {
  color: var(--ink-ui);
  padding: 26px;
  max-height: 90dvh;
  box-shadow: 0 22px 80px #051c3f33;
}
dialog::backdrop {
  background: #091b36a3;
}
dialog footer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  flex-wrap: wrap;
}
fieldset,
#trade fieldset {
  min-width: 0;
  border-radius: 13px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--line);
}
legend {
  font-weight: 650;
  padding: 0 6px;
}
th,
.adjustment,
.cards button {
  background: var(--soft);
  color: var(--ink-ui);
}
:root[data-theme="dark"]
  :is(article, dialog)
  :is(.express, .late, [role="alert"]) {
  color: #ffb390;
}
body:has(main[hidden]) > header {
  margin: 0;
  padding: 16px 24px;
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 0;
}
body:has(main[hidden]) #menu {
  display: none;
}
#gate:not(:empty) {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  width: min(900px, 94%);
  max-width: none;
  padding: 0;
  overflow: hidden;
  margin: clamp(12px, 10vh, 130px) auto 40px;
  box-shadow: 0 18px 60px #142d5014;
}
.welcome {
  background: var(--nav);
  color: white;
  padding: clamp(24px, 4vw, 50px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.welcome .brand {
  font-size: 29px;
}
.welcome p {
  font-size: clamp(21px, 2vw, 29px);
  line-height: 1.32;
  letter-spacing: -0.6px;
  font-weight: 550;
  margin: 8px 0;
}
.welcome svg {
  width: 100%;
  max-width: 300px;
}
#gate form {
  align-content: center;
  min-width: 0;
  padding: clamp(24px, 4vw, 50px);
  gap: 18px;
}
#gate label,
#gate p {
  margin: 0;
}
#gate #companyPicker label,
#gate #companyPicker select {
  display: block;
  width: 100%;
  max-width: none;
  color: inherit;
}
#gate #companyPicker select {
  margin-top: 5px;
}
#gate button {
  min-height: 46px;
}
@media (max-width: 1190px) {
  .summaries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shortcuts {
    grid-template-columns: 1fr;
  }
  .balance {
    gap: 6px;
  }
  .balance svg {
    width: 112px;
  }
}
@media (max-width: 960px) {
  body > header,
  main {
    margin-left: 0;
  }
  body > header {
    padding: 14px 18px;
    gap: 10px;
  }
  header > .brand {
    display: flex;
    color: var(--ink-ui);
    font-size: 19px;
    gap: 8px;
  }
  header > .brand img {
    width: 34px;
    height: 34px;
  }
  #menu {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }
  #theme,
  #identity:not(:empty) + #theme {
    margin-left: 0;
  }
  header #companyPicker,
  #identity:not(:empty) {
    order: 2;
    width: 100%;
    margin: 0;
  }
  #rail {
    display: none;
    position: static;
    width: auto;
    border-radius: 14px;
    margin-bottom: 20px;
  }
  #rail.expanded {
    display: block;
  }
  .railBrand {
    display: none;
  }
  nav section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  nav h2 {
    grid-column: 1/-1;
  }
  main {
    padding: 16px;
  }
}
@media (max-width: 680px) {
  #gate:not(:empty) {
    grid-template-columns: 1fr;
    margin: 0 auto 24px;
    max-width: 460px;
  }
  .welcome {
    gap: 4px;
    padding: 22px 24px;
  }
  .welcome .brand {
    font-size: 23px;
  }
  .welcome p,
  .welcome svg {
    display: none;
  }
  .welcome small {
    margin-left: 58px;
  }
  #gate form {
    padding: 24px;
  }
  body > header {
    padding: 12px 14px;
  }
  #companyPicker,
  #identity {
    gap: 6px;
  }
  #companyPicker label,
  #identity span {
    width: 100%;
  }
  #companyPicker select {
    flex: 1;
    max-width: 100%;
  }
  #identity span {
    font-size: 13px;
  }
  header button,
  #identity button {
    padding: 8px 11px;
  }
  nav section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  nav button {
    font-size: 13px;
    gap: 8px;
    padding: 9px 8px;
    overflow-wrap: anywhere;
  }
  main {
    padding: 14px;
  }
  h1 {
    font-size: 25px;
  }
  .titleBlock {
    width: 100%;
  }
  #metrics {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  main #metrics div,
  main:not([data-page="dashboard"]) #metrics div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
  }
  #metrics span {
    font-size: 13px;
    gap: 7px;
  }
  #metrics strong,
  main:not([data-page="dashboard"]) #metrics strong {
    font-size: 16px;
    text-align: right;
    margin: 0;
  }
  .overview,
  .summaries,
  .lists {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .overview > section,
  .lists > section,
  article,
  dialog {
    padding: 16px;
  }
  .balance {
    justify-content: space-around;
  }
  .tools #search,
  .tools #filter {
    max-width: 100%;
  }
  input:not([type="checkbox"], [type="radio"]),
  select,
  textarea {
    font-size: 16px;
  }
  dialog footer {
    gap: 8px;
  }
  .row > span {
    width: auto;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background-color 0.14s,
      border-color 0.14s,
      color 0.14s;
  }
}
@media (max-width: 960px) {
  header:has(#menu[aria-expanded="false"])
    :is(#identity, #companyPicker button) {
    display: none;
  }
  body:has(main[hidden]) header > .brand {
    display: none;
  }
  body:has(main[hidden]) #theme {
    margin-left: auto;
  }
  header:has(#menu[aria-expanded="true"]) #menu {
    background: var(--tint);
    color: var(--brand);
  }
}
@media (max-width: 680px) {
  header #companyPicker label {
    gap: 8px;
  }
  .bar .titleBlock {
    width: auto;
  }
  .bar {
    gap: 8px;
  }
  .bar button {
    padding: 9px 11px;
  }
}
.tools {
  align-items: center;
}
.tools :is(#search, #filter) {
  margin: 0;
}
.syncPanel,
#finance pre {
  background: var(--soft);
  color: var(--ink-ui);
  border-color: var(--line);
}
.row a {
  color: var(--brand);
}
#brandPreview,
.sheet {
  color: #182944;
  background: white;
  color-scheme: light;
}
.sheet th {
  color: #182944;
}
#identity span {
  color: var(--muted);
}
#identity button:hover,
header button:hover {
  background: var(--tint);
  color: var(--brand);
}
@media (max-width: 370px) {
  header > .brand {
    font-size: 16px;
    gap: 4px;
  }
  #menu {
    padding-inline: 7px;
  }
}
main[data-page="invoices"] .row:has(> .invoiceActions) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 36%);
  align-items: start;
  gap: 12px 24px;
  padding: 22px 0;
}
main[data-page="invoices"] .row:has(> .invoiceActions) > div {
  min-width: 0;
}
main[data-page="invoices"] .row:has(> .invoiceActions) > span {
  justify-self: end;
  text-align: right;
  max-width: 100%;
  width: auto;
}
main[data-page="invoices"] .row > span.late {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 13px;
}
.invoiceActions {
  grid-column: 1/-1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.invoiceActions:empty {
  display: none;
}
.invoiceActions button {
  padding: 8px 12px;
  min-height: 38px;
}
.invoiceActions
  button[data-id]:not([data-op]):not([data-trade]):not([data-billing]):not(
    [data-reminder]
  ) {
  margin-left: auto;
  background: #08776f;
  color: white;
  border-color: #08776f;
}
@media (max-width: 680px) {
  main[data-page="invoices"] .row:has(> .invoiceActions) {
    grid-template-columns: minmax(0, 1fr);
  }
  main[data-page="invoices"] .row:has(> .invoiceActions) > span {
    justify-self: start;
    text-align: left;
  }
  .invoiceActions button {
    flex: 1 1 135px;
    min-height: 44px;
  }
}

/* Invoice workspace, receipts and management overview */
#trade:has(.invoiceEditor) {
  width: min(1130px, 97vw);
  max-height: 94dvh;
}
.invoiceEditor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 31%);
  align-items: start;
  gap: 22px;
}
.invoiceEditor > * {
  min-width: 0;
}
.editBlock,
.invoiceReview,
.payContext,
.payPreview {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin: 0 0 16px;
}
.editBlock h3,
.invoiceReview h3 {
  font-size: 17px;
  margin: 0 0 15px;
}
.editBlock label {
  min-width: 0;
  margin: 0 0 12px;
}
.invoiceEditor #parties,
.dateGrid,
.invoiceEditor [data-issued-parts] > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.invoiceEditor #parties section,
.payContext {
  background: var(--soft);
  border-radius: 12px;
  padding: 15px;
  font-size: 14px;
}
.invoiceEditor #parties strong {
  display: block;
  margin: 4px 0;
}
.dateGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.invoiceEditor [data-issued-parts] > div {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
}
.invoiceEditor [data-fx] {
  background: var(--soft);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}
#trade .invoiceEditor #lines fieldset {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 12px;
  align-items: end;
  margin: 0 0 14px;
  background: var(--page);
}
.invoiceEditor #lines {
  counter-reset: line;
}
.invoiceEditor #lines fieldset {
  counter-increment: line;
}
.invoiceEditor #lines fieldset:before {
  content: "Pozycja " counter(line);
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
  grid-column: 1/-1;
}
.invoiceEditor #lines label {
  margin: 0;
}
.invoiceEditor #lines label:first-child {
  grid-column: 1/-1;
}
.invoiceEditor [data-unit-price] {
  grid-column: 1/3;
  align-self: center;
}
.invoiceEditor .remove {
  justify-self: end;
}
.invoiceReview {
  position: sticky;
  top: 0;
  background: var(--soft);
  max-height: calc(94dvh - 120px);
  overflow: auto;
}
.values {
  margin: 10px 0;
  font-size: 14px;
}
.values > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 6px 0;
}
.values dt {
  color: var(--muted);
}
.values dd {
  margin: 0;
  font-weight: 650;
}
.grand,
.payPreview {
  background: linear-gradient(120deg, #124b69, #096f70);
  color: white;
  padding: 16px;
  border-radius: 12px;
}
.grand small,
.payPreview small {
  color: #d7f6f2;
}
.grand strong,
.payPreview strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.5px;
}
.invoiceReview > label {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  line-height: 1.6;
  margin-bottom: 0;
}
.invoiceReview input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
#tradeForm [data-gross] {
  display: none;
}
#tradeForm:has(.invoiceEditor) footer {
  bottom: -26px;
  padding-bottom: 18px;
  box-shadow: 0 -8px 15px #142d5009;
}
#tradeForm:has(.invoiceEditor) [data-gross] {
  display: block;
  margin-right: auto;
  order: -1;
}
#tradeForm [data-gross]:before {
  content: "Brutto ";
  font-size: 13px;
  color: var(--muted);
}
dialog:has(.payPreview) {
  width: min(570px, 95vw);
}
.payContext p,
.payPreview p {
  margin: 4px 0 0;
  font-size: 14px;
}
.payContext .values {
  margin-bottom: 0;
}
.payChoices,
.dueLinks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
main[data-page="payments"] #metrics:after {
  content: "Suma widocznych operacji bez cofniętych wpłat i przeniesień nadpłat.";
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 13px;
}
main[data-page="payments"] .row > span {
  font-size: 16px;
  white-space: normal;
}
main[data-page="payments"] .refundPay > span {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
}
main[data-page="payments"] :is(.movedPay, .voidPay) > span {
  color: var(--muted);
  background: var(--soft);
}
.management {
  margin-bottom: 18px;
}
.vizHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.vizHead h2 {
  margin: 0;
}
.vizHead select,
.management .vizHead button,
.management .dueLinks button {
  width: auto;
  font-size: 13px;
  padding: 8px 12px;
  min-height: 36px;
}
.management .vizHead button {
  background: #08776f;
  color: white;
}
.trendLegend,
.legend,
.trendRow time {
  font-size: 13px;
  color: var(--muted);
}
.trendRow {
  display: grid;
  grid-template-columns: 56px minmax(18px, 1fr) minmax(90px, auto);
  gap: 10px;
  align-items: center;
  min-height: 35px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.trendRow svg {
  width: 100%;
  height: 18px;
}
.trendRow > div {
  text-align: right;
}
.trendRow small {
  display: block;
}
.inflow {
  fill: #099e89;
}
.refund {
  fill: #e05370;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #099e89;
  margin-right: 5px;
}
.legend i + i {
  background: #e05370;
  margin-left: 16px;
}
.management .dueRow {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 40%) 16px;
}
.dueRow small {
  display: block;
  font-weight: 400;
  font-size: 13px;
}
.dueRow strong {
  text-align: right;
}
.dueLinks {
  margin-top: 14px;
}
@media (max-width: 960px) {
  .invoiceEditor {
    grid-template-columns: minmax(0, 1fr);
  }
  .invoiceReview {
    position: static;
    max-height: none;
  }
}
@media (max-width: 680px) {
  #trade:has(.invoiceEditor) {
    padding: 15px;
    width: 100%;
    max-width: 100%;
    max-height: 98dvh;
  }
  .editBlock,
  .invoiceReview {
    padding: 14px;
  }
  .invoiceEditor #parties,
  .dateGrid,
  .invoiceEditor [data-issued-parts] > div {
    grid-template-columns: minmax(0, 1fr);
  }
  #trade .invoiceEditor #lines fieldset {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }
  .invoiceEditor #lines label:has([name="price"]) {
    grid-column: 1/-1;
    grid-row: 4;
  }
  .invoiceEditor #lines [data-unit-price] {
    grid-column: 1/-1;
  }
  .invoiceEditor .remove {
    grid-column: 1/-1;
  }
  #tradeForm:has(.invoiceEditor) footer {
    bottom: -15px;
    padding: 10px 0;
  }
  #tradeForm:has(.invoiceEditor) [data-gross] {
    width: 100%;
  }
  #tradeForm:has(.invoiceEditor) footer button {
    flex: 1;
  }
  .trendRow {
    gap: 6px;
  }
}
.management button.trendRow {
  display: grid;
  grid-template-columns: 68px minmax(16px, 1fr) minmax(94px, 30%);
  padding: 7px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  gap: 8px;
}
.management button.trendRow svg {
  width: 100%;
  height: 18px;
}
.trendRow > span {
  color: inherit;
  text-align: right;
}
.trendLegend {
  margin-bottom: 8px;
}
.payChoices {
  margin-bottom: 12px;
}
.payPreview {
  padding: 12px 16px;
  margin-bottom: 10px;
}
.payPreview strong {
  font-size: 21px;
}
.payContext {
  margin-bottom: 8px;
}
.payContext .values > div {
  padding: 3px 0;
}
dialog:has(.payPreview) #fields > label {
  margin: 9px 0;
}
main[data-page="payments"] .tools > * {
  flex: 1 1 142px;
}
main[data-page="payments"] .tools #search {
  flex-grow: 2;
}
main[data-page="payments"] .tools button {
  flex: 0 1 auto;
}
main[data-page="dashboard"] #add {
  background: var(--panel);
  color: var(--brand);
  border-color: var(--line);
}
@media (max-width: 680px) {
  main[data-page="payments"] .tools #search {
    flex-basis: 100%;
  }
  .management button.trendRow {
    grid-template-columns: 60px minmax(12px, 1fr) minmax(88px, 36%);
    gap: 5px;
  }
  .payContext {
    padding: 10px 14px;
  }
  .payContext .values {
    margin-top: 4px;
  }
}
/* Rejestry handlowe i magazyn */
#directoryTools:not([hidden]) {
  display: contents;
}
#directoryTools select {
  width: auto;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 145px;
}
article:has(.directory) {
  padding: 0;
  overflow: hidden;
}
.directory {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.dirHead,
.dirRow {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(
      200px,
      1.15fr
    );
  gap: 12px 18px;
  padding: 17px 20px;
  align-items: start;
}
.dirHead,
.dirCount {
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  padding: 11px 20px;
}
.dirHead strong:last-child {
  text-align: right;
}
.dirRow,
.dirCount {
  border-top: 1px solid var(--line);
}
.dirRow:hover {
  background: color-mix(in srgb, var(--soft) 33%, var(--panel));
}
.dirTitle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.dirTitle svg {
  width: 40px;
  height: 40px;
  padding: 10px;
  background: var(--tint);
  color: var(--brand);
  border-radius: 11px;
  flex: none;
}
.dirRow small,
.offerEditor p small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}
.dirRow .mobileLabel {
  display: none;
}
.dirActions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.directory button {
  font-size: 13px;
  min-height: 36px;
  padding: 7px 11px;
  margin: 0;
}
.dirMore {
  grid-column: 1/-1;
}
.dirMore button {
  margin: 3px;
}
.directory summary {
  color: var(--brand);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.dirMore p {
  white-space: pre-line;
}
.locations {
  border-left: 3px solid var(--line);
  padding-left: 12px;
}
.dirBadge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  background: var(--soft);
}
.dirBadge.good {
  background: var(--tint);
  color: var(--brand);
}
.dirBadge.warn {
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
}
.dirBadge.pending {
  background: #fff1cc;
  color: #794800;
}
.dirCell meter {
  display: block;
  width: 100%;
  max-width: 155px;
  height: 14px;
}
.dirCell meter::-webkit-meter-optimum-value {
  background: var(--brand);
}
.warehouseBar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 20px;
}
.dirEmpty {
  padding: 18px 20px;
}
dialog:has(.contactEditor) {
  width: min(700px, 95vw);
}
.contactEditor,
#tradeFields[data-editor="products"],
.offerEditor .dateGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.contactEditor :is(h3, .wide, label:has(textarea)),
[data-product-preview] {
  grid-column: 1/-1;
}
.contactEditor h3 {
  margin: 8px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
[data-movement-preview],
[data-product-preview] {
  margin: 12px 0;
  overflow-wrap: anywhere;
}
@media (max-width: 1200px) {
  .dirRow,
  .dirHead {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dirActions {
    grid-column: 1/-1;
    justify-content: flex-start;
  }
  .dirHead strong:last-child {
    display: none;
  }
}
@media (max-width: 680px) {
  .dirHead {
    display: none;
  }
  .dirRow {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }
  .dirRow .mobileLabel {
    display: block;
    font-weight: 600;
    margin: 0 0 4px;
  }
  .dirActions button {
    flex: 1 1 130px;
    min-height: 42px;
  }
  .contactEditor,
  #tradeFields[data-editor="products"],
  .offerEditor .dateGrid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.registryBox {
  grid-column: 1/-1;
  min-width: 0;
  background: var(--soft);
  color: var(--ink-ui);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.registryBox summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 650;
}
.registryBox small {
  display: block;
  color: var(--muted);
  margin: 6px 0;
}
.registryBox button {
  margin: 6px 0;
}
.registryBox [role="status"]:empty {
  display: none;
}
.registryBox .quoteFields {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.5fr;
  gap: 10px;
  margin: 14px 0;
  align-items: end;
}
#trade .registryBox .quoteFields label {
  grid-column: auto;
  min-width: 0;
}
.registryBox [data-show] {
  width: auto;
}
.registryBox [data-applied] label {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 700px) {
  .registryBox .quoteFields {
    grid-template-columns: minmax(0, 1fr);
  }
}
#vatDialog {
  width: min(680px, 95vw);
  color: var(--ink-ui);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
#vatDialog > header {
  color: var(--ink-ui);
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  padding: 10px 0;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
#vatDialog h2,
#vatDialog h3 {
  margin: 6px 0;
}
#vatDialog .registryBox {
  margin: 16px 0;
}
#vatDialog .vatRecord {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.vatRecord summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}
.vatRecord dt {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.vatRecord dd {
  margin: 0;
  white-space: pre-line;
}
.vatRecord button {
  margin-top: 12px;
}
#vatDialog [role="status"] {
  scroll-margin-top: 90px;
}
.paymentCheck {
  margin-top: 18px;
}
.paymentCheck [data-result] {
  margin: 12px 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.paymentCheck .choice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.paymentCheck .choice input {
  width: auto;
  flex: none;
}
.paymentWarning {
  border-left: 4px solid var(--danger);
  padding: 12px;
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
  color: var(--danger);
  margin: 12px 0;
}
.paymentWarning ul {
  padding-left: 20px;
  margin: 6px 0;
}
#transferDialog {
  width: min(850px, 96vw);
  color: var(--ink-ui);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.fileHeading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#transferDialog h2,
#transferDialog h3 {
  margin: 5px 0 12px;
}
#transferDialog summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 650;
}
#transferDialog small {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  margin: 5px 0;
}
#transferDialog [data-archive],
.filePast {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.fileGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.fileGrid .full {
  grid-column: 1/-1;
}
#transferDialog label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
#transferDialog input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
}
.fileChoices {
  max-height: 290px;
  overflow: auto;
  margin: 10px 0;
}
.fileChoices label {
  border-bottom: 1px solid var(--line);
  padding: 10px 4px;
}
.fileChoices label:has(:checked) {
  background: var(--tint);
}
.fileChoices strong {
  margin-left: auto;
}
.fileFooter {
  padding: 15px;
  background: var(--soft);
  border-radius: 12px;
}
.fileFooter > strong {
  font-size: 20px;
}
#transferDialog [role="alert"] {
  color: var(--danger);
}
#transferDialog button {
  margin: 4px 0;
}
@media (max-width: 630px) {
  .fileGrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .fileChoices label {
    flex-wrap: wrap;
  }
  .fileChoices strong {
    margin-left: 28px;
  }
  .fileFooter button {
    width: 100%;
  }
}
