:root {
  --green: #1f4e3d;
  --green-dark: #14362c;
  --blue: #8fb4d4;
  --blue-deep: #4f86ab;
  --paper: #f3f6f5;
  --card: #ffffff;
  --ink: #121816;
  --muted: #2a3a34;
  --line: #d5e2dc;
  --belt: #d4eadc;
  --warn: #8a5a12;
  --danger: #8d2f2f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(143, 180, 212, 0.45), transparent 60%),
    linear-gradient(160deg, #e7f0ea 0%, #f7f4ef 45%, #e4eef5 100%);
}
.login-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: 0 18px 50px rgba(20, 54, 44, 0.12);
  border: 1px solid #e3ebe7;
}
.login-card img { height: 72px; display: block; margin: 0 auto 8px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 8px 0 4px; color: var(--green); letter-spacing: 0.04em; }
.login-card p.lead { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
label { display: block; font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
  width: 100%;
  border: 1px solid #c9d7d1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 64px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--green);
  color: #fff;
  font-weight: 650;
}
.btn.secondary { background: #fff; color: var(--green); border: 1px solid #b7c9c2; }
.btn.blue { background: var(--blue-deep); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 12px; }
.linkish { background: none; border: 0; color: var(--blue-deep); padding: 0; text-decoration: underline; }
.msg { color: var(--danger); min-height: 1.2em; font-size: 14px; margin-top: 10px; }
.note { background: #f4f8fb; border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 13px; }

.top {
  background: var(--green-dark);
  color: #fff;
  padding: 0 8px;
}
.top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 58px;
  margin: 0 -8px;
  padding: 0 12px;
  background: #fff;
  color: var(--green);
}
.top-logo {
  width: 96px;
  height: 54px;
  overflow: hidden;
  position: relative;
  justify-self: center;
  display: block;
}
.top-logo img {
  position: absolute;
  width: 133.44%;
  height: auto;
  max-width: none;
  left: -16.64%;
  top: -32.96%;
}
.brand { display: flex; flex-direction: row; align-items: baseline; gap: 10px; line-height: 1; justify-self: start; white-space: nowrap; }
.brand strong { letter-spacing: 0.06em; font-size: 30px; font-weight: 800; color: var(--green); }
.brand span { font-size: 24px; font-weight: 700; color: var(--green); }
.who { font-size: 13px; font-weight: 700; color: var(--green); text-align: right; justify-self: end; }
.under-tabs { display: flex; justify-content: flex-end; gap: 8px; padding: 2px 0 4px; }
.under-tabs:has(> .hidden) { display: none; }
.under-tabs .bar-btn {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.under-tabs .bar-btn:disabled { opacity: 0.55; cursor: default; }
.refresh-status {
  margin: 0;
  padding: 0 8px 4px;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
  line-height: 1.3;
}
.langs { display: flex; gap: 4px; }
.langs button, .tools button, .tabs button {
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 6px 6px 0 0;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
}
.langs button.on, .tabs button.on { background: var(--paper); color: var(--green); font-weight: 800; }
.tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px 0 4px; justify-content: flex-start; }
.tools button, .filters button, .filters select, .filters input {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 6px;
  padding: 3px 8px;
  font-weight: 700;
}
.filters { display: flex; gap: 6px; align-items: center; justify-content: flex-start; padding-bottom: 6px; }
.filters input, .filters select { width: auto; min-width: 0; flex: 0 0 auto; font-weight: 700; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-icon {
  position: absolute;
  left: 8px;
  width: 15px;
  height: 15px;
  color: #fff;
  pointer-events: none;
}
.filters .search-box input { width: 240px; padding-left: 28px; }
.size-pick { position: relative; }
.size-pick > button {
  position: relative;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 6px;
  padding: 3px 26px 3px 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-width: 158px;
  text-align: left;
}
.size-pick > button::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  margin-top: -2px;
  border: 5px solid transparent;
  border-top-color: #fff;
}
.size-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  color: #121816;
  border: 1px solid #c5d4ce;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(20, 54, 44, 0.2);
  padding: 4px;
}
.size-menu button {
  display: block;
  width: 100%;
  background: #fff;
  color: #121816;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font-weight: 400;
  padding: 7px 10px;
}
.size-menu button:hover,
.size-menu button.on { background: #1f4e3d; color: #fff; }
.tabs { display: flex; gap: 2px; margin-top: 2px; justify-content: flex-start; }
.tabs button.tab-right { margin-left: auto; }

.page { padding: 6px 8px 28px; }
.workspace { display: flex; align-items: flex-start; gap: 8px; }
#screen { flex: 1 1 auto; min-width: 0; }
.catalog-pane {
  flex: 0 0 min(720px, 46vw);
  width: min(720px, 46vw);
  height: calc(100vh - 118px);
  position: sticky;
  top: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.catalog-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--green-dark);
  color: #fff;
}
.catalog-bar strong { font-size: 13px; font-weight: 800; margin-right: auto; }
.catalog-bar .btn {
  background: #fff;
  color: var(--green);
  text-decoration: none;
  border: 0;
  white-space: nowrap;
}
.catalog-bar .btn:hover { background: #e7f0ea; }
.catalog-note {
  margin: 0;
  padding: 6px 8px;
  background: #f4f8fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.catalog-pane iframe { flex: 1; width: 100%; border: 0; background: #525659; }
a.cat.on { background: #d9eadf; border-radius: 4px; padding: 0 4px; }
@media (max-width: 1100px) {
  .workspace { flex-direction: column; }
  .catalog-pane {
    position: relative;
    top: 0;
    width: 100%;
    flex-basis: auto;
    height: 72vh;
  }
}
.summary {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: #111;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  width: fit-content;
  max-width: 100%;
}
table.cenik {
  border-collapse: collapse;
  width: max-content;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  line-height: 1.15;
}
table.cenik th, table.cenik td {
  border: 1px solid #c5d4ce;
  padding: 2px 5px;
  vertical-align: middle;
  white-space: nowrap;
}
table.cenik th {
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
  letter-spacing: 0;
  height: 40px;
}
table.cenik td.num, table.cenik th.num { text-align: right; white-space: nowrap; }
table.cenik td.motor { text-align: center; }
table.cenik td.code { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
table.cenik td.thin,
table.cenik td.thin .sub { font-weight: 400; }
table.cenik td.num.total { font-weight: 800; }
table.cenik tr.belt td { background: var(--belt); }
table.cenik tr.direct td { background: #fff; }
table.cenik tr.is-on td { box-shadow: inset 0 0 0 999px rgba(79, 134, 171, 0.5); }
table.cenik input[type="checkbox"] { width: 15px; height: 15px; margin: 0; }
.sub { display: block; color: #1b2a24; font-size: 12px; font-weight: 700; line-height: 1.15; }
table.cenik td.drive { width: 1%; vertical-align: middle; text-align: center; }
table.cenik th.ptc,
table.cenik td.ptc {
  width: 1%;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}
table.cenik th.sleeve {
  width: 1%;
  white-space: normal;
  line-height: 1.05;
  height: auto;
  padding-left: 3px;
  padding-right: 3px;
}
table.cenik td.code.sleeve {
  width: 1%;
  white-space: normal;
  text-align: center;
  line-height: 1.05;
  padding: 1px 3px;
  vertical-align: middle;
}
table.cenik td.code.sleeve .sleeve-line,
table.cenik td.code.sleeve .sleeve-plus { display: block; }
table.cenik td.iso { text-align: center; }
.mount { display: block; margin: 0; font-size: 12px; letter-spacing: 0; color: var(--green); font-weight: 800; line-height: 1.15; }
.star { color: var(--warn); }
a.cat { color: var(--blue-deep); font-weight: 700; }
.foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  max-width: 1100px;
}

.admin { display: grid; gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card h2 { margin: 0 0 10px; font-size: 18px; color: var(--green); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; align-items: end; }
.subtabs { display: flex; gap: 6px; margin-bottom: 8px; align-items: center; }
.subtabs .motor-update { margin-left: auto; }
.subtabs button.on { background: var(--green); color: #fff; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th, table.plain td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
table.plain th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.off { opacity: 0.55; }
.warn-list { max-height: 180px; overflow: auto; font-size: 12px; color: var(--warn); }

.print-sheet { display: none; }
@media print {
  body { background: #fff; }
  .top, .workspace, .summary, #screen, .catalog-pane, .no-print { display: none !important; }
  .page { padding: 0 !important; }
  .print-sheet, .print-sheet * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-sheet { display: block; zoom: 0.52; }
  .print-sheet h1 {
    margin: 0 0 2px;
    font-size: 18px;
    font-weight: 800;
    color: #1f4e3d;
  }
  .print-sheet p {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #111;
  }
  .print-sheet table.cenik {
    width: max-content;
    font-size: 15px;
    line-height: 1.15;
    border-collapse: collapse;
  }
  .print-sheet table.cenik th {
    position: static;
    height: 40px;
    font-size: 13px;
    padding: 4px 6px;
    white-space: nowrap;
    max-width: none;
    background: #1f4e3d !important;
    color: #fff !important;
  }
  .print-sheet table.cenik tr.sheet-tab th {
    height: auto;
    font-size: 16px;
    text-align: left;
    padding: 6px 8px;
  }
  .print-sheet table.cenik tr.direct td { background: #fff !important; }
  .print-sheet table.cenik tr.belt td { background: #d4eadc !important; }
  .print-sheet table.cenik td { padding: 2px 5px; }
  .print-sheet .sub { font-size: 12px; line-height: 1.15; color: #1b2a24; }
  .print-sheet .mount { font-size: 12px; color: #1f4e3d !important; }
  .print-sheet thead { display: table-header-group; }
  .print-sheet tr { break-inside: avoid; page-break-inside: avoid; }
  @page { margin: 6mm; }
}
