/* Lustrio — lokalny interfejs operacyjny, bez frameworków i zewnętrznych zasobów. */
:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --fg: #1d2d40;
  --muted: #59697b;
  --line: #d9e1e9;
  --card: #fff;
  --navy: #122b3b;
  --blue: #205b91;
  --teal: #126f70;
  --green: #22644c;
  --orange: #80520e;
  --red: #a92d36;
  --gray: #526174;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid #237baf; outline-offset: 3px; }
.skip-link { position: fixed; top: 8px; left: 12px; z-index: 10; transform: translateY(-160%); padding: 12px 18px; background: white; border: 2px solid var(--blue); border-radius: 6px; }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
h1, h2, h3 { color: var(--navy); line-height: 1.3; }
h1 { margin: 0 0 18px; font-size: 27px; font-weight: 650; letter-spacing: -.035em; }
h2 { margin: 26px 0 14px; font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
h3 { margin: 22px 0 10px; font-size: 14px; font-weight: 650; }
p { margin: 0 0 14px; }
li + li { margin-top: 6px; }
strong { font-weight: 650; }
code, pre { font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
code { overflow-wrap: anywhere; }
pre { max-width: 100%; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #f5f7fa; }
.small, small { font-size: 12px; }
.muted { color: var(--muted); }
.ok { color: var(--green); font-weight: 650; }
.bad, .red, .error { color: var(--red); font-weight: 650; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; overflow-y: auto; padding: 28px 16px 20px; background: var(--navy); color: #e7edf5; }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.04em; text-decoration: none; }
.brand:hover { color: inherit; text-decoration: none; }
.brand small { display: block; margin-top: 5px; color: #bacadb; font-size: 11px; font-weight: 400; letter-spacing: .015em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 42px; flex-shrink: 0; border: 1px solid #66859e; border-radius: 12px 12px 4px 4px; font-size: 24px; font-weight: 400; color: #b8d9da; }
.navigation { margin-top: 28px; }
.navigation > summary { width: fit-content; color: #b9c9da; font-size: 12px; padding: 5px 8px; }
.navigation[open] > summary { margin-bottom: 10px; }
.nav-group + .nav-group { margin-top: 22px; }
.nav-group h2 { margin: 0 10px 8px; color: #adbed1; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.nav-group a { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; margin-top: 3px; border-left: 3px solid transparent; border-radius: 5px; color: #e7edf5; font-size: 13px; line-height: 1.45; text-decoration: none; }
.nav-group a:hover { background: #213a55; }
.nav-group a.active { color: white; background: #2a4561; border-left-color: #90c9cf; font-weight: 650; }
.sidebar :focus-visible { outline-color: #a4d9ef; }
.nav-count { padding: 1px 6px; background: #324d69; border-radius: 4px; font-size: 11px; }
.workspace { margin-left: 220px; min-width: 0; }
.top { padding: 16px 30px; background: var(--card); border-bottom: 1px solid var(--line); }
.mode-bar { width: fit-content; max-width: 100%; padding: 5px 10px; border: 1px solid; border-radius: 5px; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.mode-green { color: #235d4d; background: #ebf5ef; border-color: #b0cfbd; }
.mode-orange { color: #774d0d; background: #fff5e2; border-color: #dcc398; }
.mode-blue { color: #204f79; background: #edf4fc; border-color: #b8cfe2; }
.status { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 12px; font-size: 12px; }
.worker-status { display: flex; flex-direction: column; flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.worker-status > span:first-child { font-weight: 600; }
.status-alert { padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; }
.status-alert.red { background: #fdf0f1; border-color: #dfb2b6; }
.user-menu { display: flex; gap: 10px; align-items: center; }
.user-name { max-width: 180px; overflow-wrap: anywhere; color: var(--muted); }
.status button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
main { max-width: 1680px; margin: 0 auto; padding: 28px 30px 48px; min-width: 0; }
.page-header { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; margin: 4px 0 24px; }
.page-header > div { min-width: 0; }
.page-header h1 { margin-bottom: 8px; }
.page-header h1 .small { font-size: 15px; font-weight: 400; letter-spacing: 0; }
.eyebrow { color: var(--teal); font-size: 10px; text-transform: uppercase; letter-spacing: .11em; font-weight: 700; margin-bottom: 8px; }
.page-description { margin: 0; color: var(--muted); max-width: 80ch; }
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 22px; }
.section-nav a { padding: 6px 10px; font-size: 12px; text-decoration: none; border: 1px solid var(--line); border-radius: 5px; background: var(--card); }
.section-nav a:hover, .section-nav a.active { border-color: #9bb4cc; background: #eaf1f8; }
.card { min-width: 0; padding: 22px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 1px 2px #162b4304; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card .card { padding: 16px; background: #f8fafc; box-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 20px; }
.dashboard-grid .dashboard-counts, .dashboard-grid .dashboard-queue, .dashboard-grid .dashboard-events { grid-column: 1 / -1; }
.dashboard-health { grid-column: 1; }
.dashboard-alerts { grid-column: 2; grid-row: 2; }
.detail-grid { grid-template-columns: minmax(0, 1fr); }
.kv { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); gap: 10px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; scrollbar-color: #8e9daf #edf1f5; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 12px; line-height: 1.5; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 12px; vertical-align: top; text-align: left; }
th { color: #475b70; background: #f4f7fa; font-size: 11px; font-weight: 650; white-space: nowrap; }
td { min-width: 70px; max-width: 440px; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f8fafc; }
tr:focus-within td { background: #f1f6fb; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td[colspan].empty-state { padding: 32px 18px; text-align: center; }
.empty-state { color: var(--muted); }
.empty-state small { display: block; margin-top: 6px; font-size: 12px; font-weight: 400; }
td details { min-width: 100px; }
td details[open] { min-width: 220px; }
td pre { min-width: 220px; }
td form { margin: 8px 0; }
td form label { min-width: 180px; }
td form button { margin-top: 8px; }
.chip, .badge { display: inline-block; padding: 3px 8px; border: 1px solid #d8e0e9; border-radius: 5px; font-size: 11px; font-weight: 600; line-height: 1.35; color: var(--gray); background: #eef2f6; white-space: nowrap; }
h1 .chip { vertical-align: middle; letter-spacing: 0; }
.chip-done, .chip-ok, .chip-sent, .chip-registered, .chip-created, .chip-labelled { color: #236048; background: #edf6f0; border-color: #bad6c5; }
.chip-error, .chip-failed, .chip-critical, .chip-cancelled { color: #a12b35; background: #fdf0f1; border-color: #e4bcc1; }
.chip-manual, .chip-warning, .chip-warn, .chip-waiting, .chip-create_unknown, .chip-awaiting_waybill { color: #79500e; background: #fff6e4; border-color: #dfc89b; }
.chip-queued, .chip-running, .chip-info, .chip-locked, .chip-shipping, .chip-shipped, .chip-create_requested, .chip-pending, .badge-dry { color: #205480; background: #edf4fb; border-color: #bdcfe0; }
.flash { padding: 12px 15px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; overflow-wrap: anywhere; }
.flash-success { color: #24573f; background: #eef7f1; border-color: #b7d5c1; }
.flash-error { color: #982834; background: #fdf0f1; border-color: #e0b4bb; }
.flash-warning { color: #745012; background: #fff7e8; border-color: #ddc591; }
.flash-info { color: #325774; background: #edf4fa; border-color: #bcd0e1; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 8px 13px; border: 1px solid #8193a5; border-radius: 6px; background: white; color: var(--fg); font: 600 12px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; text-align: center; text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { background: #edf2f7; color: var(--navy); border-color: #728ba5; text-decoration: none; }
button.primary, .btn.primary { color: white; background: var(--blue); border-color: var(--blue); }
button.primary:hover, .btn.primary:hover { background: #194870; }
button.danger, .btn.danger { color: var(--red); background: #fff6f6; border-color: #ad7a84; }
button.danger:hover { background: #fae6e9; }
button:disabled { cursor: not-allowed; background: #e9edf1; color: #687888; border-color: #d2dae3; box-shadow: none; }
input, select, textarea { font: inherit; color: var(--fg); max-width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid #788a9d; border-radius: 5px; background: white; }
input::placeholder, textarea::placeholder { color: #657589; opacity: 1; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; min-height: 0; margin: 2px 6px 2px 0; accent-color: var(--blue); flex-shrink: 0; vertical-align: middle; }
input[type="hidden"] { display: none; }
textarea { width: 100%; min-height: 90px; }
label { display: block; font-size: 12px; font-weight: 550; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { display: block; margin-top: 5px; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { font-weight: 400; line-height: 1.6; }
form > label + label { margin-top: 12px; }
form > label + button { margin-top: 14px; }
form.inline { display: inline; }
form.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 12px; margin: 0 0 20px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
form.filters label { flex: 1 1 130px; min-width: 0; margin: 0; color: #475b70; }
form.filters label:has([name="q"]) { flex-basis: 240px; }
form.filters label:has(> input[type="checkbox"]) { flex-basis: 100%; }
form.filters label > input:not([type="checkbox"]), form.filters label > select { width: 100%; }
form.filters > button { margin-top: 0; }
.card form.filters { padding: 0; border: 0; border-radius: 0; background: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0; }
.actions form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; min-width: 0; }
.actions label, .actions button { margin-top: 0; }
.actions > form:has(input[type="checkbox"]) { flex-basis: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.actions > form:has(input[type="checkbox"]) label { flex: 1 1 220px; }
.actions > label { max-width: 100%; }
details { margin-top: 12px; }
details > summary { cursor: pointer; width: fit-content; max-width: 100%; color: var(--blue); padding: 4px 0; font-size: 12px; text-underline-offset: 3px; }
details > summary:hover { text-decoration: underline; }
details[open] > summary { margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); margin: 0; padding: 10px 0 14px 14px; overflow-wrap: anywhere; }
.timeline li:last-child { padding-bottom: 4px; }
.warn-list { padding: 12px 14px 12px 30px; background: #fff7e8; border-radius: 6px; }
.warn-list li { color: var(--orange); }
.pager { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; margin: 20px 0; font-size: 12px; }
.pager a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: white; text-decoration: none; }
.pager span { color: var(--muted); }
.device-code { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.result-list { list-style: none; padding: 0; }
.result-list li { padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 6px; background: white; }
.card-selection > button { margin-top: 16px; }
.card-instructions p { max-width: 105ch; }
.card-instructions > summary { font-weight: 650; }
.card-history td:last-child { min-width: 270px; }
.card-history td:last-child form + form { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.login-page main { max-width: 460px; padding: 64px 20px 30px; }
.login-brand { margin: 0 0 26px 8px; color: var(--navy); }
.login-brand .brand-mark { color: var(--teal); border-color: #9bafb9; }
.login-brand small { color: var(--muted); }
.login { padding: 30px; }
.login .mode-bar { margin-bottom: 24px; }
.login h1 { font-size: 24px; }
.login form { margin-top: 26px; }
.login input, .login button { width: 100%; min-height: 44px; }
.login label { margin-bottom: 18px; }
.login-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.about { max-width: 760px; margin: 42px auto; padding: 36px; }
.about h1 { overflow-wrap: anywhere; }
.about h1 .muted { font-size: 15px; font-weight: 400; }
@media (max-width: 1200px) {
  .sidebar { width: 200px; padding-inline: 12px; }
  .workspace { margin-left: 200px; }
  main, .top { padding-inline: 22px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid > .card { grid-column: auto; grid-row: auto; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 18px 20px; }
  .brand { font-size: 23px; }
  .brand-mark { width: 32px; height: 36px; }
  .navigation { margin-top: 12px; }
  .navigation > summary { min-height: 36px; padding: 8px 0; }
  .nav-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .nav-group + .nav-group { margin-top: 0; }
  .nav-group h2 { margin-left: 0; font-size: 9px; min-height: 24px; }
  .nav-group a { min-height: 44px; padding: 8px 6px; font-size: 12px; }
  .workspace { margin-left: 0; }
  main { padding: 22px 16px 36px; }
  .top { padding: 14px 16px; }
  .status { gap: 12px; }
  .worker-status { flex-basis: 100%; }
  .user-menu { margin-left: auto; }
  .user-name { max-width: 120px; }
  .page-header { margin-bottom: 20px; }
  h1 { font-size: 24px; }
  h2 { font-size: 17px; }
  .card { padding: 18px 16px; }
  .kv { grid-template-columns: minmax(95px, 30%) minmax(0, 1fr); gap: 10px 12px; }
  th, td { padding: 10px; }
  input, select, button, .btn, .status button { min-height: 44px; }
  details > summary { padding-block: 10px; min-height: 44px; }
  .section-nav a, .pager a { min-height: 44px; display: inline-flex; align-items: center; }
  label:has(> input[type="checkbox"]) { min-height: 44px; padding-block: 6px; }
  form.filters { padding: 14px; }
  .login-page main { padding-top: 32px; }
  .about { margin: 16px auto; padding: 24px 20px; }
}
@media (max-width: 420px) {
  .nav-groups { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
  .nav-group h2 { grid-column: 1 / -1; min-height: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .kv dd { margin-bottom: 12px; }
  .login { padding: 24px 20px; }
  .status-alert { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  .sidebar, .top, .skip-link, .filters, .section-nav, .actions, button, .btn { display: none; }
  .workspace { margin: 0; }
  body, .card { background: white; box-shadow: none; }
  main { max-width: none; padding: 0; }
  .grid { display: block; }
  .table-wrap { overflow: visible; }
}

/* Lista dashboardu zachowuje wszystkie wpisy; wysokość pozostałych sekcji bez limitu. */
.card-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-heading h2 { margin: 0; }
.card-heading a { font-size: 12px; }
.timeline-scroll { max-height: 28rem; overflow-y: auto; scrollbar-color: #8e9daf #edf1f5; padding-right: 12px; }
@media print { .timeline-scroll { max-height: none; overflow: visible; } }

.table-summary { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.table-summary strong { color: var(--fg); font-variant-numeric: tabular-nums; }
