.button {
  display: inline-flex;
  min-height: var(--control-md);
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    opacity var(--transition-fast);
}

.button:hover {
  background: var(--color-surface-secondary);
}

.button-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

[data-theme="dark"] .button-primary {
  color: #10202c;
}

.button-primary:hover {
  border-color: var(--color-primary-hover);
  background: var(--color-primary-hover);
}

.button-secondary {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}

.button-secondary:hover {
  border-color: var(--color-text-subtle);
  background: var(--color-surface-secondary);
}

.button-danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.button-danger:hover {
  background: var(--color-danger-soft);
}

.button-ghost {
  min-height: var(--control-sm);
  padding-inline: 9px;
  color: var(--color-text-muted);
}

.editor-view-controls .button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.button-icon {
  width: var(--control-md);
  min-width: var(--control-md);
  padding: 0;
}

.button-sm {
  min-height: var(--control-sm);
  padding-inline: 10px;
  font-size: 12px;
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.46;
}

.button.is-loading {
  pointer-events: none;
}

.button.is-loading .icon {
  animation: spin 700ms linear infinite;
}

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

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-button:hover {
  background: var(--color-surface-secondary);
  color: var(--color-text);
}

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field label,
.field-label {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.field-hint,
.field-error {
  font-size: 11px;
}

.field-hint {
  color: var(--color-text-subtle);
}

.field-error {
  color: var(--color-danger);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.input,
.select {
  height: var(--control-md);
  padding: 0 10px;
}

.textarea {
  min-height: 88px;
  resize: vertical;
  padding: 9px 10px;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--color-text-subtle);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus);
  outline: 0;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"],
.editor-input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
  background: var(--color-surface-secondary);
  color: var(--color-text-subtle);
}

.input[data-selling-price]:read-only {
  background: var(--color-surface-secondary);
  color: var(--color-text-muted);
}

.input-sm,
.select-sm {
  height: var(--control-sm);
  font-size: 12px;
}

.search-field {
  position: relative;
  width: min(360px, 100%);
  min-width: min(360px, 100%);
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 10px;
  color: var(--color-text-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field .input {
  padding-left: 34px;
}

.universal-search {
  position: absolute;
  left: 50%;
  width: clamp(240px, 30vw, 480px);
  min-width: 0;
  transform: translateX(-50%);
}

.universal-search-field {
  --universal-search-edge-inset: 12px;

  position: relative;
  display: flex;
  height: 34px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.universal-search-field:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus);
}

.universal-search-field > .nav-icon {
  position: absolute;
  left: var(--universal-search-edge-inset);
  color: var(--color-text-subtle);
  pointer-events: none;
}

.universal-search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 48px 0 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
}

.universal-search-field input::placeholder {
  color: var(--color-text-subtle);
}

.universal-search-shortcut {
  position: absolute;
  right: var(--universal-search-edge-inset);
  padding: 2px 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  color: var(--color-text-subtle);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.2;
  pointer-events: none;
}

.universal-search-trigger,
.universal-search-close {
  display: none;
}

.universal-search-results {
  position: absolute;
  z-index: 70;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(620px, calc(100vh - var(--header-height) - 18px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-popover);
}

.universal-search-group + .universal-search-group {
  border-top: 1px solid var(--color-border);
}

.universal-search-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 5px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.universal-search-group-header span:last-child {
  color: var(--color-text-subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.universal-search-result {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  border-left: 2px solid transparent;
}

.universal-search-result:hover,
.universal-search-result.is-active {
  border-left-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.universal-search-result-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.universal-search-result-copy strong,
.universal-search-result-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.universal-search-result-copy strong {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 650;
}

.universal-search-result-copy > span,
.universal-search-result-meta {
  color: var(--color-text-muted);
  font-size: 11px;
}

.universal-search-result-meta {
  flex: 0 0 auto;
}

.universal-search-view-all {
  display: block;
  padding: 7px 12px 9px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 650;
}

.universal-search-view-all:hover {
  text-decoration: underline;
}

.universal-search-empty {
  display: grid;
  min-height: 104px;
  place-content: center;
  gap: 4px;
  padding: 18px;
  text-align: center;
}

.universal-search-empty strong {
  font-size: 12px;
}

.universal-search-empty span {
  color: var(--color-text-muted);
  font-size: 11px;
}

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

.col-3 {
  grid-column: span 3;
}
.col-4 {
  grid-column: span 4;
}
.col-5 {
  grid-column: span 5;
}
.col-6 {
  grid-column: span 6;
}
.col-8 {
  grid-column: span 8;
}
.col-12 {
  grid-column: 1 / -1;
}

.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.boq-items-panel {
  overflow: hidden;
}

.supporting-materials-panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
}

.panel-header p {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.panel-body {
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge,
.status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-secondary);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-draft {
  color: var(--color-text-muted);
}
.status-review {
  border-color: color-mix(
    in srgb,
    var(--color-warning) 28%,
    var(--color-border)
  );
  background: var(--color-warning-soft);
  color: var(--color-warning);
}
.status-approved,
.status-won,
.status-active {
  border-color: color-mix(
    in srgb,
    var(--color-success) 28%,
    var(--color-border)
  );
  background: var(--color-success-soft);
  color: var(--color-success);
}
.status-issued {
  border-color: color-mix(in srgb, var(--color-info) 28%, var(--color-border));
  background: var(--color-info-soft);
  color: var(--color-info);
}
.status-lost,
.status-inactive {
  border-color: color-mix(
    in srgb,
    var(--color-danger) 28%,
    var(--color-border)
  );
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 900px;
  background: var(--color-surface);
  font-size: 12px;
}

.data-table th {
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-secondary);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: color-mix(
    in srgb,
    var(--color-surface-secondary) 56%,
    transparent
  );
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .cell-primary {
  color: var(--color-text);
  font-weight: 620;
}

.customer-company-link {
  padding: 0;
  text-align: left;
}

.product-name-link {
  padding: 0;
  text-align: left;
}

.data-table .boq-number-cell {
  white-space: nowrap;
}

.boq-register-table {
  min-width: 1160px;
}

.data-table .boq-po-cell {
  min-width: 120px;
  white-space: nowrap;
}

.data-table .cell-secondary {
  display: block;
  margin-top: 2px;
  color: var(--color-text-subtle);
  font-size: 11px;
  font-weight: 450;
}

.data-table th.align-right,
.data-table td.align-right {
  text-align: right;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button::after {
  color: var(--color-text-subtle);
  content: "↕";
  font-size: 11px;
}

.sort-button[aria-sort="ascending"]::after {
  content: "↑";
  color: var(--color-primary);
}
.sort-button[aria-sort="descending"]::after {
  content: "↓";
  color: var(--color-primary);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.record-metric-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-metric {
  display: block;
  min-height: 126px;
  padding: 20px;
  transition: background-color var(--transition-fast);
}

.record-metric + .record-metric {
  border-left: 1px solid var(--color-border);
}

.record-metric:hover {
  background: var(--color-surface-secondary);
}

.record-metric:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -3px;
}

.record-metric-label {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.record-metric-value {
  margin-top: 10px;
  color: var(--color-text);
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1;
}

.record-metric-detail {
  margin-top: 10px;
  color: var(--color-text-muted);
  font-size: 12px;
}

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

.table-dashboard th,
.table-dashboard td {
  padding-inline: 16px;
}

.table-dashboard th {
  height: var(--dashboard-recent-table-header-height, 40px);
}

.table-dashboard td {
  height: var(--dashboard-recent-row-height, 52px);
}

.panel-body-compact-y {
  padding-top: 5px;
  padding-bottom: 5px;
}

.insight-list,
.settings-nav {
  list-style: none;
}

.insight-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.insight-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.insight-icon-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.insight-icon-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.insight-icon-info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.insight-item p {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.insight-title {
  color: var(--color-text);
  font-weight: 620;
}

.insight-title:hover {
  color: var(--color-primary);
}

.dashboard-record-list {
  list-style: none;
}

[data-recent-customer-pos-panel] .panel-header h2,
[data-recent-customer-pos-panel] .panel-header p,
[data-recent-customer-pos-panel] .panel-header .link {
  white-space: nowrap;
}

.dashboard-po-copy-compact {
  display: none;
}

@container recent-po-panel (max-width: 299px) {
  .dashboard-po-copy-full {
    display: none;
  }

  .dashboard-po-copy-compact {
    display: inline;
  }
}

.dashboard-record-item {
  min-height: var(--dashboard-po-row-height, 60px);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.dashboard-record-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(98px, auto);
  align-items: start;
  gap: 12px;
}

.dashboard-record-heading a {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 620;
}

.dashboard-record-heading a:hover {
  color: var(--color-primary);
}

.dashboard-record-heading strong {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 650;
}

.dashboard-record-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.dashboard-record-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-record-meta time {
  flex: 0 0 auto;
  color: var(--color-text-subtle);
  font-size: 11px;
  white-space: nowrap;
}

.empty-state.dashboard-compact-empty {
  min-height: 104px;
  padding: 18px;
}

.empty-state.dashboard-compact-empty p {
  margin-bottom: 0;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.empty-state-content {
  max-width: 360px;
}

.empty-state-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-secondary);
  color: var(--color-text-muted);
}

.empty-state p {
  margin: 6px 0 16px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.compact-empty {
  min-height: 150px;
  padding: 22px 12px;
}

.compact-editor-empty {
  min-height: 190px;
}

.editor-table-wrap {
  max-height: var(--editor-table-max-height, none);
  overscroll-behavior: contain;
}

.editor-table-viewport {
  position: relative;
  overflow: hidden;
}

.editor-table-viewport.sticky-columns-active::after {
  position: absolute;
  z-index: 7;
  top: 0;
  left: 0;
  width: var(--editor-sticky-boundary-width);
  height: var(--editor-table-viewport-height);
  box-shadow: var(--shadow-sticky-column);
  content: "";
  pointer-events: none;
}

.editor-table {
  --editor-sticky-index-width: 36px;
  --editor-sticky-item-width: 300px;
  --editor-sticky-qty-width: 68px;
  --editor-sticky-unit-width: 82px;
  --editor-table-min-width: 1360px;
  min-width: var(--editor-table-min-width);
  font-size: 11px;
}

.editor-table thead {
  position: sticky;
  z-index: 4;
  top: 0;
}

.editor-table td {
  height: 36px;
  padding: 2px 5px;
}

.editor-table th {
  height: 34px;
  padding: 0 6px;
}

.editor-table .editor-sticky-column {
  position: sticky;
}

.editor-table .editor-sticky-index {
  z-index: 3;
  left: 0;
  width: var(--editor-sticky-index-width);
  min-width: var(--editor-sticky-index-width);
  max-width: var(--editor-sticky-index-width);
  background: var(--color-surface);
}

.editor-table .editor-sticky-item {
  z-index: 3;
  left: var(--editor-sticky-index-width);
  background: var(--color-surface);
}

.editor-table .editor-sticky-qty {
  z-index: 3;
  left: calc(
    var(--editor-sticky-index-width) + var(--editor-sticky-item-width)
  );
  background: var(--color-surface);
}

.editor-table .editor-sticky-unit {
  z-index: 3;
  left: calc(
    var(--editor-sticky-index-width) + var(--editor-sticky-item-width) +
      var(--editor-sticky-qty-width)
  );
  background: var(--color-surface);
}

.editor-table thead .editor-sticky-column {
  z-index: 6;
  background: var(--color-surface-secondary);
}

.editor-table tbody tr:hover .editor-sticky-column {
  background: color-mix(
    in srgb,
    var(--color-surface-secondary) 56%,
    var(--color-surface)
  );
}

.editor-table .editor-input {
  height: 26px;
  padding-right: 6px;
  padding-left: 6px;
  font-size: 11px;
}

.editor-table .icon-button {
  width: 26px;
  height: 26px;
}

.editor-input {
  width: 100%;
  height: 34px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
}

.editor-input:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}

.editor-input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-focus);
  outline: 0;
}

.editor-input.is-manual {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
  background: var(--color-primary-soft);
}

.editor-input.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

[data-item-input][data-field="qty"],
[data-item-input][data-field="margin"],
[data-supporting-input][data-field="qty"] {
  appearance: textfield;
}

[data-item-input][data-field="qty"]::-webkit-inner-spin-button,
[data-item-input][data-field="qty"]::-webkit-outer-spin-button,
[data-item-input][data-field="margin"]::-webkit-inner-spin-button,
[data-item-input][data-field="margin"]::-webkit-outer-spin-button,
[data-supporting-input][data-field="qty"]::-webkit-inner-spin-button,
[data-supporting-input][data-field="qty"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calculated-cell {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  text-align: right;
  white-space: nowrap;
}

.editor-category-row td {
  height: 32px;
  padding: 0;
  background: var(--color-surface-secondary);
}

.editor-category-sticky {
  position: sticky;
  z-index: 3;
  left: 0;
  display: flex;
  width: var(
    --editor-sticky-boundary-width,
    calc(
      var(--editor-sticky-index-width) + var(--editor-sticky-item-width) +
        var(--editor-sticky-qty-width) + var(--editor-sticky-unit-width)
    )
  );
  height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 8px;
  background: var(--color-surface-secondary);
}

.editor-category-row strong {
  letter-spacing: 0.02em;
}

.category-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editor-table tbody tr.category-subtotal-row td {
  height: 32px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(
    in srgb,
    var(--color-surface-secondary) 55%,
    var(--color-surface)
  );
  color: var(--color-text-muted);
  font-weight: 650;
}

.category-subtotal-sticky {
  background: color-mix(
    in srgb,
    var(--color-surface-secondary) 55%,
    var(--color-surface)
  );
}

.editor-table tbody tr.category-subtotal-row:hover td,
.editor-table tbody .category-subtotal-row:hover .category-subtotal-sticky {
  background: color-mix(
    in srgb,
    var(--color-surface-secondary) 72%,
    var(--color-surface)
  );
}

.editor-table .category-subtotal-anchor {
  z-index: 4;
  overflow: visible;
  padding: 0;
}

.category-subtotal-sticky {
  position: absolute;
  z-index: 1;
  top: 1px;
  bottom: 1px;
  left: 0;
  display: flex;
  width: var(
    --editor-sticky-boundary-width,
    calc(
      var(--editor-sticky-index-width) + var(--editor-sticky-item-width) +
        var(--editor-sticky-qty-width) + var(--editor-sticky-unit-width)
    )
  );
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
}

[data-editor-view-mode="cogs"] .column-selling,
[data-editor-view-mode="selling"] .column-cogs,
[data-editor-view-mode="selling"] .column-margin {
  display: none;
}

[data-editor-view-mode="cogs"] .editor-table {
  --editor-table-min-width: 1128px;
}

[data-editor-view-mode="selling"] .editor-table {
  --editor-table-min-width: 1050px;
}

.drag-handle {
  display: none;
  color: var(--color-text-subtle);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.reorder-mode .drag-handle {
  display: inline-grid;
}

.drag-handle:active {
  cursor: grabbing;
}

.reorder-mode .item-order-cell {
  text-align: center;
}

.reorder-mode .editor-category-sticky {
  padding-left: 5px;
}

.reorder-mode .item-index {
  display: none;
}

.drag-in-progress .is-dragging {
  opacity: 0.38;
}

.editor-table tr.drop-before td {
  box-shadow: inset 0 2px var(--color-primary);
}

.editor-table tr.drop-after td {
  box-shadow: inset 0 -2px var(--color-primary);
}

.editor-table .editor-category-row.drop-before td,
.editor-table .editor-category-row.drop-after td {
  position: relative;
  box-shadow: none;
}

.editor-table .editor-category-row.drop-before td::after,
.editor-table .editor-category-row.drop-after td::after {
  position: absolute;
  z-index: 7;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--color-primary);
  content: "";
  pointer-events: none;
}

.editor-table .editor-category-row.drop-before td::after {
  top: 0;
}

.editor-table .editor-category-row.drop-after td::after {
  bottom: 0;
}

.supporting-materials-table tr.drop-before td {
  box-shadow: inset 0 2px var(--color-primary);
}

.supporting-materials-table tr.drop-after td {
  box-shadow: inset 0 -2px var(--color-primary);
}

.supporting-drag-handle {
  display: none;
  color: var(--color-text-subtle);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.supporting-reorder-mode .supporting-drag-handle {
  display: inline-grid;
}

.supporting-reorder-mode .item-order-cell {
  text-align: center;
}

.supporting-reorder-mode .supporting-index {
  display: none;
}

.supporting-drag-handle:active {
  cursor: grabbing;
}

.mobile-item-card.drop-before {
  box-shadow: inset 0 2px var(--color-primary);
}

.mobile-item-card.drop-after {
  box-shadow: inset 0 -2px var(--color-primary);
}

.mobile-category-section > header.drop-before {
  box-shadow: inset 0 2px var(--color-primary);
}

.mobile-category-section > header.drop-after {
  box-shadow: inset 0 -2px var(--color-primary);
}

.summary-card {
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.summary-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.summary-list {
  padding: 8px 16px 4px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.summary-row strong {
  color: var(--color-text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.summary-row dd {
  min-width: 108px;
}

.summary-row[hidden] {
  display: none;
}

.summary-input-wrap {
  display: grid;
  width: 108px;
  height: 34px;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  padding-left: 7px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-surface-secondary);
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.summary-input-wrap:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}

.summary-input-wrap:focus-within {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-focus);
}

.summary-input-currency {
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.summary-input-wrap .editor-input {
  height: 32px;
  padding-right: 7px;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.summary-input-wrap .editor-input:hover,
.summary-input-wrap .editor-input:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.summary-total {
  margin: 5px 0 0;
  padding: 15px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-primary-soft);
}

.summary-total > span {
  display: block;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary-total strong {
  display: block;
  margin-top: 5px;
  color: var(--color-text);
  font-size: 24px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.summary-meta {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-subtle);
  font-size: 11px;
}

.mobile-item-list {
  display: none;
}

.mobile-category-section > header {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 14px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-secondary);
  font-size: 11px;
}

.mobile-item-card {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.mobile-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.mobile-item-main {
  min-width: 0;
  flex: 1;
}

.mobile-item-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 14px 14px;
}

.mobile-item-total {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.mobile-item-total strong {
  width: 140px;
}

.menu-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  min-width: 184px;
  padding: 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-popover);
}

.dropdown-menu.dropdown-menu-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.dropdown-menu.dropdown-menu-floating {
  position: fixed;
  right: auto;
  bottom: auto;
  min-width: min(184px, calc(100vw - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu-item {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
  text-align: left;
}

.menu-item:hover {
  background: var(--color-surface-secondary);
}

.menu-item.danger-text {
  color: var(--color-danger);
}

.modal-backdrop {
  position: fixed;
  z-index: calc(100 + var(--modal-stack-depth, 0));
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 19, 26, 0.52);
  animation: fade-in 150ms ease;
}

html.modal-scroll-locked,
html.modal-scroll-locked body {
  overscroll-behavior: none;
}

.auth-pending .app-shell,
.auth-pending .mobile-save-bar {
  visibility: hidden;
}

.auth-screen {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--color-bg);
}

.auth-toolbar {
  position: absolute;
  top: 18px;
  right: 18px;
}

.auth-panel {
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.auth-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
  color: var(--color-text);
  font-size: 15px;
  font-weight: 700;
}

.auth-panel h1 {
  font-size: 21px;
}

.auth-panel p {
  margin-top: 5px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 104px;
}

.auth-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.auth-submit {
  width: 100%;
}

.auth-retry {
  width: 100%;
}

.auth-diagnostic {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-secondary);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.form-error {
  min-height: 16px;
  color: var(--color-danger);
  font-size: 11px;
}

.modal {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-modal);
  animation: modal-in 170ms ease;
}

.modal-lg {
  width: min(880px, 100%);
}

.modal-xl {
  width: min(1160px, 100%);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
}

.modal-header {
  border-bottom: 1px solid var(--color-border);
}

.modal-body {
  padding: 18px;
}

.notice {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: var(--color-surface-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.notice-warning {
  border-color: color-mix(in srgb, var(--color-warning) 38%, var(--color-border));
  color: var(--color-text);
}

.revision-list {
  display: grid;
  gap: var(--space-2);
}

.revision-compare {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.revision-compare-controls {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) auto;
  gap: var(--space-2);
  align-items: end;
}

.revision-compare-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.revision-change {
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-secondary);
}

.revision-change span,
.revision-change strong {
  display: block;
}

.revision-change span {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: 11px;
}

.revision-entry {
  display: grid;
  grid-template-areas:
    "main total"
    "actions actions";
  grid-template-columns: minmax(0, 1fr) minmax(148px, auto);
  column-gap: var(--space-4);
  row-gap: var(--space-3);
  align-items: start;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.revision-entry-main {
  grid-area: main;
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.revision-entry-heading,
.revision-entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.revision-entry-heading {
  flex-wrap: wrap;
}

.revision-entry-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.revision-entry-project {
  display: grid;
  min-width: 0;
}

.revision-entry-project > strong {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.revision-entry-total {
  grid-area: total;
  display: grid;
  gap: 3px;
  align-content: start;
  min-width: 148px;
  padding-left: var(--space-4);
  border-left: 1px solid var(--color-border);
  color: var(--color-text);
  text-align: right;
}

.revision-entry-total > strong {
  font-size: 13px;
  font-weight: 680;
}

.revision-entry-margin {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.revision-entry-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  flex-wrap: wrap;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.revision-entry-actions [data-void-revision] {
  margin-left: var(--space-2);
}

.revision-entry.is-voided {
  background: var(--color-surface-secondary);
}

.revision-entry.is-voided .revision-entry-heading > strong {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.editor-readonly .editor-table input,
.editor-readonly .editor-table select,
.editor-readonly .mobile-item-list input,
.editor-readonly .mobile-item-list select,
.items-readonly .editor-table input,
.items-readonly .editor-table select,
.items-readonly .mobile-item-list input,
.items-readonly .mobile-item-list select {
  color: var(--color-text);
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: var(--color-text);
}

.supporting-materials-panel.supporting-readonly input,
.supporting-materials-panel.supporting-readonly select {
  color: var(--color-text);
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: var(--color-text);
}

.editor-readonly .supporting-materials-panel:not(.supporting-readonly) input {
  cursor: text;
}

.editor-readonly .supporting-materials-panel:not(.supporting-readonly) select {
  cursor: pointer;
}

@media (max-width: 767px) {
  .revision-entry {
    grid-template-areas:
      "main"
      "total"
      "actions";
    grid-template-columns: 1fr;
  }

  .revision-compare-controls,
  .revision-compare-result {
    grid-template-columns: 1fr 1fr;
  }

  .revision-entry-actions {
    justify-content: flex-start;
  }

  .revision-entry-total {
    min-width: 0;
    padding-left: 0;
    border-left: 0;
    text-align: left;
  }

  .revision-entry-actions [data-void-revision] {
    margin-left: 0;
  }
}

.modal-footer {
  border-top: 1px solid var(--color-border);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

.toast-region {
  position: fixed;
  z-index: 150;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-popover);
  color: var(--color-text);
  font-size: 12px;
  animation: toast-in 180ms ease;
}

.toast.success .toast-symbol {
  color: var(--color-success);
}
.toast.error .toast-symbol {
  color: var(--color-danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.loading-skeleton {
  overflow: hidden;
  border-radius: var(--radius-xs);
  background: var(--color-surface-secondary);
}

.loading-skeleton::after {
  display: block;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--color-surface) 70%, transparent),
    transparent
  );
  content: "";
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(220%);
  }
}

.settings-nav {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  display: grid;
  gap: 3px;
}

.settings-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 560;
}

.settings-nav a:hover,
.settings-nav a[aria-current="true"] {
  background: var(--color-surface-secondary);
  color: var(--color-text);
}

.settings-section {
  scroll-margin-top: calc(var(--header-height) + 18px);
}

.settings-section + .settings-section {
  margin-top: 18px;
}

.logo-upload {
  display: flex;
  align-items: center;
  gap: 14px;
}

.company-logo {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-secondary);
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 800;
}

.company-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.settings-logo-upload {
  margin-bottom: 20px;
}

.settings-logo-upload input[type="file"] {
  padding: 3px 8px;
  line-height: 24px;
}

.settings-logo-upload input[type="file"]::file-selector-button {
  box-sizing: border-box;
  height: 24px;
  margin: 0 8px 0 0;
  vertical-align: top;
}

.logo-remove-button {
  justify-self: start;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row p {
  color: var(--color-text-muted);
  font-size: 11px;
}

.switch-row.is-disabled > div,
.switch-row.is-disabled .switch-track {
  opacity: 0.55;
}

.switch-row.is-disabled .switch {
  cursor: not-allowed;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface-secondary);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-text-subtle);
  content: "";
  transition:
    transform var(--transition-fast),
    background var(--transition-fast);
}

.switch input:checked + .switch-track {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.switch input:checked + .switch-track::after {
  background: #fff;
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--color-focus);
}

.record-card-list {
  display: none;
}

.record-card {
  padding: 15px;
  border-bottom: 1px solid var(--color-border);
}

.record-card:last-child {
  border-bottom: 0;
}

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

.record-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.record-card-grid dt {
  color: var(--color-text-subtle);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.record-card-grid dd {
  margin-top: 3px;
  color: var(--color-text);
  font-size: 12px;
}

.card-actions {
  margin-top: 14px;
}

.editor-kicker {
  margin-bottom: 7px;
}

.editor-page-header .page-header-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.editor-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.editor-header-customer,
.editor-header-meta [data-save-state] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-customer {
  color: var(--color-text);
  font-weight: 500;
}

.editor-header-meta [data-save-state] {
  flex: 0 0 auto;
  max-width: calc(100% - var(--space-2) * 2 - 1ch);
}

.editor-header-meta [data-editor-customer-separator] {
  flex: 0 0 auto;
}

.item-col-index {
  width: var(--editor-sticky-index-width, 36px);
}
.item-col-part-number {
  width: 112px;
}
.item-col-name {
  width: var(--editor-sticky-item-width, 300px);
}
.item-col-category {
  width: 130px;
}
.item-col-qty {
  width: var(--editor-sticky-qty-width, 68px);
}
.item-col-unit {
  width: var(--editor-sticky-unit-width, 82px);
}
.item-col-money {
  width: 116px;
}
.item-col-margin {
  width: 78px;
}
.item-col-actions {
  width: 42px;
}

.supporting-materials-table {
  min-width: 860px;
  font-size: 11px;
}

.supporting-materials-table-wrap {
  max-height: var(--editor-table-max-height, none);
  overscroll-behavior: contain;
}

.supporting-materials-table thead {
  position: sticky;
  z-index: 4;
  top: 0;
}

.supporting-materials-table td {
  height: 36px;
  padding: 2px 5px;
}

.supporting-materials-table th {
  height: 34px;
  padding: 0 6px;
}

.supporting-materials-table .editor-input {
  height: 26px;
  padding-right: 6px;
  padding-left: 6px;
  font-size: 11px;
}

.supporting-materials-table .icon-button {
  width: 26px;
  height: 26px;
}

.supporting-col-index {
  width: 44px;
}

.supporting-col-part-number {
  width: 132px;
}

.supporting-col-item {
  width: 280px;
}

.supporting-col-qty {
  width: 76px;
}

.supporting-col-unit {
  width: 100px;
}

.supporting-col-notes {
  width: 200px;
}

.supporting-col-actions {
  width: 42px;
}

.supporting-materials-mobile-list .mobile-item-main {
  display: grid;
  gap: 3px;
}

.supporting-materials-mobile-list .mobile-item-head {
  align-items: center;
}

.summary-actions {
  margin-top: 12px;
}

.editor-view-controls {
  margin-left: auto;
}

.catalog-list {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
}

.catalog-row:last-child {
  border-bottom: 0;
}

.catalog-row:hover {
  background: var(--color-surface-secondary);
}

.catalog-row > div > strong,
.catalog-row > div > span {
  display: block;
}

.catalog-row > div > span {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.catalog-product-name {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-empty {
  min-height: 180px;
}

.export-choice {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
}

.export-choice:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.export-choice strong {
  font-size: 12px;
}

.export-choice span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.pdf-company {
  display: block;
  margin-bottom: 3px;
  color: #2d6089;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.pdf-company-logo {
  display: block;
  width: auto;
  max-width: 144px;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.pdf-preview-logo-slot {
  display: flex;
  height: 70px;
  align-items: flex-start;
}

.pdf-preview-company p {
  margin: 0;
  color: #697582;
  font-size: 9px;
  line-height: 1.4;
}

.pdf-parties {
  display: grid;
  min-height: 74px;
  grid-template-columns: 24% 55% 21%;
  background: #f5f7f9;
}

.pdf-parties > div {
  min-width: 0;
  padding: 8px 9px;
}

.pdf-parties span,
.pdf-parties strong {
  display: block;
}

.pdf-parties span {
  margin-bottom: 3px;
  color: #697582;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.pdf-parties strong {
  color: #202832;
  font-size: 11px;
  line-height: 1.25;
}

.pdf-notes {
  margin-top: 28px;
  color: #697582;
}

.pdf-notes > strong {
  display: block;
  margin-bottom: 3px;
  color: #697582;
  font-size: 8px;
  text-transform: uppercase;
}

.pdf-notes p {
  min-height: 44px;
  margin: 0;
  padding: 8px;
  background: #f5f7f9;
  color: #697582;
  line-height: 1.45;
}

.pdf-footer {
  margin-top: 34px;
  padding-top: 7px;
  border-top: 1px solid #dce2e8;
  color: #8a96a2;
  font-size: 8px;
  text-align: center;
}

.mobile-save-bar {
  display: none;
}

.mobile-save-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-table {
  min-width: 540px;
}

.detail-table-wrap {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.product-usage-body {
  padding: 0;
}

.product-usage-modal .modal-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.product-usage-modal [data-product-usage-summary] {
  display: flex;
  min-width: 0;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

.product-usage-modal [data-product-usage-name] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-usage-modal [data-product-usage-stats] {
  flex: 0 0 auto;
  white-space: nowrap;
}

.product-usage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--color-border);
}

.product-usage-toolbar .search-field {
  flex: 1 1 360px;
}

.product-usage-table-wrap {
  max-height: min(480px, calc(100vh - 250px));
  margin-top: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  overscroll-behavior: contain;
}

.product-usage-table {
  min-width: 1370px;
}

.product-usage-table th {
  position: sticky;
  z-index: 1;
  top: 0;
}

.product-usage-table th:first-child,
.product-usage-table td:first-child {
  padding-left: 18px;
}

.product-usage-table th:last-child,
.product-usage-table td:last-child {
  padding-right: 18px;
}

.product-usage-table td:nth-child(2) {
  min-width: 190px;
}

.product-usage-table td:nth-child(3) {
  min-width: 150px;
}

.product-usage-table td:nth-child(7) {
  min-width: 132px;
}

.product-usage-cards {
  display: none;
}

.product-usage-empty {
  min-height: 260px;
}

.product-usage-card-context {
  display: grid;
  gap: 3px;
  margin-top: 12px;
}

.product-usage-card-context strong {
  color: var(--color-text);
  font-size: 12px;
}

.product-usage-card-context span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.related-records {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.related-records > strong {
  padding: 9px 11px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-secondary);
  font-size: 11px;
}

.related-records > a,
.related-records > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 11px;
}

.related-records > :last-child {
  border-bottom: 0;
}

.related-records > a:hover {
  background: var(--color-surface-secondary);
}

.related-records small {
  color: var(--color-text-muted);
}

.input-affix {
  position: relative;
}

.input-affix .input {
  padding-right: 30px;
}

.input-affix > span {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--color-text-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.document-footer-field,
.tax-fields {
  margin-top: 16px;
}

.appearance-field {
  max-width: 340px;
}

.data-management-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--color-border);
}

.data-management-row:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}

.data-management-row p {
  max-width: 620px;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.pdf-preview {
  padding: 34px;
  background: #fff;
  color: #202832;
  font-family: Arial, sans-serif;
  font-size: 11px;
}

.pdf-preview-content {
  width: 100%;
  min-height: 760px;
}

.pdf-preview-header {
  display: grid;
  min-height: 116px;
  margin-bottom: 8px;
  grid-template-columns: minmax(0, 1fr) 255px;
  gap: 30px;
}

.pdf-preview-document {
  text-align: right;
}

.pdf-preview-document h2 {
  margin: 0 0 7px;
  color: #2d6089;
  font-size: 18px;
  line-height: 1.15;
  text-transform: uppercase;
}

.pdf-preview-document > strong {
  display: block;
  margin-bottom: 11px;
  font-size: 12px;
}

.pdf-preview-document > span {
  display: block;
  color: #9a641c;
  font-size: 9px;
  font-weight: 700;
}

.pdf-preview-divider {
  height: 5px;
  background: #356f9e;
}

.pdf-preview-table {
  --pdf-no-width: 5.5%;
  --pdf-part-number-width: 14.2%;
  --pdf-item-width: 33.1%;
  --pdf-qty-width: 7.9%;
  --pdf-unit-width: 9.4%;
  --pdf-unit-price-width: 14.2%;
  --pdf-total-width: 15.7%;
  width: 100%;
  margin-top: 24px;
  border-collapse: collapse;
  table-layout: fixed;
}

.pdf-preview-table:not(.has-part-number) {
  --pdf-no-width: 6.4%;
  --pdf-item-width: 38.5%;
  --pdf-qty-width: 9.2%;
  --pdf-unit-width: 11%;
  --pdf-unit-price-width: 16.5%;
  --pdf-total-width: 18.4%;
}

.pdf-preview-table:not(.has-unit-price) {
  --pdf-no-width: 6.4%;
  --pdf-part-number-width: 16.5%;
  --pdf-item-width: 38.6%;
  --pdf-qty-width: 9.2%;
  --pdf-unit-width: 11%;
  --pdf-total-width: 18.3%;
}

.pdf-preview-table:not(.has-part-number):not(.has-unit-price) {
  --pdf-no-width: 7.5%;
  --pdf-item-width: 45.8%;
  --pdf-qty-width: 10.9%;
  --pdf-unit-width: 13.1%;
  --pdf-total-width: 22.7%;
}

.pdf-preview-table.without-pricing {
  --pdf-no-width: 7%;
  --pdf-part-number-width: 20%;
  --pdf-item-width: 50%;
  --pdf-qty-width: 10%;
  --pdf-unit-width: 13%;
}

.pdf-preview-table.without-pricing:not(.has-part-number) {
  --pdf-no-width: 8%;
  --pdf-item-width: 65%;
  --pdf-qty-width: 12%;
  --pdf-unit-width: 15%;
}

.pdf-preview-table th,
.pdf-preview-table td {
  height: 31px;
  padding: 6px 8px;
  border-bottom: 1px solid #dce2e8;
  text-align: left;
  vertical-align: middle;
}

.pdf-preview-table th {
  height: 34px;
  background: #356f9e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.pdf-preview-table .pdf-column-no {
  width: var(--pdf-no-width);
  text-align: center;
}

.pdf-preview-table .pdf-column-part-number {
  width: var(--pdf-part-number-width);
}

.pdf-preview-table .pdf-column-item {
  width: var(--pdf-item-width);
}

.pdf-preview-table .pdf-column-qty {
  width: var(--pdf-qty-width);
}

.pdf-preview-table .pdf-column-unit {
  width: var(--pdf-unit-width);
  text-align: center;
}

.pdf-preview-table .pdf-column-unit-price {
  width: var(--pdf-unit-price-width);
}

.pdf-preview-table .pdf-total-column {
  width: var(--pdf-total-width);
}

.pdf-preview-table .pdf-category td {
  height: 30px;
  background: #e9f1f7;
  color: #2d6089;
  text-align: left;
}

.pdf-preview-table .pdf-category strong {
  color: #2d6089;
}

.pdf-preview-table .pdf-empty-row td {
  height: 48px;
  background: #f5f7f9;
  color: #697582;
  text-align: left;
}

.pdf-preview-table tbody .align-right {
  text-align: right;
}

.pdf-preview-table thead th {
  text-align: center;
}

.pdf-preview-total {
  --pdf-summary-amount-width: 39.6%;
  display: grid;
  width: 39.3%;
  grid-template-columns:
    calc(100% - var(--pdf-summary-amount-width))
    var(--pdf-summary-amount-width);
  align-items: center;
  margin: 23px 0 0 auto;
  padding: 6px 0;
  border-top: 1px solid #dce2e8;
  border-bottom: 1px solid #dce2e8;
  background: #e9f1f7;
  color: #2d6089;
  font-size: 13px;
  font-weight: 700;
}

.pdf-preview-total > span {
  padding: 0 10px;
  text-align: center;
}

.pdf-preview-total > strong {
  padding: 0 8px;
  color: #2d6089;
  font-size: inherit;
}

.pdf-preview-totals {
  --pdf-summary-amount-width: 39.6%;
  width: 39.3%;
  margin: 23px 0 0 auto;
  border-top: 1px solid #dce2e8;
  border-bottom: 1px solid #dce2e8;
  background: #f5f7f9;
  color: #2d6089;
  font-size: 13px;
}

.pdf-preview-total-row {
  display: grid;
  grid-template-columns:
    calc(100% - var(--pdf-summary-amount-width))
    var(--pdf-summary-amount-width);
  align-items: center;
  min-height: 30px;
}

.pdf-preview-total-row + .pdf-preview-total-row {
  border-top: 1px solid #dce2e8;
}

.pdf-preview-total-row > span {
  padding: 0 10px;
  text-align: center;
}

.pdf-preview-total-row > strong {
  padding: 0 8px;
  color: inherit;
  font-size: inherit;
}

.pdf-preview-total-row.is-grand-total {
  background: #e9f1f7;
  font-weight: 700;
}

.pdf-preview-total > strong,
.pdf-preview-total-row.is-grand-total > strong {
  font-family: inherit;
  font-weight: inherit;
}

.pdf-preview-table:not(.has-part-number) + .pdf-preview-total,
.pdf-preview-table:not(.has-part-number) + .pdf-preview-totals {
  --pdf-summary-amount-width: 46.44%;
}

.pdf-preview-table:not(.has-unit-price) + .pdf-preview-total,
.pdf-preview-table:not(.has-unit-price) + .pdf-preview-totals {
  --pdf-summary-amount-width: 46.21%;
}

.pdf-preview-table:not(.has-part-number):not(.has-unit-price) +
  .pdf-preview-total,
.pdf-preview-table:not(.has-part-number):not(.has-unit-price) +
  .pdf-preview-totals {
  --pdf-summary-amount-width: 57.26%;
}

@media print {
  body * {
    visibility: hidden;
  }
  #print-document,
  #print-document * {
    visibility: visible;
  }
  #print-document {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0;
  }
  .modal-backdrop {
    position: static;
    padding: 0;
    background: transparent;
  }
  .modal {
    width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
  }
  .modal-header,
  .modal-footer {
    display: none;
  }
  .modal-body {
    padding: 0;
  }
}
