/* Styl przeniesiony z aplikacji Ofertize (src/app/globals.css i komponenty):
   neutralna skala zinc + jeden akcent marki (zieleń Greenlo). Kolor działa jako sygnał,
   nie dekoracja; hierarchię buduje typografia, nie cienie i gradienty. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --background: #fafafa;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f4f4f5;
  --surface-subtle: #fafafa;
  --line: #e6e6ea;
  --line-strong: #d4d4d8;
  --ink: #18181b;
  --ink-strong: #18181b;
  --ink-muted: #52525b;
  --ink-subtle: #a1a1aa;
  --brand: #16a34a;
  --brand-hover: #15803d;
  --brand-fg: #ffffff;
  --brand-dark: #166534;
  --brand-soft: #ecfdf3;
  --danger-bg: #fef2f2;
  --danger-fg: #b91c1c;
  --warning-bg: #fffbeb;
  --warning-fg: #b45309;
  --success-bg: #ecfdf5;
  --success-fg: #047857;
  --night: #0a0a0c;
  --radius: 10px;
  --radius-md: 8px;
  --shadow-xs: 0 1px 2px 0 rgb(24 24 27 / .04);
  --shadow-lg: 0 12px 32px -8px rgb(24 24 27 / .14), 0 4px 8px -4px rgb(24 24 27 / .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #0f0f11;
    --sidebar: #131316;
    --surface: #18181b;
    --surface-muted: #232327;
    --surface-subtle: #1c1c20;
    --line: #2a2a2f;
    --line-strong: #3a3a41;
    --ink: #dedee3;
    --ink-strong: #f4f4f5;
    --ink-muted: #9a9aa5;
    --ink-subtle: #6b6b76;
    --brand: #3fc86f;
    --brand-hover: #4fd57e;
    --brand-fg: #06140b;
    --brand-dark: #86efac;
    --brand-soft: #0f2a1a;
    --danger-bg: rgb(239 68 68 / .14);
    --danger-fg: #fca5a5;
    --warning-bg: rgb(245 158 11 / .12);
    --warning-fg: #fcd34d;
    --success-bg: rgb(16 185 129 / .12);
    --success-fg: #6ee7b7;
    --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / .6), 0 0 0 1px rgb(255 255 255 / .06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0; background: var(--background); color: var(--ink);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03", "cv02";
}
::selection { background: color-mix(in srgb, var(--brand) 18%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; color: var(--ink-strong); }
p { margin: 0; }
a { color: var(--brand); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; }
.muted { color: var(--ink-muted); }

/* Logo tekstowe */
.wordmark { display: inline-flex; align-items: baseline; flex-wrap: wrap; font-weight: 800; font-size: 22px; letter-spacing: -0.04em; color: var(--ink-strong); text-decoration: none; line-height: 1; }
.wordmark i { font-style: normal; color: var(--brand); }
.wordmark small { flex-basis: 100%; font-size: 11px; font-weight: 500; letter-spacing: 0; margin-top: 6px; opacity: .8; }
.wordmark--light { color: #fff; font-size: 32px; }

/* Przyciski (button.tsx) */
.btn {
  display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid transparent;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-xs);
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); }
.btn--primary, .btn--brand { background: var(--brand); color: var(--brand-fg); }
.btn--primary:hover, .btn--brand:hover { background: var(--brand-hover); }
.btn--outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--outline:hover { background: var(--surface-muted); border-color: var(--line-strong); }
.btn--brand-soft { background: var(--brand-soft); color: var(--brand-dark); box-shadow: none; }
.btn--brand-soft:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }
.btn--ghost { background: transparent; color: var(--ink-muted); box-shadow: none; }
.btn--ghost:hover { background: var(--surface-muted); color: var(--ink); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--xs { height: 28px; padding: 0 8px; font-size: 12px; gap: 6px; }
.btn--xs svg { width: 14px; height: 14px; }
.btn--icon { width: 32px; height: 32px; padding: 0; }
.btn--block { width: 100%; }
.btn--start { justify-content: flex-start; }
.btn--link { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.btn--link:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select { font: inherit; color: var(--ink); }
input[type=text], input[type=search], input[type=number], input[type=password], input:not([type]), select {
  height: 36px; padding: 0 12px; width: 100%; font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-xs);
}
input::placeholder { color: var(--ink-subtle); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Komunikaty (alerty): pełne tło, biały tekst */
.alert { border-radius: 8px; padding: 10px 14px; font-size: 14px; line-height: 1.45; color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.alert-warning { background: #fb8c00; }
.alert-error { background: #e53935; }

/* Etykiety (badge.tsx) */
.chip { display: inline-flex; align-items: center; border-radius: 6px; padding: 0 8px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; background: var(--surface-muted); color: var(--ink-muted); }
.chip--danger { background: var(--danger-bg); color: var(--danger-fg); }
.chip--warn { background: var(--warning-bg); color: var(--warning-fg); }
.chip--ok { background: var(--success-bg); color: var(--success-fg); }

/* Logowanie */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login__aside {
  background-color: var(--night); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 48px 48px;
}
.login__pitch h2 { color: #fff; font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; max-width: 15ch; }
.login__pitch ul { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 22px; max-width: 46ch; }
.login__pitch li { position: relative; padding-left: 18px; }
.login__pitch li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: #3fc86f; }
.login__pitch b { display: block; font-weight: 600; font-size: 15px; }
.login__pitch span { color: #a1a1aa; }
.login__foot { color: #71717a; }
.login__main { display: grid; place-items: center; padding: 32px 24px; }
.login__form { width: 100%; max-width: 384px; display: grid; gap: 16px; }
.login__form h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.login__form > .muted { margin-top: -10px; margin-bottom: 12px; }
.login__form label { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
.login__form .btn { height: 40px; margin-top: 4px; }
.login__error { color: var(--danger-fg); }
.login__mobile-mark { display: none; }

/* Układ (dashboard-shell.tsx) */
.shell { display: flex; height: 100dvh; }
.side { width: 240px; flex: none; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); }
.side__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; }
.side__close { display: none; }
.side__cta { padding: 0 12px 12px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.nav__title { margin: 0 0 4px; padding: 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-subtle); }
.nav__title:not(:first-child) { margin-top: 20px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 2px;
  padding: 6px 8px; border-radius: var(--radius-md); font-size: 13.5px; font-weight: 500;
  color: var(--ink-muted); text-decoration: none; transition: background-color .15s, color .15s;
}
.nav a svg { color: var(--ink-subtle); }
.nav a:hover { background: color-mix(in srgb, var(--surface-muted) 70%, transparent); color: var(--ink); }
.nav a.is-active { background: var(--surface-muted); color: var(--ink); }
.nav a.is-active svg { color: var(--brand); }
.nav a.is-active::before { content: ""; position: absolute; left: -12px; top: 50%; width: 2px; height: 16px; transform: translateY(-50%); border-radius: 0 2px 2px 0; background: var(--brand); }
.nav__badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 18px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); }
.side__user { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 10px 10px 10px 16px; }
.avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 600; }
.side__who { min-width: 0; flex: 1; }
.side__who b { display: block; font-size: 13px; font-weight: 500; }
.side__who small { display: block; font-size: 12px; color: var(--ink-subtle); }
.overlay { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; flex: none;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.topbar h2 { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__menu, .topbar__sync { display: none; }
.content { flex: 1; overflow-y: auto; }
.content > main { max-width: 1400px; margin: 0 auto; padding: 24px 32px 64px; animation: fade-up .25s ease-out; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Nagłówek strony (page-header.tsx) */
.head { margin-bottom: 20px; }
.head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.head .muted { margin-top: 4px; font-size: 14px; }
.head .is-error { color: var(--danger-fg); }

/* Kafelki (stat-card.tsx) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); padding: 16px; display: grid; }
.tile span { font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.tile strong { margin-top: 8px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.25; }
.tile small { margin-top: 4px; font-size: 13px; color: var(--ink-subtle); }
.tile .is-danger { color: var(--danger-fg); }

/* Panel z listą (panel.tsx + table.tsx) */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.card--flush { padding: 0; }
.listbox { padding: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; background: var(--surface-muted); border-radius: var(--radius-md); padding: 3px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-muted); cursor: pointer; }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.search { flex: 1; min-width: 220px; max-width: 320px; margin-left: auto; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--ink-subtle); }
.search input { padding-left: 32px; height: 32px; font-size: 13px; }

.inv {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 100px 210px 130px 290px; gap: 0 16px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); transition: background-color .15s;
}
.inv:hover { background: color-mix(in srgb, var(--surface-muted) 60%, transparent); }
.inv.is-selected { background: var(--brand-soft); }
.inv--head { height: 40px; padding-top: 0; padding-bottom: 0; background: var(--surface-subtle); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); white-space: nowrap; }
.inv--head:hover { background: var(--surface-subtle); }
.inv:last-child { border-bottom: 0; }
.inv__check { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.inv__seller { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv__sub { color: var(--ink-subtle); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv__date { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.inv__due { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.inv__amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-strong); }
.inv--head .inv__amount { font-weight: 600; color: var(--ink-subtle); }
.inv__actions { display: flex; gap: 6px; justify-content: flex-end; }

.group { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 16px 6px; border-bottom: 1px solid var(--line); }
.group h3 { font-size: 13px; font-weight: 600; color: var(--ink); }
.group .sum { color: var(--ink-subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.group .btn--link { margin-left: auto; }
.group--danger h3 { color: var(--danger-fg); }
.group--warn h3 { color: var(--warning-fg); }

.inv.is-clickable { cursor: pointer; }
.inv__main .chip { margin-top: 3px; }
.chip--info { background: color-mix(in srgb, #2a78d6 12%, var(--surface)); color: #1d5fae; }
.inv__note { margin-top: 2px; font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv__note::before { content: "Notatka: "; color: var(--ink-subtle); }
.inv__corr { display: block; font-size: 11px; font-weight: 500; color: var(--ink-subtle); }

/* Podgląd faktury: panel z prawej (dialog) */
.pv-overlay { position: fixed; inset: 0; z-index: 45; background: rgb(24 24 27 / .3); backdrop-filter: blur(2px); }
.pv {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(640px, 100%);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); animation: pv-in .2s ease-out;
}
@keyframes pv-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.pv-open { overflow: hidden; }
.pv__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.pv__titles { flex: 1; min-width: 0; }
.pv__kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); }
.pv__head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; word-break: break-all; }
.pv__head .muted { font-size: 13px; margin-top: 2px; }
.pv__body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.pv__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-subtle); }
.pv__sum { display: grid; gap: 2px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.pv__sum span { font-size: 13px; }
.pv__sum strong { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.pv__sum small { font-size: 12px; }
.pv__section { padding: 16px 0 4px; }
.pv__section h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); margin-bottom: 10px; }
.pv__facts { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13.5px; }
.pv__facts dt { color: var(--ink-muted); }
.pv__facts dd { margin: 0; overflow-wrap: anywhere; }
.pv__mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pv__account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-subtle); }
.pv__account small { display: block; font-size: 12px; }
.pv__rows { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; font-size: 13px; }
.pv__row, .pv__vat { display: grid; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; align-items: start; }
.pv__row { grid-template-columns: minmax(0, 1fr) 70px 80px 42px 90px; }
.pv__vat { grid-template-columns: minmax(0, 1fr) 90px 90px 100px; }
.pv__row > :not(:first-child), .pv__vat > :not(:first-child) { text-align: right; }
.pv__row--head { border-top: 0; background: var(--surface-subtle); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-subtle); }
.pv__vat.is-total { font-weight: 600; background: var(--surface-subtle); }
.pv__list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); font-size: 13px; }
.pv__list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); }
.pv__list li:first-child { border-top: 0; }
.pv__list li.is-total { font-weight: 600; background: var(--surface-subtle); }
.pv__list .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv__note { width: 100%; min-height: 72px; padding: 8px 12px; margin-bottom: 8px; resize: vertical; font: inherit; font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-xs); }
.pv__note:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.pv__empty { padding: 24px 0; color: var(--ink-muted); }

/* Stronicowanie (pagination.tsx: stopka panelu) */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; background: var(--surface-subtle); }
.pager__info { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pager__size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.pager__size select { width: auto; height: 32px; padding: 0 8px; font-size: 13px; }
.pager__nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pager__nav .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.pager__nums { display: flex; align-items: center; gap: 2px; }
.pager__num { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-md); background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.pager__num:hover { background: var(--surface-muted); color: var(--ink); }
.pager__num.is-current { background: var(--ink); color: var(--surface); }
.pager__gap { padding: 0 4px; color: var(--ink-subtle); }

.empty { text-align: center; padding: 56px 16px; color: var(--ink-muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; margin-bottom: 4px; }

/* Pasek zaznaczenia */
.bulk {
  position: fixed; left: calc(50% + 120px); bottom: 20px; transform: translateX(-50%); z-index: 25;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; font-size: 13px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: max-content; max-width: calc(100% - 32px); flex-wrap: wrap;
}

/* Powiadomienia (toast.tsx) */
.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: grid; justify-items: end; gap: 8px; z-index: 40; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 16px; align-items: center; max-width: 420px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; font-size: 13.5px; box-shadow: var(--shadow-lg);
}
.toast--error { border-color: transparent; background: #e53935; color: #fff; }
.toast button { background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; padding: 3px 8px; }

/* Konwerter */
.drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 56px 16px; cursor: pointer; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.drop strong { font-weight: 600; }
.drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.drop__icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-muted); color: var(--ink-muted); margin-bottom: 8px; }

.conv-head { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px 32px; align-items: center; padding: 14px 20px; margin-bottom: 12px; }
.conv-head div { display: grid; }
.conv-head span { font-size: 12px; color: var(--ink-subtle); }
.conv-head strong { font-weight: 600; }
.alert + .card, #c-warn { margin-bottom: 12px; }

.items-head, .item { display: grid; grid-template-columns: minmax(0, 1.8fr) 1fr minmax(290px, 1.6fr) 1fr; gap: 16px; padding: 12px 16px; align-items: center; }
.items-head { height: 40px; padding-top: 0; padding-bottom: 0; background: var(--surface-subtle); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); }
.item { border-top: 1px solid var(--line); }
.items-head + div .item:first-child { border-top: 0; }
.item__name { font-weight: 500; margin-bottom: 8px; }
.item__sku.is-missing { border-color: color-mix(in srgb, #e53935 50%, var(--line)); background: var(--danger-bg); }
.item__from, .item__to { font-variant-numeric: tabular-nums; }
.item__to strong { display: block; font-weight: 600; }
.item__hint { font-size: 12px; color: var(--warning-fg); margin-top: 2px; }
.item__conv-wrap { display: grid; gap: 6px; }
.item__rule { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.item__factor { width: 80px !important; height: 32px !important; }
.item__tip { justify-self: start; border: 0; padding: 0; background: none; color: var(--brand); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; }
.item__tip:hover { text-decoration: underline; text-underline-offset: 3px; }
.item__label { display: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); margin-bottom: 2px; }

.conv-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 16px; }
.conv-preview { flex-basis: 100%; margin-top: 4px; }
.conv-preview summary { cursor: pointer; color: var(--ink-muted); font-size: 13px; }
.conv-preview pre { background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Węższe ekrany: lista bez kolumny „Wystawiona” */
@media (max-width: 1280px) {
  .inv { grid-template-columns: 20px minmax(0, 1fr) 200px 120px 290px; }
  .inv__date, .inv--head > :nth-child(3) { display: none; }
}

/* Tablet i telefon: menu wysuwane z lewej (jak w Ofertize) */
@media (max-width: 1023px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease-out; }
  .menu-open .side { transform: none; }
  .menu-open .overlay { display: block; position: fixed; inset: 0; z-index: 30; background: rgb(24 24 27 / .3); backdrop-filter: blur(2px); }
  .side__close, .topbar__menu, .topbar__sync { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .topbar__sync { margin-left: auto; }
  .content > main { padding: 20px 16px 64px; }
  .bulk { left: 50%; }

  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
  .login__mobile-mark { display: inline-flex; margin-bottom: 20px; }
}

@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile:first-child { grid-column: 1 / -1; }
  .tile strong { font-size: 20px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .search { min-width: 0; max-width: none; flex-basis: 100%; margin-left: 0; }
  .inv--head { display: none; }
  .inv { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 14px; align-items: start; }
  .inv__check { margin-top: 2px; }
  .inv__check, .inv > span:first-child { grid-row: 1 / span 3; }
  .inv__main { grid-column: 2; }
  .inv__amount { grid-column: 3; grid-row: 1; }
  .inv__due { grid-column: 2 / -1; }
  .inv__actions { grid-column: 2 / -1; justify-content: stretch; margin-top: 4px; }
  .inv__actions .btn { flex: 1; height: 32px; }
  .pager__nums { display: none; }
  .pv__row { grid-template-columns: minmax(0, 1fr) 64px 80px; }
  .pv__row > :nth-child(4), .pv__row > :nth-child(3) { display: none; }
  .pv__row > :nth-child(5) { display: block; }
  .pv__facts { grid-template-columns: 110px minmax(0, 1fr); }
  .pager__nav { margin-left: 0; width: 100%; }
  .pager__nav .btn { flex: 1; }
  .conv-head { grid-template-columns: 1fr 1fr; }
  .conv-head__wide { grid-column: 1 / -1; }
  .items-head { display: none; }
  .item { grid-template-columns: 1fr 1fr; padding: 14px; }
  .item__main, .item__conv-wrap { grid-column: 1 / -1; }
  .item__label { display: block; }
}
