:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #1d2430;
  --muted: #647083;
  --line: #d9e0e8;
  --primary: #116a7b;
  --primary-dark: #0b4f5c;
  --accent: #cf6f2d;
  --danger: #b42318;
  --warning-bg: #fff4df;
  --warning-text: #8a4b0f;
  --shadow: 0 16px 40px rgba(29, 36, 48, 0.08);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #edf7f6, #f6f7f9 55%, #eef2ff);
}

.login-shell {
  width: min(100%, 430px);
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  padding: 28px;
}

.login-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-heading h1,
.login-heading p {
  margin: 0;
}

.login-heading p {
  margin-top: 4px;
  color: var(--muted);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 16px;
}

.password-field {
  position: relative;
  display: block;
  margin-top: 6px;
}

.password-field input {
  width: 100%;
  padding-right: 74px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 58px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #dfe9ef;
  outline: 2px solid transparent;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

/* Session controls are navigation, not part of a printable document. */
body.document-body .session-controls {
  display: none !important;
}

.session-controls {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.session-user {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 680px) {
  .session-controls {
    width: 100%;
  }

  .session-logout {
    flex: 1;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  background: rgba(246, 247, 249, 0.96);
  padding: 12px 0;
  backdrop-filter: blur(8px);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 -16px;
  z-index: -1;
  background: rgba(246, 247, 249, 0.96);
  box-shadow: 0 10px 24px rgba(29, 36, 48, 0.08);
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.topbar p,
.panel-heading p,
.toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions,
.filters,
.field-row,
.barcode-field,
.label-actions,
.label-controls,
.movement-form {
  display: flex;
  gap: 10px;
}

.primary,
.secondary,
.ghost,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--line);
}

.ghost {
  background: var(--surface-soft);
  color: var(--text);
}

.full {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric {
  --module-accent: var(--primary);
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  padding: 18px 18px 18px 22px;
  border-left: 5px solid var(--module-accent);
}

.metric:nth-child(1) {
  --module-accent: #2563eb;
}

.metric:nth-child(2) {
  --module-accent: #0f766e;
}

.metric:nth-child(3) {
  --module-accent: #b45309;
}

.metric:nth-child(4) {
  --module-accent: #4f46e5;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.metric.warning {
  --module-accent: #d97706;
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #f2c37a;
  border-left-color: var(--module-accent);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.workspace > .panel:first-child {
  max-width: 760px;
}

.workspace > .panel:nth-child(1),
.client-top-grid > .panel:nth-child(1),
.settings-grid > .panel:nth-child(1),
.order-details-panel {
  --module-accent: #2563eb;
  --module-soft: #eff6ff;
}

.workspace > .panel:nth-child(2),
.client-top-grid > .panel:nth-child(2),
.settings-grid > .panel:nth-child(2),
.order-stock-panel {
  --module-accent: #0f766e;
  --module-soft: #ecfdf5;
}

.workspace > .panel:nth-child(3),
.client-workspace > .panel:nth-child(1),
.settings-grid > .panel:nth-child(3),
.order-lines-panel {
  --module-accent: #b45309;
  --module-soft: #fffbeb;
}

.workspace > .panel:nth-child(4),
.client-workspace > .panel:nth-child(2),
.settings-grid > .panel:nth-child(4),
.table-panel {
  --module-accent: #4f46e5;
  --module-soft: #eef2ff;
}

.panel {
  --module-accent: var(--primary);
  --module-soft: #f8fbfc;
  overflow: hidden;
  border-radius: 8px;
  padding: 18px;
  border-left: 5px solid var(--module-accent);
}

.panel.order-details-panel {
  --module-accent: #2563eb;
  --module-soft: #eff6ff;
}

.panel.order-stock-panel {
  --module-accent: #0f766e;
  --module-soft: #ecfdf5;
}

.panel.order-lines-panel {
  --module-accent: #b45309;
  --module-soft: #fffbeb;
}

.panel-heading,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -18px -18px 16px;
  padding: 15px 18px;
  background: var(--module-soft);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.panel-heading-actions {
  display: flex;
  gap: 10px;
}

.panel-heading h2,
.toolbar h2 {
  color: var(--module-accent);
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

.form-stack {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #9aa6b5;
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17, 106, 123, 0.14);
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.field-row > label {
  flex: 1;
}

.barcode-field input {
  flex: 1;
}

.barcode-field button {
  flex: 0 0 auto;
}

.table-panel {
  min-width: 0;
}

.filters {
  width: min(620px, 100%);
}

.stock-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: min(860px, 100%);
}

.filters input {
  flex: 1;
}

.filters select {
  width: 180px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.utility-hidden {
  display: none !important;
}

.stock-table-wrap {
  max-height: 668px;
  overflow: auto;
}

.stock-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.select-column {
  width: 44px;
  text-align: center;
}

.select-column input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

table {
  width: 100%;
  min-width: 1130px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.sort-header span {
  display: inline-flex;
  justify-content: center;
  min-width: 12px;
  color: var(--primary);
}

.sort-header.active,
.sort-header:hover {
  color: var(--primary);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.product-name {
  font-weight: 700;
}

.note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.barcode-value {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 7px;
  background: #f4f1ea;
  color: #332f28;
  padding: 0 9px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 700;
  font-size: 13px;
}

.status.low {
  background: #ffe8e5;
  color: var(--danger);
}

.status.ok {
  background: #e7f5ed;
  color: #147a43;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-height: 34px;
  border-radius: 7px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
}

.icon-button.danger {
  color: var(--danger);
}

.icon-button.success {
  background: #e7f5ed;
  color: #147a43;
}

.icon-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.table-text-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 10px;
  text-align: left;
  font-weight: 700;
}

.table-text-button:hover {
  color: var(--primary);
}

.product-name-button {
  padding-left: 0;
  background: transparent;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.movement-panel {
  margin-top: 18px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.client-workspace {
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1fr);
  margin-top: 18px;
}

.client-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.order-fields,
.order-line-form,
.custom-line-form {
  display: grid;
  gap: 13px;
}

.order-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-line-form {
  grid-template-columns: minmax(0, 1fr) 120px 140px auto;
  align-items: end;
}

.order-line-form .selected-product {
  grid-column: 1 / 4;
  margin-top: 0;
}

.order-line-form > button[type="submit"] {
  grid-column: 4;
  align-self: stretch;
}

.scan-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.scan-button {
  min-width: 96px;
}

.custom-line-form {
  grid-template-columns: minmax(220px, 1fr) 100px 130px 130px auto auto;
  align-items: end;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.custom-line-section {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.selected-product {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 11px 12px;
  color: var(--muted);
}

.selected-product strong,
.selected-product span {
  display: block;
}

.selected-product strong {
  color: var(--text);
  margin-bottom: 4px;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.62);
  padding: 18px;
}

.scanner-modal[hidden] {
  display: none;
}

.scanner-card {
  width: min(680px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  padding: 16px;
}

.scanner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.scanner-header h2 {
  margin: 0 0 4px;
}

.scanner-header p {
  margin: 0;
  color: var(--muted);
}

.scanner-view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #111827;
}

.scanner-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-reader-view {
  display: grid;
  place-items: center;
}

#barcodeScannerReader {
  width: 100%;
  min-height: 100%;
}

#barcodeScannerReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

#barcodeScannerReader canvas {
  display: none;
}

.scanner-frame {
  position: absolute;
  inset: 28% 12%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.22);
}

.scanner-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.image-scan-button {
  cursor: pointer;
}

.warehouse-shell {
  width: min(760px, calc(100% - 20px));
  margin: 0 auto;
  padding: 12px 0 32px;
}

.warehouse-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(246, 247, 249, 0.97);
  padding: 10px 0;
  margin-bottom: 10px;
}

.warehouse-topbar h1 {
  margin: 0;
  font-size: 30px;
}

.warehouse-topbar p {
  margin: 3px 0 0;
  color: var(--muted);
}

.warehouse-tabs {
  position: sticky;
  top: 74px;
  z-index: 19;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(246, 247, 249, 0.97);
  padding: 8px 0 12px;
}

.warehouse-tab {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-weight: 800;
}

.warehouse-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.warehouse-view {
  display: none;
}

.warehouse-view.active {
  display: grid;
  gap: 14px;
}

.warehouse-card {
  --section-accent: var(--primary);
  --section-soft: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, var(--section-accent) 0 5px, #fff 5px);
  box-shadow: var(--shadow);
  padding: 0 14px 14px 18px;
  overflow: hidden;
}

.warehouse-card-order {
  --section-accent: #2563eb;
  --section-soft: #eff6ff;
}

.warehouse-card-product {
  --section-accent: #0f766e;
  --section-soft: #ecfdf5;
}

.warehouse-card-lines {
  --section-accent: #b45309;
  --section-soft: #fffbeb;
}

.warehouse-card-list {
  --section-accent: #4f46e5;
  --section-soft: #eef2ff;
}

.warehouse-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -14px 14px -18px;
  padding: 12px 14px 12px 18px;
  background: var(--section-soft);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.warehouse-card-heading h2 {
  margin: 0;
  color: var(--section-accent);
  font-size: 19px;
}

.warehouse-card-heading span,
.warehouse-card-heading strong {
  color: var(--muted);
  text-align: right;
}

.warehouse-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.warehouse-card label,
.warehouse-card input,
.warehouse-card button,
.warehouse-card .empty-state,
.warehouse-card .warehouse-lines,
.warehouse-card .warehouse-orders {
  position: relative;
}

.warehouse-card input {
  min-height: 48px;
  font-size: 16px;
}

.warehouse-card label + label,
.warehouse-product-form label + .warehouse-qty-row,
.warehouse-product-form .warehouse-wide-button {
  margin-top: 12px;
}

.warehouse-product-results,
.warehouse-client-results {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.warehouse-product-results[hidden],
.warehouse-client-results[hidden] {
  display: none;
}

.warehouse-product-result,
.warehouse-client-result {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.warehouse-product-result span,
.warehouse-client-result span {
  color: var(--muted);
  font-size: 13px;
}

.warehouse-qty-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.warehouse-wide-button {
  width: 100%;
  min-height: 50px;
}

.warehouse-lines,
.warehouse-orders {
  display: grid;
  gap: 10px;
}

.warehouse-line,
.warehouse-order-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.warehouse-line {
  border-left: 4px solid var(--section-accent);
}

.warehouse-order-card {
  border-left: 4px solid #4f46e5;
}

.warehouse-line strong,
.warehouse-order-card strong {
  display: block;
}

.warehouse-line span,
.warehouse-order-card span,
.warehouse-order-card small,
.warehouse-order-card p {
  color: var(--muted);
}

.warehouse-line p,
.warehouse-order-card p {
  margin: 0;
}

.warehouse-line-controls,
.warehouse-order-footer,
.warehouse-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.warehouse-line-controls input {
  width: 92px;
}

.warehouse-line-total {
  font-weight: 800;
  color: var(--primary);
}

.warehouse-actions {
  margin-top: 14px;
}

.warehouse-actions button {
  flex: 1;
  min-height: 48px;
}

.warehouse-order-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.warehouse-order-actions .icon-button {
  min-height: 40px;
}

.customer-combobox,
.product-combobox {
  position: relative;
}

.customer-dropdown,
.product-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 34px rgba(29, 36, 48, 0.16);
  padding: 6px;
}

.customer-dropdown {
  position: static;
  max-height: none;
  margin-top: 6px;
  overflow: visible;
}

.product-dropdown {
  position: static;
  max-height: 172px;
  margin-top: 6px;
}

.sales-page .order-stock-panel {
  position: relative;
  z-index: 10;
  overflow: visible;
}

.sales-page .order-lines-panel {
  position: relative;
  z-index: 1;
}

.sales-page .product-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  margin-top: 0;
  overflow-y: auto;
}

.selected-product-package {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.selected-product-package[hidden] {
  display: none;
}

.inline-product-combobox {
  display: grid;
  gap: 6px;
}

.inline-product-dropdown {
  max-height: 172px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(29, 36, 48, 0.12);
  padding: 6px;
}

.customer-option,
.product-option {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: auto;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.customer-option:hover,
.customer-option:focus,
.product-option:hover,
.product-option:focus {
  background: var(--surface-soft);
}

.customer-option span,
.product-option span {
  color: var(--muted);
  font-size: 13px;
}

.customer-option.muted,
.product-option.muted {
  color: var(--muted);
  cursor: default;
}

.order-lines-panel,
.order-history-panel,
.client-import-panel,
.integration-panel {
  margin-top: 18px;
}

.order-total {
  font-size: 26px;
  color: var(--module-accent);
}

.order-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.order-submit-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 14px;
}

.order-submit-row .primary,
.order-submit-row .secondary {
  min-width: 220px;
}

.order-filters {
  display: flex;
  gap: 10px;
  width: min(680px, 100%);
}

.order-filters input {
  flex: 1;
}

.order-filters select {
  width: 170px;
}

.order-table {
  min-width: 980px;
}

.order-lines-table {
  min-width: 720px;
}

.order-lines-table td[data-label="Toode"] {
  width: 100%;
  min-width: 280px;
}

.orders-table {
  min-width: 1080px;
}

.order-list-wrap {
  max-height: min(620px, calc(100vh - 310px));
  overflow: auto;
}

.order-list-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f7;
}

.order-content {
  display: inline-block;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.35;
}

.order-history {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.order-history span {
  display: grid;
  gap: 3px;
}

.order-history small {
  color: var(--muted);
}

.orders-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 14px;
}

.order-empty {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--muted);
  padding: 18px;
}

.order-card-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.order-card-main strong {
  font-size: 16px;
}

.order-card-main span,
.order-card-main small {
  color: var(--muted);
  font-size: 13px;
}

.order-card-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.order-editor-panel {
  margin-top: 18px;
}

.edit-order-lines-wrap {
  margin-top: 16px;
}

.line-quantity-input,
.line-price-input,
.line-discount-input {
  width: 96px;
}

.order-line-quantity {
  display: grid;
  gap: 3px;
}

.order-line-quantity > span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.order-line-quantity small,
.price-unit {
  color: var(--muted);
  font-size: 12px;
}

.edit-line-product-select {
  min-width: 260px;
}

.order-table .edit-line-product-select {
  min-width: 220px;
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  overflow: hidden;
  resize: none;
  line-height: 1.3;
}

.order-editor-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
}

.order-editor-footer strong {
  color: var(--primary);
  font-size: 24px;
}

.client-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.client-import-actions {
  display: grid;
  gap: 10px;
}

.client-import-grid-stacked {
  grid-template-columns: 1fr;
}

.client-import-actions-row {
  display: flex;
  justify-content: flex-end;
}

.compact-search {
  width: min(340px, 100%);
}

.client-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  max-height: 344px;
  overflow-y: auto;
  padding-right: 4px;
}

.client-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.client-list span {
  display: grid;
  gap: 3px;
}

.client-list small {
  color: var(--muted);
}

.client-card-lines {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.client-card-lines strong {
  font-size: 15px;
}

.client-card-lines span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.client-list-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.client-form {
  display: grid;
  gap: 13px;
}

.registry-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.registry-message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.registry-results {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.registry-results li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.registry-results span {
  display: grid;
  gap: 3px;
}

.registry-results small {
  color: var(--muted);
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 13px;
  font-weight: 700;
}

.sync-status.synced {
  background: #e7f5ed;
  color: #147a43;
}

.sync-status.failed {
  background: #ffe8e5;
  color: var(--danger);
}

.sync-status.converted {
  background: #eef2ff;
  color: #4338ca;
}

.sync-counter {
  color: var(--primary);
  font-size: 20px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.integration-grid article {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 13px;
}

.integration-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.integration-grid strong {
  display: block;
  margin-top: 6px;
}

.integration-grid p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.label-preview-panel {
  margin-top: 18px;
}

.label-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.label-controls {
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.label-controls label {
  flex: 1 1 220px;
}

.label-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.barcode-label {
  display: grid;
  gap: 7px;
  min-height: 145px;
  border: 1px dashed #9aa8b6;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  color: #111;
}

.barcode-label-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.barcode-label-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #333;
  font-size: 11px;
}

.barcode-label svg {
  width: 100%;
  height: 82px;
  display: block;
}

.barcode-label-number {
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
}

.label-warning {
  border: 1px solid #f2c37a;
  border-radius: 7px;
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 12px;
}

.movement-form {
  align-items: end;
  flex-wrap: wrap;
}

.movement-form label {
  flex: 1 1 180px;
}

.movement-form button {
  flex: 0 0 auto;
}

.movement-document-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 14px;
}

.movement-line-form {
  margin-bottom: 14px;
}

.movement-document-table {
  margin-top: 8px;
}

.movement-document-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
}

.movement-document-view {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.history {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.history ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.history li {
  display: grid;
  grid-template-columns: 140px minmax(170px, 1fr) minmax(140px, 0.8fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fbfcfd;
}

.movement-time,
.movement-details {
  display: grid;
  gap: 3px;
}

.movement-time span,
.movement-details span,
.movement-reason {
  color: var(--muted);
  font-size: 13px;
}

.movement-time strong,
.movement-details strong {
  font-size: 14px;
}

.movement-empty {
  display: block;
  color: var(--muted);
}

.movement-reason {
  text-align: right;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-page[hidden] {
  display: none;
}

.settings-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.settings-nav a {
  flex: 0 0 auto;
  border-radius: 7px;
  padding: 11px 16px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.settings-nav a:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.settings-nav a.is-active {
  background: var(--primary);
  color: #fff;
}

.settings-page-main-panel,
.settings-global-message {
  grid-column: 1 / -1;
}

.settings-global-message {
  margin-top: 12px;
}

.role-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
  gap: 12px;
}

.permission-fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.permission-fieldset legend {
  padding-inline: 6px;
  color: var(--text);
  font-weight: 800;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.permission-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface-soft);
  cursor: pointer;
}

.permission-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.permission-option span,
.role-list-info {
  display: grid;
  gap: 3px;
}

.permission-option small,
.role-list-info span {
  color: var(--muted);
  font-size: 12px;
}

.role-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.role-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-message {
  min-height: 22px;
  color: var(--primary);
  font-weight: 700;
}

.settings-message.success {
  color: #0f766e;
}

.settings-message.error {
  color: var(--danger);
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--text);
  font-weight: 700;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.company-logo-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.company-logo-preview {
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.settings-grid .panel:last-child {
  grid-column: 1 / -1;
}

.user-access-section {
  container-type: inline-size;
}

.user-access-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.75fr) minmax(0, 1fr) minmax(140px, 0.5fr) auto auto;
  gap: 10px;
  align-items: end;
}

.access-user-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.access-user-lines {
  display: grid;
  gap: 3px;
}

.access-user-lines span {
  color: var(--muted);
  font-size: 13px;
}

.access-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

@container (max-width: 760px) {
  .user-access-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-access-form button {
    width: 100%;
  }

  .access-user-list li {
    align-items: stretch;
    flex-direction: column;
  }

  .access-user-actions {
    justify-content: flex-start;
  }
}

@container (max-width: 440px) {
  .user-access-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .topbar,
  .panel-heading,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .filters {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .order-layout,
  .order-fields,
  .order-line-form,
  .custom-line-form,
  .order-filters,
  .client-top-grid,
  .client-import-grid,
  .registry-search-form,
  .integration-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .order-filters {
    flex-direction: column;
  }

  .order-line-form .selected-product,
  .order-line-form > button[type="submit"] {
    grid-column: auto;
  }

  .user-access-form {
    grid-template-columns: 1fr;
  }

  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-filters select {
    width: 100%;
  }

  .scan-input-row {
    grid-template-columns: 1fr;
  }

  .scan-button {
    width: 100%;
  }

  .scanner-modal {
    align-items: stretch;
    padding: 10px;
  }

  .scanner-card {
    display: grid;
    align-content: start;
    width: 100%;
  }

  .order-history-panel .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .order-history-panel .order-list-wrap {
    max-height: min(620px, calc(100vh - 280px));
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #f8fafc;
  }

  .orders-table {
    display: block;
    min-width: 0;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tbody {
    display: grid;
    gap: 10px;
  }

  .orders-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
  }

  .orders-table td {
    display: block;
    border-bottom: 0;
    padding: 0;
  }

  .orders-table td:nth-child(1) {
    min-width: 0;
  }

  .orders-table td:nth-child(1) .table-text-button {
    justify-content: flex-start;
    max-width: 100%;
    padding: 4px 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    white-space: normal;
  }

  .orders-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
  }

  .orders-table td:nth-child(2),
  .orders-table td:nth-child(3) {
    color: var(--muted);
    font-size: 13px;
  }

  .orders-table td:nth-child(2) {
    grid-column: 1;
  }

  .orders-table td:nth-child(3) {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .orders-table td:nth-child(4),
  .orders-table td:nth-child(5),
  .orders-table td:nth-child(7),
  .orders-table td:nth-child(8) {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .orders-table .order-content {
    max-width: none;
    font-size: 14px;
  }

  .orders-table .sync-status {
    min-height: 26px;
    padding-inline: 9px;
  }

  .orders-table .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .orders-table .icon-button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 18px;
  }

  .settings-nav {
    margin-inline: -2px;
  }

  .role-editor-fields,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .role-list li {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar::before {
    inset: 0 -10px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .summary-grid,
  .field-row,
  .barcode-field,
  .label-actions,
  .label-controls,
  .filters,
  .topbar-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  }

  .topbar-actions .button-link,
  .topbar-actions button {
    min-width: 0;
    padding-inline: 10px;
    text-align: center;
  }

  .stock-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .filters select {
    width: 100%;
  }

  .metric strong {
    font-size: 26px;
  }

  .history li {
    grid-template-columns: 1fr;
  }

  .movement-reason {
    text-align: left;
  }

  .client-list li,
  .access-user-list li,
  .company-logo-preview-wrap,
  .registry-results li,
  .order-card,
  .order-heading-actions,
  .client-list-actions,
  .access-user-actions,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .order-submit-row .primary,
  .order-submit-row .secondary {
    width: 100%;
  }

  .order-submit-row {
    flex-direction: column-reverse;
  }

  .order-card-side {
    justify-items: start;
  }

  .order-history-panel .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .order-history-panel .order-list-wrap {
    max-height: min(620px, calc(100vh - 280px));
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #f8fafc;
  }

  .orders-table {
    display: block;
    min-width: 0;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tbody {
    display: grid;
    gap: 10px;
  }

  .orders-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
  }

  .orders-table td {
    display: block;
    border-bottom: 0;
    padding: 0;
  }

  .orders-table td:nth-child(1) {
    min-width: 0;
  }

  .orders-table td:nth-child(1) .table-text-button {
    justify-content: flex-start;
    max-width: 100%;
    padding: 4px 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    white-space: normal;
  }

  .orders-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
  }

  .orders-table td:nth-child(2),
  .orders-table td:nth-child(3) {
    color: var(--muted);
    font-size: 13px;
  }

  .orders-table td:nth-child(2) {
    grid-column: 1;
  }

  .orders-table td:nth-child(3) {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .orders-table td:nth-child(4),
  .orders-table td:nth-child(5),
  .orders-table td:nth-child(7),
  .orders-table td:nth-child(8) {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .orders-table .order-content {
    max-width: none;
    font-size: 14px;
  }

  .orders-table .sync-status {
    min-height: 26px;
    padding-inline: 9px;
  }

  .orders-table .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .orders-table .icon-button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }
}

@media (max-width: 980px) {
  .responsive-card-table:not(.order-list-table) {
    display: block;
    min-width: 0;
  }

  .responsive-card-table:not(.order-list-table) thead {
    display: none;
  }

  .responsive-card-table:not(.order-list-table) tbody {
    display: grid;
    gap: 10px;
  }

  .responsive-card-table:not(.order-list-table) tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
  }

  .responsive-card-table:not(.order-list-table) td {
    display: grid;
    grid-template-columns: minmax(82px, 0.38fr) minmax(0, 1fr);
    align-items: center;
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    text-align: left;
    gap: 10px;
    border-bottom: 0;
    padding: 0;
  }

  .responsive-card-table:not(.order-list-table) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .responsive-card-table:not(.order-list-table) td[colspan] {
    display: block;
  }

  .responsive-card-table:not(.order-list-table) td[colspan]::before {
    content: "";
  }

  .responsive-card-table:not(.order-list-table) .select-column {
    width: auto;
    justify-content: start;
    text-align: left;
  }

  .responsive-card-table:not(.order-list-table) .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .responsive-card-table:not(.order-list-table) .icon-button {
    width: 100%;
    min-width: 0;
  }

  .responsive-card-table:not(.order-list-table) input,
  .responsive-card-table:not(.order-list-table) select {
    min-width: 0;
    width: 100%;
  }

  .responsive-card-table:not(.order-list-table) .table-text-button {
    justify-content: flex-start;
    max-width: 100%;
    padding: 4px 0;
    white-space: normal;
  }

  .responsive-card-table:not(.order-list-table) .barcode-value {
    width: fit-content;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .order-lines-table td[data-label="Toode"] {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .order-lines-table td[data-label="Toode"]::before {
    margin-bottom: 2px;
  }

  .order-lines-table .inline-product-combobox,
  .order-lines-table .edit-line-product-select {
    width: 100%;
    min-width: 0;
  }

  .stock-table-wrap {
    max-height: none;
    overflow: visible;
  }
}

.settings-nav [hidden] {
  display: none !important;
}

.warehouse-danger-zone {
  border-left: 4px solid var(--danger);
}

.warehouse-danger-zone h2 {
  color: var(--danger);
}

.warehouse-danger-button {
  background: var(--danger);
}

.warehouse-danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Keep account controls above navigation, anchored to the sticky header. */
@media screen {
  .topbar:has(.session-controls) {
    padding-top: 64px;
  }

  .topbar .session-controls {
    position: absolute;
    top: 8px;
    right: 0;
    width: auto;
    max-width: 100%;
    justify-content: flex-end;
  }

  .topbar .session-controls form {
    flex: 0 0 auto;
    margin: 0;
  }

  .topbar .session-user {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .session-logout {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@page label-page {
  size: 100mm 150mm;
  margin: 0;
}

@media print {
  .session-controls {
    display: none !important;
  }

  body.labels-page {
    background: #fff;
  }

  body.labels-page .topbar,
  body.labels-page .summary-grid,
  body.labels-page .workspace,
  body.labels-page .movement-panel,
  body.labels-page .label-preview-panel > .panel-heading,
  body.labels-page .label-controls,
  body.labels-page .label-warning {
    display: none;
  }

  body.labels-page .app-shell {
    width: 100mm;
    margin: 0;
    padding: 0;
  }

  body.labels-page .label-preview-panel {
    display: block;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  body.labels-page .label-preview-grid {
    display: block;
  }

  body.labels-page .barcode-label {
    page: label-page;
    width: 100mm;
    height: 150mm;
    min-height: 150mm;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 11mm 9mm;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6mm;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
    overflow: hidden;
  }

  body.labels-page .barcode-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.labels-page .barcode-label-title {
    font-size: 18pt;
    line-height: 1.15;
  }

  body.labels-page .barcode-label-meta {
    font-size: 11pt;
  }

  body.labels-page .barcode-label svg {
    height: 58mm;
  }

  body.labels-page .barcode-label-number {
    font-size: 16pt;
  }
}

/* Compact sales order actions, matching the offers list. */
.order-list-table .actions { display:flex; flex-wrap:nowrap; align-items:center; gap:5px; }
.order-list-table .actions .icon-button { display:inline-flex; align-items:center; justify-content:center; width:auto; height:30px; min-width:30px; padding:5px 8px; font-size:12px; line-height:1; white-space:nowrap; flex-shrink:0; }
.order-list-table .actions svg { display:block; pointer-events:none; }

/* Shared navigation for the separate warehouse movement pages. */
.movement-navigation { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.movement-navigation a[aria-current="page"] { background: #116b7c; border-color: #116b7c; color: #fff; }
.movement-navigation a:focus-visible { outline: 3px solid #238ca1; outline-offset: 3px; }
.movement-summary { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 0 0 20px; }
.movement-summary .metric { display: flex; flex-direction: row; align-items: baseline; gap: 8px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.movement-summary .metric strong { font-size: 18px; }

/* Compact stock overview, scoped to the inventory page. */
.inventory-navigation { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
.inventory-summary { display:flex; flex-wrap:wrap; gap:12px 32px; margin-bottom:20px; }
.inventory-summary .metric { display:flex; flex-direction:row; align-items:baseline; gap:9px; padding:0; border:0; background:transparent; box-shadow:none; }
.inventory-summary .metric strong { font-size:20px; }
.inventory-page .stock-toolbar-actions { width:auto; flex-wrap:wrap; }
.inventory-page .stock-toolbar-actions button { white-space:nowrap; }
.inventory-page .inventory-filters { display:flex; width:100%; gap:12px; margin-bottom:16px; }
.inventory-page .inventory-filters input { min-width:0; }
.inventory-page .stock-table td { padding:12px 10px; }
.inventory-page .stock-table .actions { flex-wrap:nowrap; gap:6px; }
.inventory-page .stock-table .icon-button { display:inline-flex; justify-content:center; align-items:center; width:34px; height:34px; padding:8px; }
@media(max-width:700px) {
 .inventory-page .toolbar { align-items:stretch; flex-direction:column; }
 .inventory-page .stock-toolbar-actions { justify-content:flex-start; }
 .inventory-page .inventory-filters { flex-direction:column; }
 .inventory-page .inventory-filters select { width:100%; }
}

/* Sales list uses the same compact summary and separate search row as stock. */
.orders-summary { display:flex; flex-wrap:wrap; gap:12px 32px; margin-bottom:20px; }
.orders-summary .metric { display:flex; flex-direction:row; align-items:baseline; gap:9px; padding:0; border:0; background:transparent; box-shadow:none; }
.orders-summary .metric strong { font-size:20px; }
.orders-page .order-history-panel > .order-filters { display:flex; width:100%; max-width:none; gap:12px; margin-bottom:16px; }
.orders-page .order-filters input { flex:1; min-width:0; width:auto; }
.orders-page .order-filters select { width:180px; }
.orders-page .panel-heading > .button-link { white-space:nowrap; }
@media(max-width:700px) {
 .orders-page .order-history-panel > .order-filters { flex-direction:column; }
 .orders-page .order-filters select { width:100%; }
}

/* Client list is primary; forms are opened only when needed. */
.clients-summary { display:flex; flex-wrap:wrap; gap:12px 32px; margin-bottom:20px; }
.clients-summary .metric { display:flex; flex-direction:row; align-items:baseline; gap:9px; padding:0; border:0; background:transparent; box-shadow:none; }
.clients-summary .metric strong { font-size:20px; }
.clients-page .client-top-grid, .clients-page .client-workspace { grid-template-columns:minmax(0,1fr); }
.clients-page .client-workspace > .panel:first-child { max-width:none; }
.clients-page .client-view-actions { display:flex; flex-wrap:wrap; gap:10px; }
.clients-page .client-page-search { width:100%; max-width:none; margin-bottom:16px; }
.clients-page .client-list { max-height:none; }
.clients-page .client-form { max-width:800px; }
@media(max-width:700px) { .clients-page .panel-heading { align-items:stretch; flex-direction:column; } }

.client-save-notice { position:fixed; right:24px; bottom:24px; z-index:10001; max-width:min(520px,calc(100vw - 32px)); padding:16px 22px; border:1px solid #8bc8ab; border-radius:10px; background:#e9f8ef; color:#145c38; box-shadow:0 6px 24px #18343d26; font-weight:600; }
.client-save-notice[hidden] { display:none; }
