:root {
  --brand-red: #b52a2f;
  --brand-red-strong: #d6272d;
  --brand-red-soft: rgba(214, 39, 45, .12);
  --brand-gray: #777777;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f3f5;
  --surface-raised: #ffffff;
  --border: #e3e5e8;
  --text: #111318;
  --text-muted: #69717d;
  --green: #1f9d55;
  --green-bg: #daf5e4;
  --orange: #d97706;
  --orange-bg: #fff0d6;
  --danger: #d6262d;
  --danger-bg: #ffe1e4;
  --yellow: #a17f00;
  --yellow-bg: #fff9db;
  --blue: #2563eb;
  --blue-bg: rgba(37, 99, 235, .16);
  --shadow: 0 18px 50px rgba(20, 24, 32, .08);
  --radius: 8px;
  --sidebar-width: 280px;
  color-scheme: light;
}

/* Current Fiscal Period */
.fiscal-title-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.fiscal-title-row h1 { margin: 0; }
.fiscal-mock-badge, .fiscal-recovery-badge { display: inline-flex; padding: .2rem .5rem; border-radius: .35rem; font-size: .72rem; font-weight: 800; letter-spacing: .05em; background: #8b1e1e; color: #fff; }
.fiscal-recovery-badge { background: #8a5a00; }
.fiscal-actions { align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; margin: 0; }
.fiscal-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.fiscal-summary .negative strong { color: #c5352f; }
.fiscal-orders-panel, .fiscal-cash-log { margin-top: 1.25rem; overflow-x: auto; }
.fiscal-orders-panel .card-header, .fiscal-cash-log .card-header { display: flex; align-items: center; justify-content: space-between; }
.fiscal-order-lines-row > td { padding: 0 .75rem .75rem; background: color-mix(in srgb, var(--panel-bg, #fff) 92%, #64748b); }
.fiscal-order-lines-row details summary { cursor: pointer; padding: .6rem 0; font-weight: 600; }
.fiscal-lines-table { width: 100%; border-collapse: collapse; }
.fiscal-lines-table th, .fiscal-lines-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--border-color, #d9dee8); text-align: left; }
.fiscal-unknown-banner h2 { margin-top: 0; }
.fiscal-recovery-form { display: grid; gap: .75rem; }
.fiscal-recovery-form label { display: grid; gap: .25rem; }
.fiscal-archive-warning { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.fiscal-dialog { width: min(30rem, calc(100vw - 2rem)); border: 0; border-radius: .75rem; padding: 1.25rem; box-shadow: 0 1rem 3rem rgb(0 0 0 / .25); }
.fiscal-dialog::backdrop { background: rgb(15 23 42 / .55); }
.fiscal-dialog form { display: grid; gap: 1rem; }
.fiscal-dialog label { display: grid; gap: .3rem; }
.fiscal-dialog input { width: 100%; }
@media (max-width: 1100px) { .fiscal-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .fiscal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fiscal-archive-warning { align-items: stretch; flex-direction: column; } }

html[data-theme="dark"] {
  --bg: #101317;
  --surface: #181c21;
  --surface-soft: #20252b;
  --surface-raised: #1b2026;
  --border: #2d333b;
  --text: #f5f7fb;
  --text-muted: #a7b0bd;
  --brand-red-soft: rgba(214, 39, 45, .2);
  --green-bg: rgba(31, 157, 85, .18);
  --orange-bg: rgba(217, 119, 6, .18);
  --danger-bg: rgba(214, 38, 45, .18);
  --yellow-bg: rgba(217, 179, 6, .18);
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.is-busy {
  cursor: progress;
}

[hidden] {
  display: none !important;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 19, 24, .42);
  backdrop-filter: blur(3px);
  pointer-events: all;
}

.busy-dialog {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: min(260px, 100%);
  min-height: 64px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 750;
}

.busy-spinner {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 3px solid var(--surface-soft);
  border-top-color: var(--brand-red-strong);
  border-radius: 50%;
  animation: busy-spin .8s linear infinite;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .busy-spinner {
    animation-duration: 1.6s;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .18s ease;
}

.sidebar {
  min-width: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 88%, var(--bg)));
  border-right: 1px solid var(--border);
  padding: 26px 20px;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.sidebar-backdrop {
  display: none;
}

@media (min-width: 761px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .sidebar {
    visibility: hidden;
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  height: 52px;
  margin-bottom: 34px;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 190px;
  max-height: 58px;
  object-fit: contain;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: 1;
}

.nav-item span {
  width: 20px;
  text-align: center;
  color: currentColor;
}

.nav-item:hover {
  background: var(--surface-soft);
}

.nav-label {
  cursor: default;
}

.nav-label:hover {
  background: transparent;
}

.nav-item.sidebar-submenu-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item[aria-expanded="true"] {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-strong));
  color: #fff;
  box-shadow: 0 10px 24px rgba(181, 42, 47, .28);
}

.nav-item b {
  margin-left: auto;
  font-size: 13px;
  line-height: 1;
  transition: transform .16s ease;
}

.nav-item[aria-expanded="true"] b {
  transform: rotate(90deg);
}

.nav-group {
  border-radius: 8px;
  padding-bottom: 8px;
}

.nav-group.active {
  background: color-mix(in srgb, var(--surface-soft) 68%, transparent);
}

.sub {
  display: block;
  margin: 4px 10px 4px 48px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}

.sub.nested {
  margin-left: 68px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 13px;
}

.sub.sidebar-submenu-toggle {
  display: flex;
  align-items: center;
  width: calc(100% - 58px);
  border: 0;
  background: transparent;
  text-align: left;
}

.sidebar-submenu-toggle b {
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
  transition: transform .16s ease;
}

.sidebar-submenu-toggle[aria-expanded="true"] b {
  transform: rotate(90deg);
}

.sub:hover {
  background: var(--surface-soft);
}

.sub.active {
  color: var(--brand-red-strong);
  font-weight: 700;
}

.sub-placeholder:hover {
  background: transparent;
}

.sub-placeholder {
  cursor: default;
}

.main {
  min-width: 0;
}

.topbar {
  position: relative;
  z-index: 2000;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-left,
.topbar-right,
.user-menu,
.logout-form,
.theme-toggle,
.actions,
.filters {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 18px;
  min-width: 0;
}

.topbar-right {
  gap: 16px;
}

.section-title {
  display: none;
  font-weight: 600;
}

.icon-button,
.date-button,
.small-button,
.theme-toggle,
.user-menu,
.button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
}

.icon-button {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}

.icon-button.notification span {
  position: absolute;
  top: -5px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-red-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.notification-create-button {
  color: var(--brand-red-strong);
}

.notifications-menu {
  position: relative;
}

.notifications-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  width: min(360px, calc(100vw - 36px));
  max-height: min(520px, calc(100vh - 100px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.notifications-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.notifications-heading button {
  border: 0;
  background: transparent;
  color: var(--brand-red-strong);
  font-weight: 750;
}

.notifications-heading button:disabled {
  color: var(--text-muted);
  cursor: default;
}

.notifications-list {
  display: grid;
  max-height: 440px;
  overflow-y: auto;
}

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  padding: 13px 14px 13px 18px;
  border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item.unread::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-red-strong);
}

.notification-item small,
.notification-item time,
.notifications-empty {
  color: var(--text-muted);
}

.notification-item small {
  font-weight: 800;
}

.notification-item p {
  grid-column: 1 / -1;
  line-height: 1.35;
}

.notification-item time {
  grid-column: 1 / -1;
  font-size: 12px;
}

.notification-importance {
  align-self: start;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.notification-item[data-importance="warning"] .notification-importance {
  background: var(--orange-bg);
  color: var(--orange);
}

.notification-item[data-importance="critical"] .notification-importance {
  background: var(--danger-bg);
  color: var(--danger);
}

.notifications-empty {
  padding: 18px 14px;
  text-align: center;
}

.notification-create-dialog {
  width: min(560px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.notification-create-dialog::backdrop {
  background: rgba(17, 19, 24, .42);
  backdrop-filter: blur(3px);
}

.notification-create-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.notification-create-form h2 {
  margin: 0;
  font-size: 18px;
}

.notification-create-form label {
  display: grid;
  gap: 7px;
}

.notification-create-form small,
.notification-recipient-fieldset legend {
  font-weight: 750;
}

.notification-create-form textarea,
.notification-create-form select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.notification-create-form textarea {
  min-height: 110px;
  padding-top: 10px;
  resize: vertical;
}

.notification-recipient-fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0;
  padding: 12px;
}

.notification-recipient-fieldset legend {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.notification-recipient-fieldset label {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 38%, transparent);
  font-weight: 700;
}

.notification-recipient-fieldset input {
  margin: 0;
}

.notification-create-error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--border));
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

.theme-toggle {
  gap: 8px;
  height: 36px;
  padding: 0 8px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.language-switch span {
  color: var(--text-muted);
  line-height: 1;
}

.language-switch select {
  min-height: 30px;
  width: 126px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 0;
  font-weight: 700;
}

.toggle-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: #d9dde3;
}

.toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}

html[data-theme="dark"] .toggle-track {
  background: var(--brand-red);
}

html[data-theme="dark"] .toggle-dot {
  transform: translateX(18px);
}

.user-menu {
  gap: 10px;
  min-height: 44px;
  padding: 0 10px 0 1px;
}

.user-account-menu {
  position: relative;
}

.user-account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1300;
  width: 224px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.user-account-menu-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.user-account-menu-action:hover,
.user-account-menu-action:focus-visible {
  background: var(--surface-soft);
}

.user-account-menu-action span {
  width: 20px;
  color: var(--text-muted);
  text-align: center;
}

.user-account-menu-form {
  margin: 0;
}

.user-menu-chevron {
  transition: transform .16s ease;
}

.user-menu[aria-expanded="true"] .user-menu-chevron {
  transform: rotate(180deg);
}

.logout-form {
  margin: 0;
}

.user-details {
  text-align: left;
}

.user-menu small {
  display: block;
  color: var(--text-muted);
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-strong));
  color: white;
  font-weight: 800;
}

.about-dialog {
  width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.about-dialog::backdrop {
  background: rgba(17, 19, 24, .42);
  backdrop-filter: blur(3px);
}

.about-dialog-content {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.about-dialog-content h2 {
  margin: 0;
  font-size: 20px;
}

.about-dialog-content p {
  line-height: 1.8;
}

.global-search,
.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search input,
.search-field input,
select,
.product-form input,
.auth-form input,
.user-create-form input,
.user-create-form select,
.user-create-form textarea,
.user-edit-form input,
.user-edit-form select,
.reset-form input,
.custom-action-form input,
.price-calculator-table input {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.global-search input:focus,
.search-field input:focus,
select:focus,
.product-form input:focus,
.auth-form input:focus,
.user-create-form input:focus,
.user-create-form select:focus,
.user-create-form textarea:focus,
.user-edit-form input:focus,
.user-edit-form select:focus,
.reset-form input:focus,
.custom-action-form input:focus,
.price-calculator-table input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.global-search input {
  width: 420px;
  padding-left: 38px;
  padding-right: 76px;
}

.global-search span,
.search-field span {
  position: absolute;
  left: 13px;
  color: var(--text-muted);
}

kbd {
  position: absolute;
  right: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 12px;
}

.content {
  padding: 32px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.product-heading {
  align-items: end;
  margin-bottom: 22px;
}

.page-heading p {
  color: var(--text-muted);
  margin-top: 6px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: 0;
}

h2 small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
}

.date-button,
.small-button {
  min-height: 38px;
  padding: 0 14px;
}

.small-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.actions {
  gap: 10px;
}

.export-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.export-actions-label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.export-actions-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.export-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.export-action:hover {
  border-color: color-mix(in srgb, var(--brand-red) 36%, var(--border));
  background: var(--surface-soft);
}

.export-action-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.export-action-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.export-action-excel {
  color: var(--green);
}

.export-action-pdf {
  color: var(--danger);
}

.export-action-csv {
  color: color-mix(in srgb, var(--text) 78%, var(--brand-gray));
}

.button {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 650;
}

.file-picker {
  position: relative;
  gap: 8px;
  cursor: pointer;
}

.file-picker:focus-within {
  outline: 2px solid var(--brand-red-strong);
  outline-offset: 2px;
}

.file-picker:has(.file-picker-input:disabled) {
  opacity: .5;
  cursor: not-allowed;
}

.file-picker-filename {
  max-width: 220px;
  overflow: hidden;
  color: var(--text-muted);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker .file-picker-input {
  position: absolute;
  width: 1px;
  min-width: 0;
  max-width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.button.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-strong));
  box-shadow: 0 10px 22px rgba(181, 42, 47, .25);
}

/* Same state-color palette used by the Order Workflows legend (Neutral/Information/Warning/
   Success/Danger): Neutral is the plain unmodified .button. */
.button.success {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
}

.button.warning {
  color: var(--orange);
  border-color: color-mix(in srgb, var(--orange) 35%, var(--border));
}

.button.information,
.button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.small-button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.button.square {
  width: 42px;
  padding: 0;
}

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 0 4px 14px;
  font-weight: 650;
}

.tab.active {
  color: var(--brand-red-strong);
  border-bottom-color: var(--brand-red-strong);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .92fr);
  /* Fixed (not auto/min-content) row sizes on purpose: Recent Orders spans all 3 rows and its
     row count is fetched generously, then trimmed client-side to fit. If these rows were
     content-sized, the grid would size itself to fit ALL fetched rows before that trim runs,
     inflating the whole layout. Fixed sizes match .kpi-card/.chart-card's own min-height below,
     so the left column still looks identical; only the right column's growth is decoupled. */
  grid-template-rows: 210px 340px 210px;
  grid-template-areas:
    "kpi1 orders"
    "chart orders"
    "kpi2 orders";
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-kpi-row-1 {
  grid-area: kpi1;
}

.dashboard-kpi-row-2 {
  grid-area: kpi2;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.operational-dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.operational-dashboard-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.operational-dashboard-panel {
  padding: 20px 24px;
}

.operational-dashboard-panel h2 {
  margin: 0 0 16px;
}

.operational-dashboard-panel-products {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand-red-soft) 82%, #fff) 0%,
      color-mix(in srgb, var(--brand-red-soft) 48%, #fff) 45%,
      var(--surface) 100%);
}

.operational-dashboard-panel-customers {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--green-bg) 82%, #fff) 0%,
      color-mix(in srgb, var(--green-bg) 48%, #fff) 45%,
      var(--surface) 100%);
}

.operational-dashboard-panel-orders {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--yellow-bg) 82%, #fff) 0%,
      color-mix(in srgb, var(--yellow-bg) 48%, #fff) 45%,
      var(--surface) 100%);
}

.operational-dashboard-panel-cash {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, rgba(37, 99, 235, .16) 82%, #fff) 0%,
      color-mix(in srgb, rgba(37, 99, 235, .16) 48%, #fff) 45%,
      var(--surface) 100%);
}

.operational-dashboard-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.operational-dashboard-sections-row {
  flex-direction: row;
  flex-wrap: wrap;
}

.operational-dashboard-alerts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.operational-dashboard-alerts .alert {
  margin-bottom: 0;
}

.operational-dashboard-sections-row .operational-dashboard-section {
  flex: 1 1 200px;
}

.operational-dashboard-section {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.operational-dashboard-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.operational-dashboard-section p {
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.operational-dashboard-count {
  display: inline-block;
  font-size: 28px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

@media (max-width: 900px) {
  .operational-dashboard-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .operational-dashboard-sections-row {
    flex-direction: column;
  }
}

.workflow-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.legend-swatch {
  padding: 5px 10px;
  border: 1px solid;
  border-radius: 999px;
  color: #1c2027;
  font-size: 13px;
  font-weight: 600;
}

.workflow-diagram-card {
  margin-bottom: 20px;
  padding: 20px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workflow-diagram-card h2 {
  margin: 0 0 16px;
}

.workflow-diagram-card h2 small {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.workflow-diagram-card .mermaid {
  min-width: 640px;
  margin: 0;
  text-align: center;
}

.workflow-diagram-body {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.workflow-diagram-body .mermaid {
  flex: 1 1 auto;
}

.workflow-legend-panel {
  flex: 1 1 320px;
  min-width: 280px;
  max-width: 420px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.workflow-legend-group + .workflow-legend-group {
  margin-top: 20px;
}

.workflow-legend-group h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.workflow-legend-list {
  margin: 0;
}

.workflow-legend-list dt {
  font-weight: 600;
}

.workflow-legend-list dt small {
  color: var(--text-muted);
  font-weight: 400;
}

.workflow-legend-list dd {
  margin: 2px 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .workflow-diagram-body {
    flex-direction: column;
  }

  .workflow-legend-panel {
    max-width: none;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px 34px;
  min-height: 210px;
}

.kpi-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sales-profit-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.sales-profit-kpi-row .kpi-card {
  min-height: 0;
  padding: 14px 20px;
}

.sales-profit-kpi-row .kpi-card h2 {
  color: var(--brand-red-strong);
}

.kpi-card p,
.trend em,
.orders-card td {
  color: var(--text-muted);
}

.kpi-card p {
  font-weight: 600;
  color: var(--text);
}

.kpi-icon {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
  font-size: 26px;
}

.kpi-icon.muted {
  background: var(--surface-soft);
  color: var(--text);
}

.trend {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}

.trend.up {
  color: var(--brand-red-strong);
}

.trend.down {
  color: var(--brand-red-strong);
}

.trend.neutral {
  color: var(--text);
}

.trend em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-weight: 500;
}

.dashboard-date-form {
  display: flex;
  align-items: end;
  gap: 8px;
}

.dashboard-date-form label {
  display: grid;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.dashboard-date-form input {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.dashboard-period-label {
  color: var(--text-muted);
  font-size: 13px;
}

.dashboard-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--text-muted);
}

.chart-card {
  grid-area: chart;
  padding: 22px 24px;
  min-height: 340px;
}

.orders-card {
  grid-area: orders;
  padding: 22px 24px;
  min-height: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card-header a {
  color: var(--brand-red-strong);
  text-decoration: none;
  font-weight: 600;
}

.chart-wrap {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  height: 210px;
}

.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
  padding: 3px 0 0;
}

.chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.grid-lines line {
  stroke: var(--border);
  stroke-width: 1;
}

.area {
  fill: url(#areaGradient);
}

.line {
  fill: none;
  stroke: var(--brand-red-strong);
  stroke-width: 3;
}

.points circle {
  fill: var(--surface);
  stroke: var(--brand-red-strong);
  stroke-width: 3;
}

.x-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-left: 44px;
  color: var(--text-muted);
  font-size: 13px;
}

.orders-card {
  overflow-x: visible;
}

.orders-card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.orders-card td {
  padding: 16px 0;
  font-size: 14px;
}

.orders-card td:first-child {
  width: auto;
}

.orders-card td:nth-child(2) {
  width: 105px;
}

.orders-card td:last-child {
  width: 118px;
}

.orders-card td:first-child,
.orders-card td:nth-child(2) {
  color: var(--text);
}

.orders-card td:first-child a {
  color: var(--text);
  text-decoration: none;
}

.orders-card td:first-child a:hover {
  color: var(--brand-red-strong);
}

.orders-card td:nth-child(2) {
  text-align: right;
}

.orders-card td:last-child {
  text-align: right;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
}

.status.done {
  background: rgba(35, 166, 87, .16);
  color: #168049;
}

.status.process {
  background: rgba(35, 132, 226, .16);
  color: #1474c4;
}

.status.pending {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.workarea {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) minmax(420px, 620px);
  min-height: calc(100vh - 218px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

.list-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.filters {
  gap: 12px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-field input {
  width: 300px;
  padding-left: 38px;
}

.filters select {
  min-width: 150px;
}

.product-filter-section,
.banner-generator-assets-panel {
  border: 1px solid color-mix(in srgb, var(--brand-red) 20%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand-red-soft) 82%, #fff) 0%,
      color-mix(in srgb, var(--brand-red-soft) 48%, #fff) 45%,
      var(--surface) 100%);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--brand-red) 70%, transparent);
}

.product-filter-section {
  position: relative;
  z-index: 5;
  margin: 22px 24px 0;
  overflow: visible;
}

.product-filter-section summary {
  min-height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-red);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.product-filter-section summary::-webkit-details-marker {
  display: none;
}

.product-filter-section summary > span,
.product-filter-section summary small {
  line-height: 1;
}

.product-filter-section summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .16s ease;
}

.product-filter-section[open] summary::before {
  transform: rotate(45deg);
}

.product-filter-section summary small {
  min-height: 0;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand-red-strong);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

.product-filter-form {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
}

.product-filter-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 14px;
}

.preorder-export-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.preorder-export-filters .filter-field {
  display: grid;
  gap: 7px;
}

.product-filter-form .filter-field {
  position: relative;
  display: grid;
  gap: 7px;
}

.product-filter-grid > .filter-field-date {
  grid-column: span 2;
}

.date-filter-control {
  position: relative;
  display: block;
  min-width: 0;
}

.native-date-picker-control {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}

.native-date-picker-control > input {
  width: 100%;
  padding-right: 40px;
}

.native-date-picker-control > input::-webkit-calendar-picker-indicator {
  opacity: 0;
  pointer-events: none;
}

.product-filter-form .date-filter-display,
.dashboard-date-form .date-filter-display {
  width: 100%;
  padding-right: 40px;
}

.date-filter-picker-button {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  cursor: pointer;
}

.date-filter-picker-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b2d33' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
}

.date-filter-picker-button:focus-visible {
  outline: 2px solid var(--brand-red-strong);
  outline-offset: -3px;
}

.date-filter-picker-button:disabled {
  cursor: default;
}

.date-filter-control .date-filter-native-picker {
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

html[data-theme="dark"] .date-filter-picker-button::after {
  filter: invert(1);
}

.filter-field-sku,
.filter-field-supplier {
  grid-column: span 1;
}

.filter-field-name {
  grid-column: span 4;
}

.filter-field-category,
.filter-field-category-type {
  grid-column: span 1;
}

.filter-field-genre,
.filter-field-sale-price-from,
.filter-field-sale-price-to,
.filter-field-acquisition-from,
.filter-field-acquisition-to,
.filter-field-artist,
.filter-field-album {
  grid-column: span 2;
}

.invoice-filter-grid .filter-field {
  grid-column: span 2;
}

.document-filter-title {
  grid-column: 1 / span 4;
}

.document-filter-type {
  grid-column: 5 / span 2;
}

.document-filter-created-from {
  grid-column: 1 / span 2;
}

.document-filter-created-to {
  grid-column: 3 / span 2;
}

.product-filter-form small {
  font-weight: 750;
}

.product-filter-form input,
.product-filter-form select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  color: var(--text);
  outline: none;
  padding: 0 12px;
  width: 100%;
}

.product-filter-form input:focus,
.product-filter-form select:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.autocomplete-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--brand-red) 22%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 34px rgba(17, 19, 24, .14);
  padding: 6px;
}

.autocomplete-menu.open {
  display: grid;
  gap: 4px;
}

.autocomplete-option {
  min-height: 34px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option.active {
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
}

.autocomplete-empty {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.product-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.result-count {
  padding: 16px 24px;
  color: var(--text);
  font-weight: 650;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.products-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  padding: 13px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 48%, transparent);
}

.products-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.products-table tbody tr.row-stock-new {
  background: var(--green-bg);
}

.products-table tbody tr.row-stock-secondhand {
  background: var(--yellow-bg);
}

.products-table tr.selected,
.products-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-red-soft) 42%, transparent);
}

.products-table td:nth-child(2) {
  font-weight: 650;
}

.products-table .table-actions .small-button {
  justify-content: center;
  min-width: 74px;
}

.products-table .table-actions {
  min-width: 184px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.products-table td.table-actions {
  display: table-cell;
}

.products-table td.table-actions > .small-button + .small-button {
  margin-left: 8px;
}

.products-table td.table-actions > .small-button,
.products-table td.table-actions > form {
  display: inline-flex;
  vertical-align: middle;
}

.sales-overview-table tbody tr:nth-child(odd) {
  background: #f4f5f7;
}

.sales-overview-table td.sales-status-low {
  background: #f8d7da;
}

.sales-overview-table td.sales-status-medium {
  background: #fff0bd;
}

.sales-overview-table td.sales-status-high {
  background: #d9ead3;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.available {
  color: var(--green);
  background: var(--green-bg);
}

.badge.sold {
  color: var(--danger);
  background: var(--danger-bg);
}

.badge.preorder {
  color: var(--orange);
  background: var(--orange-bg);
}

.badge.information {
  color: var(--text-muted);
  background: var(--surface-soft);
}

.badge.warning {
  color: var(--orange);
  background: var(--orange-bg);
}

.badge.error,
.badge.critical {
  color: var(--danger);
  background: var(--danger-bg);
}

.pagination {
  margin-top: auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.pagination nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination button {
  min-width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
}

.pagination button.active {
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
  font-weight: 800;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
}

.detail-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  padding: 26px 28px 14px;
}

.detail-title h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.detail-title button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
}

.detail-tabs {
  display: flex;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
}

.detail-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 14px 0;
  font-weight: 650;
}

.detail-tabs button.active {
  color: var(--brand-red-strong);
  border-bottom-color: var(--brand-red-strong);
}

.product-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
  padding: 24px 28px;
}

.product-form fieldset {
  display: contents;
  border: 0;
  margin: 0;
  padding: 0;
}

.product-form label {
  display: grid;
  gap: 7px;
}

.product-form small {
  font-weight: 750;
  color: var(--text);
}

.span-2 {
  grid-column: span 2;
}

.switch-line {
  align-content: start;
  grid-template-columns: auto 44px 1fr;
  grid-template-areas: "label label label" "switch text text";
  align-items: center;
  column-gap: 10px;
}

.switch-line small {
  grid-area: label;
}

.switch-line b {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-muted);
}

.switch {
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: #d7dbe1;
  position: relative;
}

.switch i {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
}

.switch.on {
  background: #50b36d;
}

.switch.on i {
  transform: translateX(16px);
}

.status-box {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 42%, transparent);
  border-radius: 8px;
  padding: 18px;
}

.status-box strong {
  display: block;
  margin-bottom: 9px;
}

.status-box p {
  color: var(--green);
  font-weight: 800;
  margin-bottom: 7px;
}

.status-box small {
  color: var(--text-muted);
  font-weight: 500;
}

.dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -4px;
  background: var(--green-bg);
}

.detail-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 28px 24px;
  border-top: 1px solid var(--border);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-red-soft) 72%, transparent), transparent 45%),
    var(--bg);
}

.auth-shell {
  width: min(440px, 100%);
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
}

.auth-panel img {
  display: block;
  width: 210px;
  margin-bottom: 26px;
}

.auth-panel h1 {
  margin-bottom: 22px;
}

.auth-panel p {
  color: var(--text-muted);
  margin-bottom: 22px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label,
.user-create-form label,
.user-edit-form label {
  display: grid;
  gap: 7px;
}

.auth-form label span:first-child,
.user-create-form small,
.user-edit-form small {
  font-weight: 750;
}

.auth-form button {
  justify-content: center;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.check-line {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.password-field {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.password-field input {
  flex: 1;
}

.password-toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  color: var(--text-muted);
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.check-line input {
  min-height: auto;
}

.validation-summary,
.field-validation-error {
  color: var(--danger);
  font-weight: 650;
}

.alert {
  margin-bottom: 16px;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-weight: 650;
}

.alert.success {
  color: var(--green);
  background: var(--green-bg);
}

.alert.danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(560px, .95fr) minmax(520px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  padding: 22px 24px;
}

.admin-panel h2 {
  margin: 0;
  font-size: 20px;
}

.configuration-actions-panel {
  grid-column: 1 / -1;
}

.configuration-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.configuration-action-buttons form {
  margin: 0;
}

.user-create-form {
  display: grid;
  grid-template-columns: minmax(180px, .95fr) minmax(280px, 1.45fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.user-create-form .form-hint {
  grid-column: 1 / -1;
}

.user-create-form > .button {
  grid-column: 4;
  justify-self: end;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 36%, transparent);
}

.user-row.active {
  border-color: color-mix(in srgb, var(--green) 28%, var(--border));
  background: color-mix(in srgb, var(--green-bg) 72%, var(--surface));
}

.user-row.inactive {
  background: color-mix(in srgb, var(--surface-soft) 36%, transparent);
}

.user-edit-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr auto auto auto;
  gap: 10px;
  align-items: end;
}

.row-actions,
.reset-form,
.custom-action-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.reset-form input[type="text"],
.reset-form input[type="password"] {
  width: 180px;
}

.reset-reason {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.form-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.temporary-password-reveal code {
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 14px;
  user-select: all;
}

.permission-matrix {
  display: grid;
  gap: 22px;
}

.role-block {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.role-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.role-block table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.role-block th,
.role-block td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.role-block th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.role-block form {
  margin: 0;
}

.matrix-actions {
  white-space: nowrap;
  text-align: right !important;
}

.custom-action-form input {
  min-width: 220px;
}

.log-panel {
  padding: 0;
  overflow-x: auto;
}

.log-filter-section {
  margin: 22px 24px 0;
}

.log-filter-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.filter-field-log-date,
.filter-field-log-user,
.filter-field-log-action,
.filter-field-log-entity,
.filter-field-log-source {
  grid-column: span 2;
}

.filter-field-log-level,
.filter-field-log-status {
  grid-column: span 1;
}

.log-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.log-filters label {
  display: grid;
  gap: 6px;
}

.log-filters small {
  font-weight: 750;
}

.log-filters input,
.log-filters select,
.resolve-form input {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.log-table th,
.log-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.log-table th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  background: color-mix(in srgb, var(--surface-soft) 48%, transparent);
}

.log-table details {
  max-width: 760px;
}

.log-table summary {
  cursor: pointer;
  font-weight: 650;
}

.log-table pre {
  max-width: 760px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  white-space: pre-wrap;
}

.resolve-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.customer-grid {
  grid-template-columns: minmax(680px, 1.25fr) minmax(420px, .75fr);
}

.customer-profile {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(360px, .62fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.customer-profile-side {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.customer-form,
.customer-inline-form,
.customer-note-form {
  display: grid;
  gap: 14px;
}

.customer-form fieldset,
.customer-inline-form fieldset,
.customer-note-form fieldset,
.user-create-form fieldset,
.discount-plan-row fieldset {
  display: grid;
  gap: 12px;
  border: 0;
  margin: 0;
  padding: 0;
}

.abandoned-cart-follow-up-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.abandoned-cart-follow-up-actions .button {
  width: 100%;
}

.abandoned-cart-page-grid,
.customers-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px;
  align-items: start;
}

.abandoned-cart-list-workarea,
.customers-list-workarea {
  grid-template-columns: 1fr;
  min-width: 0;
  min-height: calc(100vh - 218px);
}

.abandoned-cart-list-workarea .list-panel,
.customers-list-workarea .list-panel {
  border-right: 0;
  overflow-x: auto;
}

.abandoned-cart-create-panel,
.customers-create-panel {
  margin-top: 0;
}

.abandoned-cart-create-panel .customer-form,
.customers-create-panel .customer-form {
  grid-template-columns: 1fr;
}

.abandoned-cart-create-panel .customer-form fieldset,
.customers-create-panel .customer-form fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customers-create-panel .customer-form select {
  height: 40px;
  align-self: start;
}

.customers-create-panel .customer-form label {
  align-self: start;
}

.abandoned-cart-create-panel .span-2,
.customers-create-panel .span-2 {
  grid-column: 1 / -1;
}

.customers-table td:nth-child(2) {
  font-weight: 650;
}

.customers-table td:nth-child(3) {
  font-weight: 400;
}

.report-split-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1.75fr) minmax(340px, .75fr);
  gap: 16px;
  align-items: stretch;
  min-height: calc(100vh - 176px);
}

.report-grid-panel {
  grid-template-columns: 1fr;
  min-width: 0;
}

.report-grid-panel .list-panel {
  border-right: 0;
  overflow-x: auto;
}

.marketing-report-filter-grid .filter-field-date,
.marketing-report-filter-grid .filter-field-category {
  grid-column: span 2;
  min-width: 0;
}

.report-chart-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  margin: 0;
  padding: 22px;
}

.report-chart-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.report-chart-heading h2 {
  margin: 4px 0 0;
}

.report-chart-heading > div > small,
.report-chart-heading label small {
  color: var(--text-muted);
  font-weight: 750;
}

.report-chart-heading label {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.report-chart-heading select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.report-chart {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 12px auto 0;
}

.report-pie {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 75%, transparent);
}

.report-chart-center {
  position: absolute;
  inset: 29%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 0 0 1px var(--border);
}

.report-chart-center strong {
  max-width: 120px;
  overflow: hidden;
  font-size: 22px;
  text-overflow: ellipsis;
}

.report-chart-center span {
  color: var(--text-muted);
  font-size: 12px;
}

.report-chart-legend {
  display: grid;
  gap: 8px;
}

.report-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.report-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--legend-color);
}

.report-legend-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-legend-row small {
  min-width: 44px;
  color: var(--text-muted);
  text-align: right;
}

.customer-form {
  grid-template-columns: 1fr 1fr;
}

.customer-details-form {
  grid-template-columns: 1fr;
}

.customer-details-form > fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.customer-details-main-column {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-width: 0;
}

.customer-details-main-fields,
.customer-details-address-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.customer-details-address-fields {
  grid-template-columns: 1fr;
}

.customer-details-main-fields > .span-2 {
  grid-column: 1 / -1;
}

.customer-profile-discount-fields {
  grid-template-columns: 1fr;
  padding: 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 55%, transparent);
}

.customer-profile-action-button {
  width: min(100%, 210px);
  justify-self: start;
}

.customer-details-main-column > .customer-profile-action-button {
  grid-row: 3;
  align-self: end;
}

.customer-form label,
.customer-inline-form label,
.customer-note-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.customer-form input,
.customer-form select,
.customer-form textarea,
.customer-inline-form select,
.customer-note-form textarea,
.discount-plan-row input {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
  min-width: 0;
  width: 100%;
}

.customer-form textarea,
.customer-note-form textarea {
  padding-top: 10px;
  resize: vertical;
}

.customer-address-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 55%, transparent);
}

.customer-address-panel h3 {
  margin: 0;
  font-size: 14px;
}

.customer-address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.customer-address-match {
  display: grid;
  gap: 6px;
}

.customer-address-match[hidden] {
  display: none;
}

.customer-address-status {
  min-height: 16px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .customer-details-form > fieldset,
  .customer-details-main-fields {
    grid-template-columns: 1fr;
  }

  .customer-details-main-fields > .span-2 {
    grid-column: auto;
  }

  .customer-address-grid {
    grid-template-columns: 1fr;
  }

  .customer-address-grid .span-2 {
    grid-column: auto;
  }
}

.customer-orders-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.heading-copy .stats-grid {
  margin-top: 16px;
  margin-bottom: 0;
  max-width: 460px;
}

.stats-grid div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 48%, transparent);
}

.stats-grid small {
  display: block;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stats-grid strong {
  font-size: 20px;
}

.customer-log-panel {
  margin-top: 16px;
}

.relationship-log {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.relationship-log article {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 36%, transparent);
}

.relationship-log header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.discount-plan-row fieldset {
  grid-template-columns: minmax(220px, 1fr) 160px auto;
  align-items: center;
}

.payment-type-row fieldset {
  display: grid;
  grid-template-columns: minmax(220px, 420px) 110px 130px auto auto;
  gap: 12px;
  align-items: center;
  border: 0;
  margin: 0;
  padding: 0;
}

.shipping-vendor-row fieldset {
  grid-template-columns: minmax(220px, 420px) 110px 130px auto auto;
}

.shipping-vendors-table {
  table-layout: fixed;
}

.shipping-vendors-table th:first-child {
  width: 42%;
}

.shipping-vendors-table th:nth-child(2) {
  width: 16%;
}

.shipping-vendors-table th:nth-child(3) {
  width: 16%;
}

.shipping-vendors-table th:last-child {
  width: 26%;
}

.shipping-vendors-table .shipping-vendor-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.shipping-vendors-table .shipping-vendor-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.shipping-vendors-table .shipping-vendor-grid-input:disabled {
  opacity: .72;
}

.shipping-vendors-table .shipping-vendor-sort-order {
  max-width: 120px;
}

.shipping-vendors-table td:first-child {
  font-weight: 400;
}

.post-generator-presets-panel,
.post-generator-preset-create-panel {
  margin-bottom: 16px;
}

.post-generator-presets-help {
  margin: 0;
  padding: 0 24px 4px;
  color: var(--text-muted);
}

.post-generator-presets-table {
  table-layout: fixed;
}

.post-generator-presets-table th:first-child {
  width: 240px;
}

.post-generator-presets-table th:nth-child(3) {
  width: 120px;
}

.post-generator-presets-table th:last-child {
  width: 176px;
}

.post-generator-presets-table td {
  vertical-align: top;
}

.post-generator-presets-table td:nth-child(2) {
  font-weight: 400;
}

.post-generator-preset-input,
.post-generator-preset-textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
  outline: none;
  padding: 10px 12px;
}

.post-generator-preset-input {
  min-height: 40px;
}

.post-generator-preset-textarea {
  min-height: 220px;
  line-height: 1.45;
  resize: vertical;
}

.post-generator-style-examples {
  min-height: 260px;
}

.post-generator-preset-input:focus,
.post-generator-preset-textarea:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.post-generator-preset-input:disabled,
.post-generator-preset-textarea:disabled {
  opacity: .72;
}

.post-generator-preset-sort {
  max-width: 100px;
}

.post-generator-preset-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.products-table td.table-actions > .post-generator-preset-actions .small-button + .small-button {
  margin-left: 0;
}

.post-generator-preset-create-form fieldset {
  grid-template-columns: minmax(180px, 240px) minmax(420px, 1fr) 110px auto;
  align-items: start;
}

.post-generator-preset-create-form .button {
  margin-top: 24px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .post-generator-presets-table {
    min-width: 920px;
  }

  .post-generator-preset-create-form fieldset {
    grid-template-columns: 1fr;
  }

  .post-generator-preset-create-form .button {
    margin-top: 0;
    justify-self: start;
  }
}

.payment-types-table {
  table-layout: fixed;
}

.payment-types-table th:first-child {
  width: 42%;
}

.payment-types-table th:nth-child(2) {
  width: 16%;
}

.payment-types-table th:nth-child(3) {
  width: 16%;
}

.payment-types-table th:last-child {
  width: 26%;
}

.payment-types-table .payment-type-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.payment-types-table .payment-type-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.payment-types-table .payment-type-grid-input:disabled {
  opacity: .72;
}

.payment-types-table .payment-type-sort-order {
  max-width: 120px;
}

.payment-types-table td:first-child {
  font-weight: 400;
}

.categories-table {
  table-layout: fixed;
}

.categories-table th:first-child,
.categories-table th:nth-child(2) {
  width: 27%;
}

.categories-table th:nth-child(3) {
  width: 28%;
}

.categories-table th:last-child {
  width: 18%;
}

.categories-table .category-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.categories-table .category-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.categories-table .category-grid-input:disabled {
  opacity: .72;
}

.categories-table td:first-child,
.categories-table td:nth-child(2) {
  font-weight: 400;
}

.category-types-table {
  table-layout: fixed;
}

.category-types-table th:first-child,
.category-types-table th:nth-child(2) {
  width: 40%;
}

.category-types-table th:last-child {
  width: 20%;
}

.category-types-table .category-type-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.category-types-table .category-type-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.category-types-table .category-type-grid-input:disabled {
  opacity: .72;
}

.category-types-table td:first-child,
.category-types-table td:nth-child(2) {
  font-weight: 400;
}

.product-lines-table {
  table-layout: fixed;
}

.product-lines-table th:nth-child(1) {
  width: 34%;
}

.product-lines-table th:nth-child(2) {
  width: 18%;
}

.product-lines-table th:nth-child(3) {
  width: 20%;
}

.product-lines-table th:nth-child(4) {
  width: 28%;
}

.product-lines-table .product-line-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.product-lines-table .product-line-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.product-lines-table .product-line-grid-input:disabled {
  opacity: .72;
}

.pricing-ranges-editor {
  margin: 20px 0;
}

.pricing-ranges-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.pricing-ranges-heading h3 {
  margin: 0 0 3px;
}

.pricing-ranges-table {
  table-layout: fixed;
}

.pricing-ranges-table th:nth-child(-n+3) {
  width: 28%;
}

.pricing-ranges-table th:last-child {
  width: 16%;
}

.pricing-ranges-table input {
  width: 100%;
  min-width: 0;
}

.pricing-ranges-table .table-actions {
  min-width: 0;
  text-align: right;
}

.genres-table {
  table-layout: fixed;
}

.genres-table th:first-child,
.genres-table th:nth-child(2) {
  width: 22%;
}

.genres-table th:nth-child(3) {
  width: 30%;
}

.genres-table th:nth-child(4) {
  width: 10%;
}

.genres-table th:nth-child(5) {
  width: 8%;
}

.genres-table th:last-child {
  width: 8%;
}

.genres-table .table-actions {
  min-width: 0;
  text-align: right;
}

.genres-table .genre-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.genres-table .genre-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.genres-table .genre-grid-input:disabled {
  opacity: .72;
}

.genres-table td:first-child,
.genres-table td:nth-child(2) {
  font-weight: 400;
}

.suppliers-table {
  min-width: 1180px;
  table-layout: fixed;
}

.suppliers-table th:first-child {
  width: 18%;
}

.suppliers-table th:nth-child(2) {
  width: 14%;
}

.suppliers-table th:nth-child(3),
.suppliers-table th:nth-child(4),
.suppliers-table th:nth-child(5) {
  width: 19%;
}

.suppliers-table th:last-child {
  width: 11%;
}

.suppliers-table .supplier-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.suppliers-table textarea.supplier-grid-input {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

.suppliers-table .supplier-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.suppliers-table .supplier-grid-input:disabled,
.suppliers-table input:disabled {
  opacity: .72;
}

.supplier-vat-flags {
  display: grid;
  gap: 10px;
  font-weight: 400;
}

.supplier-create-form .check-line input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.suppliers-table td:first-child,
.suppliers-table td:nth-child(2) {
  font-weight: 400;
}

.discount-plans-table {
  table-layout: fixed;
}

.discount-plans-table th:first-child {
  width: 40%;
}

.discount-plans-table th:nth-child(2) {
  width: 12%;
}

.discount-plans-table th:nth-child(3) {
  width: 18%;
}

.discount-plans-table th:nth-child(4) {
  width: 20%;
}

.discount-plans-table th:last-child {
  width: 10%;
}

.discount-plans-table .discount-plan-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.discount-plans-table .discount-plan-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.discount-plans-table .discount-plan-grid-input:disabled {
  opacity: .72;
}

.discount-plans-table .discount-plan-percent {
  max-width: 140px;
}

.discount-plans-table td:first-child {
  font-weight: 400;
}

.cash-categories-table,
.cash-counterparties-table {
  table-layout: fixed;
}

.cash-categories-table th:first-child,
.cash-counterparties-table th:first-child {
  width: auto;
}

.cash-categories-table th:nth-child(2),
.cash-counterparties-table th:nth-child(2) {
  width: 140px;
}

.cash-categories-table th:nth-child(3),
.cash-counterparties-table th:nth-child(3) {
  width: 90px;
}

.cash-categories-table th:nth-child(4),
.cash-counterparties-table th:nth-child(4) {
  width: 110px;
}

.cash-categories-table th:last-child,
.cash-counterparties-table th:last-child {
  width: 216px;
}

.cash-categories-table .cash-category-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.cash-categories-table .cash-category-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.cash-categories-table .cash-category-grid-input:disabled {
  opacity: .72;
}

.cash-categories-table td:first-child,
.cash-categories-table td:nth-child(2) {
  font-weight: 400;
}

.cash-counterparties-table .cash-counterparty-grid-input {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.cash-counterparties-table .cash-counterparty-grid-input:focus {
  border-color: color-mix(in srgb, var(--brand-red) 70%, var(--border));
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.cash-counterparties-table .cash-counterparty-grid-input:disabled {
  opacity: .72;
}

.cash-counterparties-table td:first-child {
  font-weight: 400;
}

.bilingual-create-form fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 140px;
}

.category-create-form fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(220px, 0.8fr) 140px;
}

.genre-create-form fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(260px, 0.9fr) 140px;
}

.genre-create-form label,
.genre-create-form select {
  min-width: 0;
}

.genre-create-form select {
  width: 100%;
}

.bilingual-create-form .button,
.category-create-form .button,
.genre-create-form .button {
  align-self: end;
  min-height: 40px;
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

.category-type-row fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 118px;
}

.category-row fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(220px, 0.85fr) 118px;
}

.genre-row fieldset {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(260px, 0.9fr) 90px 118px 118px;
}

.category-table-filter {
  margin: 0;
}

.category-table-filter label {
  display: grid;
  gap: 5px;
}

.category-table-filter small {
  color: var(--muted);
  font-weight: 750;
}

.category-table-filter select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
  width: min(100%, 320px);
}

.products-workarea {
  grid-template-columns: 1fr;
}

.documents-shell {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  min-height: calc(100vh - 218px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.document-tree-panel {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 38%, transparent);
}

.document-panel-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.document-panel-heading h2,
.document-content-header h2,
.document-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.document-tree,
.document-tree ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px;
  list-style: none;
}

.document-tree ul {
  padding: 4px 0 0 18px;
}

.document-tree details {
  display: grid;
  gap: 4px;
}

.document-tree summary {
  display: flex;
  align-items: center;
  list-style: none;
}

.document-tree summary::-webkit-details-marker {
  display: none;
}

.document-tree summary::before {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 6px 0 2px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
}

.document-tree details[open] > summary::before {
  transform: rotate(45deg);
}

.document-tree-link {
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.document-tree-link span {
  flex: 0 0 auto;
}

.document-tree-link:hover {
  background: var(--surface);
}

.document-tree-link.active {
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
}

.document-content-panel {
  min-width: 0;
  overflow-x: auto;
}

.document-content-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.document-breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--brand-red-strong);
  font-size: 13px;
  font-weight: 700;
}

.document-breadcrumbs a {
  color: var(--brand-red-strong);
  text-decoration: none;
  font-weight: 700;
}

.document-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.document-folder-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.document-folder-actions form {
  margin: 0;
}

.document-section {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.document-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.document-section-heading span {
  color: var(--text-muted);
  font-weight: 750;
}

.document-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.document-folder-tile {
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 40%, transparent);
  color: var(--text);
  text-decoration: none;
}

.document-folder-tile:hover,
.document-folder-tile.active {
  border-color: color-mix(in srgb, var(--brand-red) 36%, var(--border));
  background: var(--brand-red-soft);
}

.document-folder-tile span {
  grid-row: span 2;
  align-self: center;
  font-size: 22px;
}

.document-folder-tile strong,
.document-folder-tile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-folder-tile small {
  color: var(--text-muted);
}

.document-tabs {
  padding: 18px 24px 0;
}

.documents-table {
  min-width: 980px;
}

.documents-table td:first-child {
  min-width: 220px;
}

.documents-table td:first-child small {
  display: block;
  max-width: 360px;
  margin-top: 4px;
  color: var(--text-muted);
}

.document-path-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 650;
}

.document-empty-panel {
  padding: 24px;
}

.document-empty-row {
  grid-column: 1 / -1;
}

.document-dialog {
  width: min(560px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.document-dialog::backdrop {
  background: rgba(17, 19, 24, .42);
  backdrop-filter: blur(3px);
}

.document-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-heading,
.dialog-actions,
.document-form-grid {
  display: flex;
  gap: 12px;
}

.dialog-heading {
  justify-content: space-between;
  align-items: center;
}

.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.document-form-grid {
  align-items: start;
}

.document-form-grid label {
  flex: 1 1 0;
}

.document-form label {
  display: grid;
  gap: 7px;
}

.document-form small {
  font-weight: 750;
}

.document-form input,
.document-form select,
.document-form textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.document-form input[type="file"] {
  padding: 8px 12px;
}

.document-form textarea {
  min-height: 88px;
  padding-top: 10px;
  resize: vertical;
}

.document-replicate-dialog {
  width: min(680px, calc(100vw - 36px));
}

.replicate-target-fieldset {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0;
  padding: 14px;
}

.replicate-target-fieldset legend {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.replicate-target-tree,
.replicate-target-node,
.replicate-target-children {
  display: grid;
  gap: 5px;
}

.replicate-target-children {
  margin-left: 22px;
}

.replicate-target-row {
  min-height: 36px;
  display: grid !important;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 9px !important;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
}

.replicate-target-row:hover {
  background: var(--surface-soft);
}

.replicate-target-row.disabled {
  cursor: not-allowed;
  opacity: .52;
}

.replicate-target-row input {
  width: auto;
  min-height: auto;
  padding: 0;
}

.replicate-target-row strong,
.replicate-target-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replicate-target-row small {
  color: var(--text-muted);
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.empty-state {
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}

.product-edit-panel {
  max-width: none;
  position: relative;
}

.product-edit-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.product-edit-form .detail-actions {
  border-top: 0;
}

.form-section {
  display: grid;
  gap: 14px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.form-section h2 {
  font-size: 18px;
  margin: 0;
}

.product-heading-subtitle {
  margin-left: 14px;
  color: var(--brand-red-strong);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.four-column {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.invoice-settings-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.invoice-settings-form input,
.invoice-settings-form select,
.invoice-settings-form textarea {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
  min-width: 0;
  width: 100%;
}

.invoice-settings-form textarea {
  min-height: 88px;
  padding: 10px 12px;
}

.invoice-settings-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.invoice-settings-table th,
.invoice-settings-table td {
  padding: 10px 14px 10px 0;
  text-align: left;
  vertical-align: top;
}

.invoice-settings-table thead th {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-left: 14px;
}

.invoice-settings-table tbody th {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}

.invoice-settings-table td {
  padding-left: 14px;
}

.invoice-settings-table tbody td:nth-of-type(1) {
  border-right: 1px solid var(--border);
}

.product-narrow-field input {
  max-width: 100px;
}

.product-price-field {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 8px;
}

.product-price-field label {
  flex: 1 1 auto;
  min-width: 0;
}

.product-price-field .small-button {
  white-space: nowrap;
}

.product-agent-action {
  display: flex;
  align-items: end;
  justify-content: end;
}

.product-log {
  top: 0;
}

.product-edit-tabs {
  margin-bottom: 18px;
}

.pricing-stock-section {
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--brand-gray) 22%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--surface-soft) 78%, #fff) 0%,
      color-mix(in srgb, var(--brand-gray) 10%, var(--surface)) 48%,
      var(--surface) 100%);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--brand-gray) 58%, transparent);
}

.pricing-stock-section h2 {
  color: color-mix(in srgb, var(--brand-gray) 82%, var(--text));
}

.media-metadata-section {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-red) 20%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand-red-soft) 82%, #fff) 0%,
      color-mix(in srgb, var(--brand-red-soft) 48%, #fff) 45%,
      var(--surface) 100%);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--brand-red) 70%, transparent);
}

.media-metadata-section h2 {
  color: var(--brand-red);
}

.media-metadata-section input {
  background: rgba(255, 255, 255, .88);
  border-color: color-mix(in srgb, var(--brand-red) 18%, var(--border));
}

.metadata-save-status {
  min-height: 17px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 17px;
}

.metadata-save-status.is-success {
  color: var(--green);
}

.metadata-save-status.is-error {
  color: var(--danger);
}

.product-genre-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.product-genre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.product-genre-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  flex: 1 1 220px;
}

.product-genre-row.is-hidden {
  display: none;
}

.product-genre-row label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.product-genre-row select {
  width: 100%;
  min-width: 0;
}

.product-genre-remove.is-hidden {
  display: none;
}

.product-genre-actions {
  display: flex;
  justify-content: flex-start;
}

.product-thumbnail {
  display: block;
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 7px;
  object-fit: cover;
}

.recommendations-section {
  margin-top: 24px;
}

.recommendations-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.recommendation-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.recommendation-thumbnail {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 7px;
  object-fit: cover;
}

.recommendation-thumbnail-placeholder {
  background: var(--surface-soft);
}

.recommendation-body h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.recommendation-semantic-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
}

.product-images-section {
  margin-top: 18px;
}

.product-image-panel {
  display: grid;
  gap: 14px;
}

.product-image-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.product-image-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.product-image-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  background: var(--surface-soft);
  object-fit: cover;
}

.product-image-empty {
  place-content: center;
  min-height: 180px;
  color: var(--text-muted);
  text-align: center;
}

.product-image-details {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-image-details small {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-image-actions,
.product-image-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.product-image-upload {
  min-width: min(260px, 100%);
}

.product-image-hint {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.product-edit-form label {
  display: grid;
  gap: 7px;
}

.product-edit-form small {
  font-weight: 750;
}

.product-edit-form input,
.product-edit-form select,
.product-edit-form textarea {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.product-edit-form textarea {
  min-height: 220px;
  padding-top: 10px;
  resize: vertical;
}

.payment-type-row input,
.payment-type-row select,
.payment-type-row textarea {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.payment-type-row textarea,
.user-create-form textarea {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

.supplier-row fieldset {
  grid-template-columns: minmax(180px, 1fr) 130px 130px minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.configuration-panel {
  margin-bottom: 18px;
}

.configuration-table {
  table-layout: fixed;
}

.configuration-table th:first-child {
  width: 34%;
}

.configuration-table th:nth-child(2) {
  width: 110px;
}

.configuration-table th:last-child {
  width: 96px;
}

.configuration-path {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.configuration-path-description {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 400;
}

.configuration-table tbody tr:nth-child(odd) {
  background: color-mix(in srgb, var(--green-bg) 62%, var(--surface));
}

.role-block table tbody tr:nth-child(odd) {
  background: color-mix(in srgb, var(--green-bg) 62%, var(--surface));
}

.configuration-row-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.configuration-row-form input,
.configuration-row-form select,
.configuration-row-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.configuration-row-form textarea {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

.inline-action-form {
  margin-top: 10px;
}

.hidden-action-form {
  display: none;
}

.order-tabs {
  margin-bottom: 18px;
}

.order-create-panel {
  margin-bottom: 16px;
}

.order-total-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.order-total-bar div {
  display: grid;
  gap: 5px;
}

.order-total-bar small {
  color: var(--text-muted);
  font-weight: 750;
}

.order-total-bar strong {
  font-size: 20px;
}

.order-document-grid {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) minmax(360px, 460px);
  gap: 16px;
  align-items: start;
}

.order-side {
  display: grid;
  gap: 16px;
}

@media (max-width: 1320px) {
  .product-page .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .product-page .brand img {
    width: 58px;
    object-position: left;
  }

  .product-page .nav-item {
    justify-content: center;
    padding: 0;
  }

  .product-page .nav-item span {
    width: auto;
  }

  .product-page .nav-item:not(.active),
  .product-page .sub,
  .product-page .nav-item b {
    font-size: 0;
  }

  .product-page .nav-item {
    gap: 0;
  }

  .workarea {
    grid-template-columns: 1fr;
  }

  .report-split-layout {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .customer-profile,
  .customer-grid,
  .order-document-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    border-top: 1px solid var(--border);
  }

  .product-filter-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .cash-categories-page-grid,
  .cash-counterparties-page-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .abandoned-cart-page-grid,
  .customers-page-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
    /* Stacked single column: orders no longer spans multiple rows, so nothing here needs the
       fixed row sizes from the desktop rule (those exist only to stop the spanning layout from
       inflating) — auto sizing is safe again. */
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "kpi1"
      "chart"
      "orders"
      "kpi2";
  }

  .orders-card {
    overflow: visible;
    min-height: 200px;
  }

  .product-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 1990;
    top: 76px;
    bottom: 0;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 48px));
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
    box-shadow: 12px 0 30px color-mix(in srgb, #000 24%, transparent);
  }

  .app-shell.sidebar-mobile-open .sidebar {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 1980;
    inset: 76px 0 0;
    display: block;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, #000 35%, transparent);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar-right {
    gap: 6px;
  }

  .section-title {
    display: inline-flex;
  }

  .user-details {
    display: none;
  }

  .user-menu {
    width: 42px;
    min-height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .user-menu > span:last-child {
    display: none;
  }

  .theme-toggle {
    gap: 5px;
    padding: 0 6px;
  }

  .language-switch {
    padding: 0 6px;
  }

  .language-switch select {
    width: 72px;
  }

  .global-search {
    display: none;
  }

  .dashboard-kpi-row {
    grid-template-columns: 1fr;
  }

  .order-total-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-page .product-heading {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .product-page .actions {
    justify-self: start;
  }

  .product-page .heading-copy h1,
  .product-page .heading-copy p {
    width: min(320px, calc(100vw - 36px));
  }

  .actions {
    flex-wrap: wrap;
  }

  .export-actions {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .export-actions-buttons {
    width: 100%;
  }

  .export-action {
    flex: 1 1 94px;
  }

  .product-page .heading-copy,
  .product-page .actions {
    flex-basis: 100%;
    min-width: 100%;
    width: 100%;
  }

  .workarea {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .documents-shell {
    grid-template-columns: 1fr;
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
  }

  .document-tree-panel {
    max-height: 280px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .document-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-folder-actions,
  .document-folder-actions .small-button,
  .document-folder-actions form,
  .document-folder-actions form button {
    width: 100%;
  }

  .document-folder-grid {
    grid-template-columns: 1fr;
  }

  .documents-table {
    min-width: 760px;
  }

  .document-form-grid {
    flex-direction: column;
  }

  .product-page .workarea {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
  }

  .product-filter-section {
    margin-left: 14px;
    margin-right: 14px;
  }

  .product-filter-grid {
    grid-template-columns: 1fr;
  }

  .product-filter-form .filter-field {
    grid-column: 1 / -1;
  }

  .product-filter-actions {
    justify-content: stretch;
  }

  .product-filter-actions .button {
    flex: 1 1 140px;
  }

  .list-panel {
    max-width: 100%;
    overflow-x: auto;
  }

  .products-table {
    min-width: 880px;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 24px;
  }

  .detail-tabs {
    overflow-x: auto;
  }

  .product-form {
    grid-template-columns: 1fr;
  }

  .user-create-form,
  .user-edit-form,
  .customer-form,
  .abandoned-cart-follow-up-actions,
  .product-genre-row,
  .form-grid,
  .form-grid.two-column,
  .form-grid.four-column,
  .discount-plan-row fieldset,
  .payment-type-row fieldset,
  .genre-row fieldset,
  .shipping-vendor-row fieldset {
    grid-template-columns: 1fr;
  }

  .product-image-list {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .span-2 {
    grid-column: span 1;
  }
}

/* Orders operational workspace */
.orders-workspace-page .app-shell {
  width: 100%;
  max-width: none;
}

.orders-workspace-page .main,
.orders-workspace-page .content,
.orders-workspace {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.orders-workspace-page .content {
  height: calc(100vh - 76px);
  min-height: 680px;
  padding: 0;
  overflow: hidden;
}

.orders-workspace-page .main {
  overflow: hidden;
}

.orders-workspace {
  height: 100%;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 52px auto minmax(0, 1fr);
  background: var(--surface);
}

.workspace-preorder-dialog,
.workspace-receipt-confirmation-dialog,
.workspace-receipt-dialog,
.workspace-invoice-dialog {
  width: min(430px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 24px 70px rgb(15 23 42 / .28);
}

.workspace-preorder-dialog::backdrop,
.workspace-receipt-confirmation-dialog::backdrop,
.workspace-receipt-dialog::backdrop,
.workspace-invoice-dialog::backdrop {
  background: rgb(15 23 42 / .55);
}

.workspace-preorder-dialog form,
.workspace-receipt-confirmation-dialog form,
.workspace-receipt-dialog form,
.workspace-invoice-dialog form {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.workspace-preorder-dialog header,
.workspace-preorder-dialog footer,
.workspace-receipt-confirmation-dialog header,
.workspace-receipt-confirmation-dialog footer,
.workspace-receipt-dialog header,
.workspace-receipt-dialog footer,
.workspace-invoice-dialog header,
.workspace-invoice-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace-preorder-dialog header small,
.workspace-receipt-confirmation-dialog header small,
.workspace-receipt-dialog header small,
.workspace-invoice-dialog header small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.workspace-preorder-dialog h2,
.workspace-receipt-confirmation-dialog h2,
.workspace-receipt-dialog h2,
.workspace-invoice-dialog h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.workspace-preorder-dialog header > button,
.workspace-receipt-confirmation-dialog header > button,
.workspace-receipt-dialog header > button,
.workspace-invoice-dialog header > button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
}

.workspace-preorder-dialog header > button:hover,
.workspace-receipt-confirmation-dialog header > button:hover,
.workspace-receipt-dialog header > button:hover,
.workspace-invoice-dialog header > button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.workspace-preorder-dialog label,
.workspace-receipt-confirmation-dialog label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 750;
}

.workspace-preorder-dialog input,
.workspace-receipt-confirmation-dialog input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.workspace-preorder-dialog input:focus,
.workspace-receipt-confirmation-dialog input:focus {
  border-color: var(--brand-red-strong);
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-preorder-dialog footer,
.workspace-receipt-confirmation-dialog footer {
  justify-content: flex-end;
}

.workspace-receipt-dialog fieldset,
.workspace-invoice-dialog fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.workspace-receipt-dialog legend,
.workspace-invoice-dialog legend {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}

.workspace-receipt-dialog fieldset label,
.workspace-invoice-dialog fieldset label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.workspace-receipt-dialog input,
.workspace-invoice-dialog input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-red-strong);
}

.workspace-receipt-dialog footer,
.workspace-invoice-dialog footer {
  justify-content: flex-end;
}

.workspace-preorder-error,
.workspace-receipt-confirmation-error,
.workspace-receipt-error,
.workspace-invoice-error {
  margin: -10px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.workspace-document-tabs {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--surface));
}

.workspace-document-tab,
.workspace-order-tab,
.workspace-new-order {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.workspace-document-tab {
  width: 120px;
  flex: 0 0 120px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-left: 1px solid var(--border);
  font-weight: 750;
}

.workspace-document-tab.active {
  background: var(--surface);
  box-shadow: inset 0 3px 0 var(--brand-red-strong);
}

.workspace-tab-icon {
  font-size: 18px;
}

.workspace-order-tabs {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
}

.workspace-order-tab {
  flex: 1 1 230px;
  min-width: 180px;
  max-width: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 5px;
  padding: 0 10px 0 14px;
  text-align: left;
}

.workspace-order-tab:hover,
.workspace-new-order:hover:not(:disabled) {
  background: var(--surface-soft);
}

.workspace-order-tab.active {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-strong));
  color: #fff;
}

.workspace-order-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.workspace-order-tab-close {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}

.workspace-new-order {
  flex: 0 0 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 750;
}

.workspace-new-order:disabled {
  color: var(--text-muted);
  cursor: default;
}

.workspace-action-spinner,
.workspace-search-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 24%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: busy-spin .8s linear infinite;
}

.workspace-new-order.loading .workspace-action-spinner,
.workspace-product-search.loading .workspace-search-spinner {
  display: inline-block;
}

.workspace-inline-message {
  grid-column: 1;
  grid-row: 2;
  min-height: 34px;
  padding: 8px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--orange) 35%, var(--border));
  background: var(--orange-bg);
  color: color-mix(in srgb, var(--orange) 75%, var(--text));
  font-size: 13px;
  font-weight: 700;
}

.workspace-inline-message[data-kind="danger"] {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--danger-bg);
  color: var(--danger);
}

.workspace-worklist,
.workspace-order-document {
  min-height: 0;
}

.workspace-worklist,
.workspace-documents {
  grid-column: 1;
  grid-row: 3;
}

.workspace-worklist {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 18px;
  background: var(--bg);
}

.workspace-worklist[hidden] {
  display: none;
}

.workspace-worklist.loading {
  cursor: progress;
}

.workspace-worklist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
}

.workspace-worklist-controls {
  display: grid;
  gap: 14px;
  padding-bottom: 14px;
}

.workspace-worklist-heading {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.workspace-worklist-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.workspace-worklist-heading strong {
  font-size: 16px;
}

.workspace-worklist-heading > div:first-child > span {
  color: var(--text-muted);
  font-size: 12px;
}

.order-filter-section {
  margin: 0;
}

.order-filter-grid .order-filter-number,
.order-filter-grid .order-filter-customer,
.order-filter-grid .order-filter-product,
.order-filter-grid .order-filter-waybill,
.order-filter-grid .order-filter-channel,
.order-filter-grid .order-filter-updated-from,
.order-filter-grid .order-filter-updated-to,
.order-filter-grid .order-filter-completed-from,
.order-filter-grid .order-filter-completed-to,
.order-filter-grid .order-filter-creator {
  grid-column: span 2;
}

.order-filter-grid .order-filter-total-from,
.order-filter-grid .order-filter-total-to,
.order-filter-grid .order-filter-payment,
.order-filter-grid .order-filter-fulfillment {
  grid-column: span 1;
}

.order-filter-grid .order-filter-line-item,
.order-filter-grid .order-filter-shipping-vendor {
  grid-column: span 2;
}

.order-filter-states {
  min-width: 0;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
}

.order-filter-states legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 12px;
  font-weight: 750;
}

.order-filter-state-options {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
}

.order-filter-state-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.product-filter-form .order-filter-state-option input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand-red-strong);
}

/* Three status groups, each with its own accent color and visual clustering
   (via flex order) independent of the states' source/workflow order. */
.order-filter-state-option.state-key-Reserved,
.order-filter-state-option.state-key-ReadyToPickup,
.order-filter-state-option.state-key-ReadyToShip,
.order-filter-state-option.state-key-Shipped {
  color: var(--danger);
}

.product-filter-form .order-filter-state-option.state-key-Reserved input,
.product-filter-form .order-filter-state-option.state-key-ReadyToPickup input,
.product-filter-form .order-filter-state-option.state-key-ReadyToShip input,
.product-filter-form .order-filter-state-option.state-key-Shipped input {
  accent-color: var(--danger);
}

.order-filter-state-option.state-key-Created,
.order-filter-state-option.state-key-Open,
.order-filter-state-option.state-key-Closed,
.order-filter-state-option.state-key-Completed {
  color: var(--green);
}

.product-filter-form .order-filter-state-option.state-key-Created input,
.product-filter-form .order-filter-state-option.state-key-Open input,
.product-filter-form .order-filter-state-option.state-key-Closed input,
.product-filter-form .order-filter-state-option.state-key-Completed input {
  accent-color: var(--green);
}

.order-filter-state-option.state-key-Voided,
.order-filter-state-option.state-key-Cancelled {
  color: var(--blue);
}

.product-filter-form .order-filter-state-option.state-key-Voided input,
.product-filter-form .order-filter-state-option.state-key-Cancelled input {
  accent-color: var(--blue);
}

.order-filter-state-option.state-key-Reserved { order: 1; }
.order-filter-state-option.state-key-ReadyToPickup { order: 2; }
.order-filter-state-option.state-key-ReadyToShip { order: 3; }
.order-filter-state-option.state-key-Shipped { order: 4; }
.order-filter-state-option.state-key-Created { order: 5; margin-left: 18px; }
.order-filter-state-option.state-key-Open { order: 6; }
.order-filter-state-option.state-key-Closed { order: 7; }
.order-filter-state-option.state-key-Completed { order: 8; }
.order-filter-state-option.state-key-Voided { order: 9; margin-left: 18px; }
.order-filter-state-option.state-key-Cancelled { order: 10; }

.workspace-inline-message[data-kind="success"] {
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
  color: var(--green);
}

.workspace-view-tabs {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.workspace-view-tabs button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
}

.workspace-view-tabs button:last-child {
  border-right: 0;
}

.workspace-view-tabs button.active {
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
}

.workspace-list-search,
.workspace-product-search {
  position: relative;
  display: flex;
  align-items: center;
}

.workspace-list-search > span:first-child,
.workspace-product-search > span:first-child {
  position: absolute;
  left: 13px;
  z-index: 1;
  color: var(--text-muted);
  font-size: 21px;
}

.workspace-list-search input,
.workspace-product-search input,
.workspace-context-field input,
.workspace-context-field select,
.workspace-cell-input {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.workspace-list-search input:focus,
.workspace-product-search input:focus,
.workspace-context-field input:focus,
.workspace-context-field select:focus,
.workspace-cell-input:focus {
  border-color: var(--brand-red-strong);
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-list-search input {
  width: 330px;
  height: 40px;
  padding: 0 14px 0 42px;
}

.workspace-worklist-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  background: var(--surface);
}

.workspace-worklist-table,
.workspace-lines-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.workspace-worklist-table th,
.workspace-worklist-table td,
.workspace-lines-table th,
.workspace-lines-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.workspace-worklist-table th:last-child,
.workspace-worklist-table td:last-child,
.workspace-lines-table th:last-child,
.workspace-lines-table td:last-child {
  border-right: 0;
}

.workspace-worklist-table th,
.workspace-lines-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 43px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  color: var(--text-muted);
  text-align: left;
  font-size: 12px;
  font-weight: 800;
}

.workspace-worklist-table td {
  height: 52px;
  padding: 0 14px;
}

.workspace-worklist-table th:has([data-merge-select], #workspaceMergeSelectAll),
.workspace-worklist-table td:has([data-merge-select]) {
  width: 40px;
  padding: 0 8px;
}

.workspace-worklist-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-red-strong);
  cursor: pointer;
}

.workspace-worklist-table tbody tr {
  cursor: pointer;
}

.workspace-worklist-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-red-soft) 45%, transparent);
}

.workspace-order-row:focus-visible {
  outline: 2px solid var(--brand-red-strong);
  outline-offset: -2px;
}

.workspace-order-row.expanded {
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--surface));
}

/* Three status groups, same grouping/colors as the worklist's state filter checkboxes:
   Reserved/ReadyToPickup/ReadyToShip/Shipped (light red), Created/Open/Closed/Completed
   (light green), Voided/Cancelled (light blue). */
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Reserved,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Reserved:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Reserved.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToPickup,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToPickup:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToPickup.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToShip,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToShip:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-ReadyToShip.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Shipped,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Shipped:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Shipped.expanded {
  background: color-mix(in srgb, var(--danger-bg) 82%, var(--surface));
}

.workspace-worklist-table tbody tr.workspace-order-row.state-key-Created,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Created:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Created.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Open,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Open:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Open.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Closed,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Closed:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Closed.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Completed,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Completed:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Completed.expanded {
  background: color-mix(in srgb, var(--green-bg) 82%, var(--surface));
}

.workspace-worklist-table tbody tr.workspace-order-row.state-key-Voided,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Voided:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Voided.expanded,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Cancelled,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Cancelled:hover,
.workspace-worklist-table tbody tr.workspace-order-row.state-key-Cancelled.expanded {
  background: color-mix(in srgb, var(--blue-bg) 82%, var(--surface));
}

.workspace-expansion-chevron {
  display: inline-flex;
  width: 18px;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
}

.workspace-order-row.expanded .workspace-expansion-chevron {
  color: var(--text);
}

.workspace-worklist-table tbody .workspace-order-lines-row,
.workspace-worklist-table tbody .workspace-order-lines-row:hover {
  cursor: default;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.workspace-worklist-table .workspace-order-lines-row > td {
  height: auto;
  padding: 0;
}

.workspace-order-lines-panel {
  margin: 7px 13px 10px 30px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--text-muted) 55%, var(--border));
  border-radius: 4px;
  background: var(--surface);
}

.workspace-order-lines-grid-wrap {
  overflow-x: auto;
}

.workspace-order-lines-grid {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}

.workspace-order-lines-grid col.sku {
  width: 15%;
}

.workspace-order-lines-grid col.product {
  width: auto;
}

.workspace-order-lines-grid col.quantity,
.workspace-order-lines-grid col.discount {
  width: 12%;
}

.workspace-order-lines-grid col.money {
  width: 15%;
}

.workspace-order-lines-grid th,
.workspace-order-lines-grid td {
  height: 36px;
  padding: 0 11px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.workspace-order-lines-grid th {
  position: static;
  z-index: auto;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-worklist-table .workspace-order-lines-grid tbody tr,
.workspace-worklist-table .workspace-order-lines-grid tbody tr:hover {
  cursor: default;
  background: transparent;
}

.workspace-worklist-table .workspace-order-lines-grid tbody tr.line-arrived,
.workspace-worklist-table .workspace-order-lines-grid tbody tr.line-arrived:hover {
  background: var(--green-bg);
}

.workspace-order-lines-grid th:last-child,
.workspace-order-lines-grid td:last-child {
  border-right: 0;
}

.workspace-order-lines-grid tbody tr:last-child td {
  border-bottom: 0;
}

.workspace-order-lines-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-order-lines-status.error {
  color: var(--danger);
}

.workspace-order-lines-status button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.workspace-order-lines-status button:hover {
  border-color: var(--brand-red-strong);
  color: var(--brand-red-strong);
}

.workspace-line-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-red-strong);
  border-radius: 50%;
  animation: busy-spin .8s linear infinite;
}

.numeric {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.center {
  text-align: center !important;
}

.workspace-state-badge,
.workspace-state-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.workspace-state-badge {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 750;
}

.workspace-state-value span,
.workspace-save-state > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.workspace-state-value {
  min-height: 26px;
  width: max-content;
  max-width: 100%;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.workspace-state-value.neutral span { background: var(--text-muted); }
.workspace-state-value.information span { background: var(--brand-red-strong); }
.workspace-state-value.success span { background: var(--green); }
.workspace-state-value.warning span { background: var(--orange); }
.workspace-state-value.danger span { background: var(--danger); }

.workspace-state-value.information { background: var(--brand-red-soft); color: var(--brand-red-strong); }
.workspace-state-value.success { background: var(--green-bg); color: var(--green); }
.workspace-state-value.warning { background: var(--orange-bg); color: var(--orange); }
.workspace-state-value.danger { background: var(--danger-bg); color: var(--danger); }

.workspace-notes-button {
  min-height: 30px;
  width: max-content;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.workspace-notes-button:hover,
.workspace-notes-button:focus-visible {
  border-color: var(--brand-red-strong);
  color: var(--brand-red-strong);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-open-order,
.workspace-remove-order,
.workspace-issue-invoice,
.workspace-mark-payment-received,
.workspace-remove-line {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 17px;
}

.workspace-open-order:hover,
.workspace-remove-order:hover,
.workspace-issue-invoice:hover,
.workspace-mark-payment-received:hover,
.workspace-remove-line:hover {
  background: var(--surface-soft);
  color: var(--brand-red-strong);
}

.workspace-order-actions {
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.workspace-remove-order {
  color: var(--danger);
}

.workspace-list-footer {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
}

#workspaceListSummary {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.workspace-waybill {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-documents {
  min-height: 0;
  height: 100%;
  align-self: stretch;
  overflow: hidden;
  background: var(--surface);
}

.workspace-order-document {
  position: relative;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.workspace-order-document[hidden] {
  display: none;
}

.workspace-context-ribbon {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.workspace-context-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(130px, 1fr);
  overflow-x: auto;
  padding: 12px 16px;
}

.workspace-context-secondary {
  display: flex;
  border-top: 1px solid var(--border);
}

.workspace-context-secondary > .workspace-context-field {
  min-width: 180px;
  flex: 2 1 180px;
}

.workspace-context-secondary > .workspace-context-field.compact {
  min-width: 90px;
  flex: 1 1 90px;
}

.workspace-context-secondary > .workspace-voucher-actions {
  min-width: max-content;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0 8px 0 14px;
  border-top: 0;
}

.workspace-context-field {
  position: relative;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
}

.workspace-context-field:first-child {
  padding-left: 8px;
}

.workspace-context-field:last-child {
  border-right: 0;
}

.workspace-context-field small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.workspace-context-field strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.workspace-context-field input,
.workspace-context-field select {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.workspace-percent-input {
  position: relative;
}

.workspace-percent-input input {
  padding-right: 24px;
}

.workspace-percent-input span {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-control-error {
  position: absolute;
  top: calc(100% + 4px);
  left: 7px;
  z-index: 100;
  min-width: 180px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border));
  border-radius: 4px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 11px;
  box-shadow: var(--shadow);
}

.workspace-lookup-control {
  position: relative;
}

.workspace-readonly-banner {
  min-height: 30px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.workspace-product-search-wrap {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 35%, var(--surface));
}

.workspace-product-search input {
  width: 100%;
  height: 42px;
  padding: 0 44px 0 43px;
  font-size: 13px;
}

.workspace-product-search .workspace-search-spinner {
  position: absolute;
  right: 14px;
}

.workspace-search-error {
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 11px;
}

.workspace-search-overlay {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 80;
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-raised);
  box-shadow: 0 16px 34px rgba(20, 24, 32, .16);
}

.workspace-product-search-wrap > .workspace-search-overlay {
  top: calc(100% - 10px);
  left: 16px;
  right: 16px;
}

.workspace-product-result-head,
.product-results button {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(300px, 2.3fr) minmax(110px, .8fr) 80px 100px 110px 95px;
  gap: 0;
  align-items: center;
}

.workspace-product-result-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 1050px;
  min-height: 34px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-product-result-head span,
.product-results button > span,
.product-results button > strong {
  min-width: 0;
  padding: 0 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-results button {
  width: 100%;
  min-width: 1050px;
  min-height: 44px;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 12px;
}

.product-results button:hover,
.product-results button.active,
.customer-results button:hover,
.customer-results button.active {
  background: color-mix(in srgb, var(--brand-red-soft) 55%, var(--surface));
}

.availability {
  font-weight: 800;
}

.availability.status-2 {
  color: var(--green);
}

.availability.status-3 {
  color: var(--orange);
}

.availability.status-4 {
  color: var(--danger);
}

.customer-results {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  z-index: 1000;
  width: min(430px, calc(100vw - 24px));
}

.customer-results button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 11px;
}

.customer-results button span,
.customer-results button small {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-no-results,
.workspace-empty-row td {
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.workspace-lines-shell {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.workspace-lines-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

.workspace-lines-table {
  min-width: 1612px;
  table-layout: fixed;
}

.workspace-lines-table th:nth-child(1) { width: 48px; }
.workspace-lines-table th:nth-child(2) { width: 145px; }
.workspace-lines-table th:nth-child(3) { width: auto; }
.workspace-lines-table th:nth-child(4) { width: 105px; }
.workspace-lines-table th:nth-child(5) { width: 82px; }
.workspace-lines-table th:nth-child(6) { width: 115px; }
.workspace-lines-table th:nth-child(7) { width: 120px; }
.workspace-lines-table th:nth-child(8) { width: 115px; }
.workspace-lines-table th:nth-child(9) { width: 125px; }
.workspace-lines-table th:nth-child(10) { width: 82px; }
.workspace-lines-table th:nth-child(11) { width: 72px; }
.workspace-lines-table th:nth-child(12) { width: 82px; }
.workspace-lines-table th:nth-child(13) { width: 100px; }
.workspace-lines-table th:nth-child(14) { width: 68px; }

.workspace-lines-table th:nth-child(n+10),
.workspace-lines-table td:nth-child(n+10) {
  padding-right: 8px;
  padding-left: 8px;
}

.workspace-lines-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-red-strong);
  cursor: pointer;
}

.workspace-lines-table td {
  position: relative;
  height: 56px;
  padding: 7px 11px;
}

.workspace-lines-table .sku,
.workspace-lines-table .product-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-lines-table tbody tr:hover {
  background: color-mix(in srgb, var(--surface-soft) 48%, transparent);
}

.workspace-lines-table tbody tr.failed {
  box-shadow: inset 3px 0 0 var(--danger);
}

.workspace-lines-table tbody tr.line-arrived {
  background: var(--green-bg);
}

.workspace-lines-table tbody tr.line-arrived:hover {
  background: color-mix(in srgb, var(--green-bg) 72%, var(--surface));
}

.workspace-cell-input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.discount-cell .workspace-cell-input {
  padding-right: 21px;
}

.percent-mark {
  position: absolute;
  top: 19px;
  right: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.workspace-cell-error {
  position: absolute;
  top: calc(100% - 4px);
  right: 7px;
  z-index: 12;
  width: max-content;
  max-width: 240px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border));
  border-radius: 4px;
  background: var(--danger-bg);
  color: var(--danger);
  text-align: left;
  font-size: 10px;
  box-shadow: var(--shadow);
}

.workspace-totals-footer {
  flex: 0 0 76px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 35%, var(--surface));
  box-shadow: 0 -8px 20px rgba(20, 24, 32, .04);
}

.workspace-totals-footer .workspace-line-count {
  flex: 0 0 160px;
}

.workspace-totals-footer .workspace-save-state {
  flex: 0 0 140px;
}

.workspace-workflow-actions {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.workspace-workflow-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.workspace-workflow-button.primary {
  border-color: var(--brand-red-strong);
  background: var(--brand-red-strong);
  color: #fff;
}

.workspace-workflow-button.danger {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: var(--danger-bg);
  color: var(--danger);
}

.workspace-workflow-button.success {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border));
  background: var(--green-bg);
  color: var(--green);
}

.workspace-workflow-button.secondary {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--border));
  background: var(--blue-bg);
  color: var(--blue);
}

.workspace-workflow-button:hover:not(:disabled),
.workspace-workflow-button:focus-visible {
  outline: none;
  border-color: var(--brand-red-strong);
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-workflow-button:disabled {
  cursor: wait;
  opacity: .58;
}

.workspace-line-count {
  font-size: 12px;
}

.workspace-save-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-save-state.saving > span {
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  background: transparent;
  animation: busy-spin .8s linear infinite;
}

.workspace-save-state.failed {
  color: var(--danger);
}

.workspace-save-state.failed > span {
  background: var(--danger);
}

.workspace-totals-footer dl {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin: 0 0 0 auto;
}

.workspace-order-log {
  position: absolute;
  top: 52px;
  right: 0;
  bottom: 0;
  z-index: 150;
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface-raised);
  box-shadow: -16px 0 34px rgba(20, 24, 32, .18);
}

.workspace-order-log[hidden] {
  display: none;
}

.workspace-order-log-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--border);
}

.workspace-order-log-header > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workspace-order-log-header small {
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-order-log-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-order-log-header button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
}

.workspace-order-log-header button:hover,
.workspace-order-log-header button:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
  outline: 2px solid var(--brand-red-strong);
}

.workspace-order-log-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
}

.workspace-order-log-entry {
  position: relative;
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.workspace-order-log-entry.workflow {
  border-left: 3px solid var(--text-muted);
  background: color-mix(in srgb, var(--surface-soft) 55%, var(--surface));
}

.workspace-order-log-entry.workflow.information { border-left-color: var(--brand-red-strong); }
.workspace-order-log-entry.workflow.success { border-left-color: var(--green); }
.workspace-order-log-entry.workflow.warning { border-left-color: var(--orange); }
.workspace-order-log-entry.workflow.danger { border-left-color: var(--danger); }

.workspace-order-log-entry-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workspace-order-log-entry-heading strong {
  font-size: 12px;
}

.workspace-order-log-entry-heading time,
.workspace-order-log-entry small,
.workspace-order-log-composer-actions span {
  color: var(--text-muted);
  font-size: 10px;
}

.workspace-order-log-entry-heading time {
  flex: 0 0 auto;
}

.workspace-order-log-entry p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.workspace-order-log-loading,
.workspace-order-log-empty,
.workspace-order-log-error {
  padding: 24px 8px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

.workspace-order-log-error {
  color: var(--danger);
}

.workspace-order-log-composer {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.workspace-order-log-composer[hidden] {
  display: none;
}

.workspace-order-log-composer label {
  font-size: 12px;
  font-weight: 800;
}

.workspace-order-from {
  display: grid;
  gap: 6px;
}

.workspace-order-from select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.workspace-order-from select:focus {
  border-color: var(--brand-red-strong);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-order-log-composer textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.workspace-order-log-composer textarea:focus {
  border-color: var(--brand-red-strong);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-red-soft);
}

.workspace-order-log-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace-order-log-composer-actions button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--brand-red-strong);
  border-radius: 5px;
  background: var(--brand-red-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.workspace-order-log-composer-actions button:disabled {
  opacity: .5;
}

.workspace-order-log-error {
  margin: 0;
}

.workspace-order-log-composer .workspace-order-log-error {
  padding: 0;
  text-align: left;
}

@media (max-width: 1000px) {
  .workspace-totals-footer {
    gap: 10px;
    padding: 0 12px;
    overflow-x: auto;
  }

  .workspace-totals-footer .workspace-line-count {
    flex-basis: 125px;
  }

  .workspace-totals-footer .workspace-save-state {
    flex-basis: 115px;
  }

  .workspace-workflow-button {
    padding: 0 9px;
  }

  .workspace-totals-footer dl > div {
    min-width: 105px;
    padding: 0 12px;
  }
}

.workspace-totals-footer dl > div {
  min-width: 150px;
  padding: 0 30px;
  border-left: 1px solid var(--border);
  text-align: right;
}

.workspace-totals-footer dt {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-totals-footer dd {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.workspace-totals-footer .total dd {
  color: var(--brand-red-strong);
  font-size: 24px;
  font-weight: 850;
}

.workspace-order-document.bulk-saving .workspace-lines-scroll {
  pointer-events: none;
  opacity: .68;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1280px) {
  .orders-workspace-page .content {
    overflow: auto;
  }

  .workspace-context-row {
    grid-auto-columns: minmax(140px, 1fr);
  }
}

@media (max-width: 760px) {
  .orders-workspace-page .content {
    height: auto;
    min-height: 620px;
    overflow: visible;
  }

  .orders-workspace {
    height: auto;
    min-width: 0;
    min-height: calc(100vh - 76px);
  }

  .workspace-document-tabs {
    padding: 0;
  }

  .workspace-document-tab {
    width: 118px;
    flex-basis: 118px;
    padding: 0 14px;
  }

  .workspace-new-order {
    flex-basis: 116px;
  }

  .workspace-worklist {
    padding: 14px;
  }

  .workspace-worklist-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  #workspaceOrderExports,
  #workspaceOrderExports .export-actions {
    width: 100%;
  }

  #workspaceOrderExports .export-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-filter-grid .filter-field {
    grid-column: 1 / -1;
  }

  .workspace-list-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/*
 * Compact desktop density
 *
 * The backoffice is an information-dense application. Keep touch-friendly
 * mobile sizing, while making the shared desktop shell and data controls fit
 * comfortably at the browser's default 100% zoom.
 */
@media (min-width: 761px) {
  :root {
    --sidebar-width: 240px;
  }

  body {
    font-size: 14px;
  }

  .sidebar {
    padding: 18px 14px;
  }

  .brand {
    height: 46px;
    margin-bottom: 20px;
  }

  .brand img {
    width: 174px;
    max-height: 50px;
  }

  .nav {
    gap: 4px;
  }

  .nav-item {
    min-height: 38px;
    gap: 11px;
    padding: 0 12px;
    font-size: 14px;
  }

  .nav-group {
    padding-bottom: 5px;
  }

  .sub {
    margin: 2px 8px 2px 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .sub.nested {
    margin-left: 56px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 12px;
  }

  .topbar {
    height: 64px;
    gap: 16px;
    padding: 0 24px;
  }

  .topbar-left {
    gap: 14px;
  }

  .topbar-right {
    gap: 10px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .language-switch,
  .theme-toggle {
    min-height: 34px;
    height: 34px;
  }

  .user-menu {
    min-height: 40px;
  }

  .avatar {
    width: 38px;
    height: 38px;
  }

  .content {
    padding: 24px;
  }

  .page-heading {
    margin-bottom: 18px;
  }

  .product-heading {
    margin-bottom: 16px;
  }

  h1,
  h2 {
    font-size: 24px;
  }

  .product-filter-section {
    margin-top: 16px;
  }

  .product-filter-section summary {
    min-height: 44px;
    padding: 0 15px;
  }

  .product-filter-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 0 15px 14px;
  }

  .product-filter-grid {
    grid-column: 1;
    gap: 10px 12px;
  }

  .product-filter-actions {
    grid-column: 2;
    align-self: end;
    flex-wrap: nowrap;
  }

  .product-filter-form .filter-field {
    gap: 5px;
  }

  .product-filter-form input,
  .product-filter-form select,
  .global-search input,
  .search-field input,
  select,
  .product-form input,
  .auth-form input,
  .user-create-form input,
  .user-create-form select,
  .user-edit-form input,
  .user-edit-form select,
  .reset-form input,
  .custom-action-form input,
  .price-calculator-table input {
    min-height: 36px;
  }

  .filters {
    gap: 10px;
    padding: 16px 18px;
  }

  .result-count {
    padding: 12px 18px;
  }

  .pagination {
    min-height: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .orders-workspace-page .content {
    height: calc(100vh - 64px);
    min-height: 560px;
  }

  .orders-workspace {
    grid-template-rows: 46px auto minmax(0, 1fr);
  }

  .workspace-worklist {
    padding: 14px;
  }

  .workspace-worklist-controls {
    gap: 10px;
    padding-bottom: 10px;
  }

  .workspace-worklist-heading {
    min-height: 34px;
  }

  .workspace-worklist-toolbar {
    padding-bottom: 10px;
  }

  .order-filter-state-options {
    gap: 7px 14px;
  }

  .workspace-worklist-table th {
    height: 38px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .workspace-worklist-table td {
    height: 46px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .workspace-list-footer {
    min-height: 42px;
  }
}

@media (max-width: 760px) {
  .product-filter-form {
    grid-template-columns: 1fr;
  }

  .product-filter-grid,
  .product-filter-actions {
    grid-column: 1;
  }
}

/* Filters inside list/create split layouts use the panel width, not the viewport. */
@media (min-width: 761px) {
  .customers-page-grid .product-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .customers-page-grid .product-filter-grid {
    grid-column: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .customers-page-grid .product-filter-actions {
    grid-column: 1;
    justify-content: flex-end;
  }
}

/* Current fiscal period KPI panel */
.stats-grid.fiscal-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-red) 20%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand-red-soft) 82%, #fff) 0%,
      color-mix(in srgb, var(--brand-red-soft) 48%, #fff) 45%,
      var(--surface) 100%);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--brand-red) 70%, transparent);
}

.stats-grid.fiscal-summary > div {
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

@media (max-width: 1100px) {
  .stats-grid.fiscal-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .stats-grid.fiscal-summary {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* Accounting fiscal archive report */
.accounting-report-heading {
    align-items: flex-end;
}

.accounting-report-kicker {
    color: var(--brand-red);
    display: block;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    margin-bottom: .35rem;
    text-transform: uppercase;
}

.accounting-zip-button {
    gap: .5rem;
}

.accounting-period-panel {
    align-items: end;
    background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--brand-red) 7%, var(--surface)));
    border: 1px solid var(--border);
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.4rem;
}

.accounting-period-panel > div {
    display: grid;
    gap: .2rem;
}

.accounting-period-panel > div small,
.accounting-files-summary small {
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.accounting-period-panel > div strong {
    font-size: 1.35rem;
}

.accounting-period-form {
    align-items: end;
    display: flex;
    gap: .75rem;
}

.accounting-period-form label {
    display: grid;
    gap: .3rem;
}

.accounting-period-form label small {
    color: var(--text-muted);
    font-weight: 700;
}

.accounting-period-form select {
    min-width: 9rem;
}

.accounting-files-panel {
    overflow: hidden;
}

.accounting-files-summary {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.accounting-files-summary > div {
    align-items: baseline;
    display: flex;
    gap: .65rem;
}

.accounting-files-summary strong {
    font-size: 1.35rem;
}

.accounting-files-summary p {
    color: var(--text-muted);
    margin: 0;
}

.accounting-table-wrap {
    overflow-x: auto;
}

.accounting-file-cell {
    align-items: center;
    display: flex;
    gap: .8rem;
    min-width: 18rem;
}

.accounting-file-cell > div {
    display: grid;
    gap: .18rem;
}

.accounting-file-cell small {
    color: var(--text-muted);
}

.accounting-file-icon {
    align-items: center;
    background: color-mix(in srgb, var(--brand-red) 12%, transparent);
    border-radius: 9px;
    color: var(--brand-red);
    display: inline-flex;
    font-size: .65rem;
    font-weight: 900;
    height: 2.3rem;
    justify-content: center;
    letter-spacing: .03em;
    width: 2.3rem;
}

.accounting-file-icon.pdf {
    background: color-mix(in srgb, #dc3545 13%, transparent);
    color: #c92a3a;
}

.accounting-file-icon.xlsx {
    background: color-mix(in srgb, #198754 13%, transparent);
    color: #198754;
}

@media (max-width: 760px) {
    .accounting-period-panel,
    .accounting-period-form {
        align-items: stretch;
        flex-direction: column;
    }

    .accounting-period-form select {
        width: 100%;
    }

    .accounting-files-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: .5rem;
    }
}
.price-calculator-heading {
  align-items: center;
}

.price-calculator-panel {
  padding: 0;
}

.price-calculator-table-wrap {
  overflow-x: auto;
}

.price-calculator-table {
  min-width: 1240px;
}

.price-calculator-table th,
.price-calculator-table td {
  white-space: nowrap;
}

.price-calculator-table select,
.price-calculator-table input {
  min-width: 116px;
  width: 100%;
}

.price-calculator-table select {
  min-width: 160px;
}

.price-calculator-table output {
  display: inline-block;
  min-width: 70px;
  font-variant-numeric: tabular-nums;
}

.grader-table {
  border-collapse: collapse;
  border-spacing: 0;
}

.grader-table tbody td {
  padding: 0;
  border-right: 1px solid var(--border);
}

.grader-table tbody td:last-child {
  border-right: 0;
}

.grader-table select,
.grader-table input {
  display: block;
  min-height: 40px;
  margin: 0;
  border-radius: 0;
}

.grader-table [data-grader-number] {
  width: 92px;
  min-width: 92px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Bertus rows can hold a whole reserved range in one SKU (e.g. "120087, 120088, 120089"),
   so this field needs far more room than Grader's always-single-number one above. */
.grader-table [data-bertus-number] {
  width: 220px;
  min-width: 220px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* Gift-voucher controls share the order editor's compact, inline interaction style. */
.workspace-voucher-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .75rem;
    align-items: end;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border-color, #dbe2ea);
}

.button.workflow-tone {
    box-shadow: 0 1px 2px rgb(15 23 42 / .08);
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.button.workflow-tone.neutral {
    color: #303742;
    border-color: #69717d;
    background: #eef0f3;
}

.button.workflow-tone.information {
    color: #a61f24;
    border-color: #d6272d;
    background: #f9e3e4;
}

.button.workflow-tone.warning {
    color: #9a4f00;
    border-color: #d97706;
    background: #fff0d6;
}

.button.workflow-tone.success {
    color: #147a40;
    border-color: #1f9d55;
    background: #daf5e4;
}

.button.workflow-tone.danger {
    color: #a61f24;
    border-color: #d6272d;
    background: #ffe1e4;
}

.button.workflow-tone:hover:not(:disabled) {
    box-shadow: 0 4px 10px rgb(15 23 42 / .12);
    transform: translateY(-1px);
}

.button.workflow-tone:disabled {
    opacity: .45;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.workspace-voucher-error,
.workspace-manual-line-error {
    flex-basis: 100%;
    margin: 0;
    color: #b42318;
}

.workspace-voucher-dialog {
    width: min(32rem, calc(100vw - 2rem));
    border: 0;
    border-radius: var(--radius);
    padding: 1.25rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.workspace-voucher-dialog::backdrop {
    background: rgb(15 23 42 / .55);
}

.workspace-voucher-dialog form,
.workspace-voucher-dialog label {
    display: grid;
    gap: .75rem;
}

.workspace-voucher-dialog header,
.workspace-voucher-dialog footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
}

.workspace-voucher-dialog header h2 {
    margin: 0;
}

.workspace-preorder-dialog {
    width: min(56rem, calc(100vw - 2rem));
}

.workspace-preorder-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}

.workspace-preorder-actions {
    display: flex;
    justify-content: flex-end;
}

.workspace-preorder-results {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 5px;
}

.workspace-preorder-results table {
    width: 100%;
}

.workspace-split-dialog {
    width: min(36rem, calc(100vw - 2rem));
}

.workspace-split-hint {
    margin: 0;
    color: var(--text-muted);
}

.workspace-split-lines {
    display: grid;
    gap: 0;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 5px;
}

.workspace-split-line {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.workspace-split-line:last-child {
    border-bottom: 0;
}

.workspace-split-line:hover {
    background: var(--surface-soft);
}

.workspace-split-line-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-split-line-meta {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.invoice-list-toolbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.invoice-customer-filter {
    position: relative;
}

.invoice-customer-results {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d8dce3);
    border-radius: 0.35rem;
    box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 14%);
    left: 0;
    max-height: 15rem;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 20;
}

.invoice-customer-results button {
    background: transparent;
    border: 0;
    cursor: pointer;
    display: block;
    padding: 0.65rem 0.8rem;
    text-align: left;
    width: 100%;
}

.invoice-customer-results button:hover,
.invoice-customer-results button:focus {
    background: rgb(0 0 0 / 6%);
}

.invoice-parent-reference {
    display: block;
    margin-top: 0.2rem;
    white-space: nowrap;
}

.invoice-credit-note-dialog {
    border: 0;
    border-radius: 0.6rem;
    max-width: 760px;
    padding: 0;
    width: min(760px, calc(100vw - 2rem));
}

.invoice-credit-note-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.invoice-credit-note-dialog-content {
    padding: 1.25rem;
}

.invoice-credit-note-dialog header,
.invoice-credit-note-dialog footer {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.invoice-credit-note-dialog header h2,
.invoice-credit-note-dialog header p {
    margin: 0;
}

.invoice-credit-note-dialog footer {
    border-top: 1px solid var(--border, #d8dce3);
    margin-top: 1rem;
    padding-top: 1rem;
}

.invoice-credit-note-lines {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
    max-height: 55vh;
    overflow-y: auto;
}

.invoice-credit-note-line {
    align-items: center;
    border: 1px solid var(--border, #d8dce3);
    border-radius: 0.4rem;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0.75rem;
}

.invoice-credit-note-line span,
.invoice-credit-note-line small {
    display: block;
}

.invoice-credit-note-line.credited {
    opacity: 0.65;
}

.invoice-cancelled-badge {
    color: var(--danger, #b3261e);
    display: block;
    font-weight: 600;
    margin-top: 0.2rem;
    white-space: nowrap;
}

.invoice-cancel-dialog {
    border: 0;
    border-radius: 0.6rem;
    max-width: 480px;
    padding: 0;
    width: min(480px, calc(100vw - 2rem));
}

.invoice-cancel-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.invoice-cancel-dialog-content {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
}

.invoice-cancel-dialog-content > label.filter-field {
    margin: 0;
}

.invoice-cancel-dialog header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.invoice-cancel-dialog header h2,
.invoice-cancel-dialog header p {
    margin: 0;
}

.invoice-cancel-dialog header p[data-cancel-dialog-return-notice] {
    color: var(--danger, #b3261e);
    margin-top: 0.35rem;
}

.invoice-cancel-dialog footer {
    border-top: 1px solid var(--border, #d8dce3);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
}

.banner-generator-page-grid,
.banner-generator-details-workarea {
    display: grid;
    gap: 1rem;
}

.banner-generator-page-grid {
    align-items: start;
    grid-template-columns: minmax(520px, 0.75fr) minmax(680px, 1.25fr);
}

.banner-generator-list-workarea {
    grid-template-columns: minmax(0, 1fr);
}

.banner-generator-list-workarea .list-panel {
    border-right: 0;
}

.banner-generator-list-workarea .product-filter-section {
    margin: 12px 12px 0;
}

.banner-generator-list-workarea .product-filter-section summary {
    min-height: 42px;
    padding: 0 12px;
}

.banner-generator-list-workarea .product-filter-form {
    align-items: end;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 12px 12px;
}

.banner-generator-list-workarea .product-filter-grid {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.35fr);
}

.banner-generator-list-workarea .product-filter-grid .filter-field {
    grid-column: auto;
}

.banner-generator-list-workarea .result-count {
    padding: 10px 12px;
}

.banner-generator-table-scroll {
    min-width: 0;
    overflow-x: auto;
}

.banner-generator-projects-table {
    font-size: 13px;
}

.banner-generator-projects-table th,
.banner-generator-projects-table td {
    padding: 10px 9px;
}

.banner-generator-projects-table th:nth-child(1) {
    width: 94px;
}

.banner-generator-projects-table th:nth-child(2) {
    width: 84px;
}

.banner-generator-projects-table th:nth-child(4),
.banner-generator-projects-table th:nth-child(5) {
    width: 58px;
}

.banner-generator-projects-table th:nth-child(6) {
    width: 88px;
}

.banner-generator-projects-table th:nth-child(7) {
    width: 136px;
}

.banner-generator-projects-table .table-actions {
    min-width: 0;
}

.banner-generator-projects-table .table-actions .small-button {
    min-width: 58px;
}

.banner-generator-projects-table td.table-actions > .small-button + form {
    margin-left: 6px;
}

.banner-generator-project-headline {
    overflow-wrap: anywhere;
}

.banner-generator-create-panel .customer-form {
    grid-template-columns: minmax(0, 1fr);
}

.banner-generator-create-panel .customer-form fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.banner-generator-upload-field {
    align-content: start;
    display: grid;
    gap: 7px;
    min-width: 0;
}

.banner-generator-assets-panel {
    display: grid;
    gap: 14px;
    padding: 14px 16px 16px;
}

.banner-generator-assets-header {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.banner-generator-assets-header h3,
.banner-generator-assets-header p {
    margin: 0;
}

.banner-generator-assets-header h3 {
    color: var(--brand-red);
    font-size: 14px;
    font-weight: 800;
}

.banner-generator-assets-header p {
    color: var(--text-muted);
    font-size: 12px;
}

.banner-generator-assets-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.banner-generator-file-picker {
    display: flex;
    justify-content: flex-start;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

.banner-generator-file-picker .file-picker-filename {
    max-width: none;
    min-width: 0;
}

.banner-generator-create-button {
    height: 40px;
    min-height: 40px;
    min-width: 180px;
}

.banner-generator-create-actions {
    align-items: flex-end;
    align-self: stretch;
    display: flex;
    justify-content: flex-end;
}

.banner-generator-details-workarea {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.banner-generator-preview {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.banner-generator-project-actions {
    grid-column: 1;
    grid-row: 3;
}

.banner-generator-versions {
    grid-column: 1;
    grid-row: 4;
}

.banner-generator-project-actions .card-header,
.banner-generator-versions .card-header {
    margin-bottom: 14px;
}

.banner-generator-action-buttons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.banner-generator-action-buttons form {
    margin: 0;
}

.banner-generator-revision-usage {
    color: var(--text-muted);
    margin: 12px 0 0;
}

.banner-generator-revision-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) auto;
    margin-top: 14px;
}

.banner-generator-revision-form label {
    display: grid;
    gap: 7px;
}

.banner-generator-revision-form select,
.banner-generator-revision-form textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    min-height: 40px;
    padding: 9px 12px;
    width: 100%;
}

.banner-generator-preview-image {
    background: #111;
    display: block;
    height: auto;
    max-height: 72vh;
    object-fit: contain;
    width: 100%;
}

.banner-generator-asset-thumbnail {
    background: #171717;
    border-radius: 0.25rem;
    height: 64px;
    object-fit: cover;
    width: 64px;
}

.field-hint {
    color: var(--muted-text, #68707c);
    display: block;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

@media (max-width: 1280px) {
    .banner-generator-page-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .banner-generator-details-workarea {
        grid-template-columns: 1fr;
    }

    .banner-generator-preview,
    .banner-generator-project-actions,
    .banner-generator-versions {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 700px) {
    .banner-generator-create-panel .customer-form fieldset,
    .banner-generator-list-workarea .product-filter-form,
    .banner-generator-list-workarea .product-filter-grid,
    .banner-generator-assets-grid {
        grid-template-columns: 1fr;
    }

    .banner-generator-create-panel .span-2 {
        grid-column: 1;
    }

    .banner-generator-revision-form {
        grid-template-columns: 1fr;
    }
}

/* Contextual Help */
.contextual-help-button {
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.contextual-help-button[hidden] {
  display: none;
}

.contextual-help-drawer {
  position: fixed;
  top: 76px;
  right: 0;
  bottom: 0;
  z-index: 1900;
  width: clamp(360px, 25vw, 420px);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.contextual-help-drawer[hidden] {
  display: none;
}

.contextual-help-scrim {
  position: fixed;
  inset: 0;
  z-index: 1899;
  background: rgba(17, 19, 24, .42);
}

.contextual-help-scrim[hidden] {
  display: none;
}

.contextual-help-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.contextual-help-header-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.contextual-help-header-copy h2 {
  margin: 0;
  font-size: 15px;
}

.contextual-help-context {
  color: var(--text-muted);
  font-size: 12px;
}

.contextual-help-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  display: grid;
  place-items: center;
}

.contextual-help-close:hover,
.contextual-help-close:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

.contextual-help-search {
  flex: 0 0 auto;
  margin: 12px 16px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.contextual-help-search:focus-visible {
  border-color: var(--brand-red-strong);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-red-soft);
}

.contextual-help-topics {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 16px;
}

.contextual-help-no-matches {
  padding: 24px 8px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.contextual-help-topic {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface);
}

.contextual-help-topic-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.contextual-help-topic-button:hover,
.contextual-help-topic-button:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.contextual-help-topic-chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform .15s ease;
}

.contextual-help-topic[data-expanded="true"] .contextual-help-topic-chevron {
  transform: rotate(90deg);
}

.contextual-help-topic-content {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.contextual-help-topic-content[hidden] {
  display: none;
}

.contextual-help-topic-content ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.contextual-help-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.contextual-help-note.warning {
  background: var(--brand-red-soft);
  color: var(--brand-red-strong);
}

.contextual-help-show-me {
  margin-top: 10px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--brand-red-strong);
  border-radius: 6px;
  background: var(--brand-red-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.contextual-help-highlight {
  outline: 3px solid var(--brand-red-strong);
  outline-offset: 2px;
  border-radius: 4px;
  animation: contextual-help-pulse 1s ease-in-out 2;
}

@keyframes contextual-help-pulse {
  0%, 100% { outline-color: var(--brand-red-strong); }
  50% { outline-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .contextual-help-highlight {
    animation: none;
  }

  .contextual-help-topic-chevron {
    transition: none;
  }
}

@media (max-width: 700px) {
  .contextual-help-drawer {
    width: 100vw;
  }
}

.performance-charts {
  display: grid;
  gap: 18px;
}

.performance-chart-panel {
  min-width: 0;
  margin: 0;
  padding: 22px;
}

.performance-chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.performance-chart-heading small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.performance-chart-heading h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.performance-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.performance-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.performance-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.performance-legend-swatch.offline {
  background: #3978b8;
}

.performance-legend-swatch.online {
  background: #dc8128;
}

.performance-chart-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.performance-chart-svg {
  display: block;
  min-height: 390px;
  color: var(--text);
}

.performance-grid-line {
  stroke: var(--border);
  stroke-dasharray: 4 4;
}

.performance-axis-line,
.performance-axis-tick {
  stroke: var(--border);
}

.performance-axis-label {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.performance-series-line,
.performance-series-point,
.performance-income-bar {
  transition: opacity .15s ease;
}

.performance-series-point:hover,
.performance-income-bar:hover {
  opacity: .72;
}

.performance-bar-value {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .performance-chart-panel {
    padding: 16px;
  }

  .performance-chart-heading {
    flex-direction: column;
  }
}
.issue-invoice-draft {
  display: grid;
  gap: 1rem;
}

.issue-invoice-header,
.issue-invoice-lines {
  padding: 1.25rem;
}

.issue-invoice-fields {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) 140px minmax(190px, 0.9fr) minmax(240px, 1fr);
  gap: 1rem;
  align-items: end;
}

.issue-invoice-fields > .filter-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.issue-invoice-fields > .filter-field input,
.issue-invoice-fields > .filter-field select {
  width: 100%;
  min-height: 42px;
}

.issue-invoice-customer {
  position: relative;
}

.issue-invoice-vat {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 42px;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.issue-invoice-vat legend {
  padding: 0 0.25rem;
  font-size: 0.75rem;
}

.issue-invoice-line-editor {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(260px, 2fr) minmax(100px, 0.7fr) minmax(130px, 0.9fr) minmax(110px, 0.7fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}

.issue-invoice-line-editor label {
  display: grid;
  gap: 0.35rem;
}

.issue-invoice-summary {
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 2rem;
  margin-top: 1rem;
}

.issue-invoice-summary dl {
  min-width: 300px;
  margin: 0;
}

.issue-invoice-summary dl div {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.35rem 0;
}

.issue-invoice-summary dd {
  display: grid;
  justify-items: end;
  margin: 0;
}

.issue-invoice-summary dd small {
  color: var(--text-muted);
}

.issue-invoice-grand-total {
  margin-top: 0.3rem;
  border-top: 1px solid var(--border);
  font-size: 1.15rem;
  font-weight: 700;
}

.issue-invoice-rate {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.issue-invoice-wording {
  margin-top: 1rem;
  border: 1px solid var(--border);
}

.issue-invoice-wording p {
  margin: 0;
  padding: 0.65rem 0.75rem;
}

.issue-invoice-wording p + p {
  border-top: 1px solid var(--border);
}

@media (max-width: 1050px) {
  .issue-invoice-fields,
  .issue-invoice-line-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .issue-invoice-customer {
    grid-column: 1 / -1;
  }
}

@media (max-width: 650px) {
  .issue-invoice-fields,
  .issue-invoice-line-editor {
    grid-template-columns: 1fr;
  }

  .user-create-form > .button {
    grid-column: 1;
  }

  .issue-invoice-summary {
    align-items: stretch;
    flex-direction: column;
  }
}
