/* مخزن قطع الغيار — RTL */
:root {
  --color-primary: #1e3a5f;
  --color-primary-light: #2d5a8e;
  --color-primary-dark: #152a45;
  --color-accent: #e8a838;
  --color-bg: #f0f4f8;
  --color-surface: #ffffff;
  --color-text: #1a2332;
  --color-text-muted: #5a6a7e;
  --color-border: #d8e0ea;
  --color-error: #c0392b;
  --color-success: #27ae60;
  --shadow-sm: 0 1px 3px rgba(30, 58, 95, 0.08);
  --shadow-md: 0 4px 16px rgba(30, 58, 95, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', Tahoma, 'Arabic Typesetting', system-ui, sans-serif;
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 0.18s;
  --dur-normal: 0.35s;
  --app-header-height: 7.35rem;
  --inventory-chrome-height: 15rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: opacity var(--dur-fast) var(--ease-smooth);
}

body.is-navigating {
  opacity: 0.88;
  pointer-events: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-light);
}

/* Header */
.app-header {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-brand {
  min-width: 0;
}

.header-brand-link {
  display: block;
  color: #fff;
  text-decoration: none;
}

.header-brand-link:hover {
  color: #fff;
}

.header-brand-title {
  display: block;
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.35;
}

.header-brand-tagline {
  display: block;
  margin-top: 0.12rem;
  font-weight: 300;
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.92;
}

.header-user {
  text-align: start;
  min-width: 0;
}

.header-welcome {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
}

.header-welcome-name {
  font-weight: 600;
}

.header-datetime {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.88;
  line-height: 1.35;
}

.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}

.logo:hover {
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-quick-nav {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--color-primary-dark);
  position: relative;
  z-index: 2;
  overflow: visible;
}

.header-quick-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.38rem 1rem 0.48rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  overflow: visible;
}

.header-quick-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.32rem 0.62rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-quick-nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.header-quick-nav-link.is-active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.header-quick-nav-link--logout {
  margin-inline-start: auto;
  opacity: 0.92;
}

.header-quick-nav-link--logout:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-quick-nav-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.header-quick-nav-label {
  line-height: 1.2;
}

.header-quick-nav-dropdown {
  position: relative;
  flex-shrink: 0;
}

.header-quick-nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.header-quick-nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.header-quick-nav-link--dropdown {
  user-select: none;
}

.header-quick-nav-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: transform 0.15s ease;
}

.header-quick-nav-dropdown[open] .header-quick-nav-chevron {
  transform: rotate(180deg);
}

.header-quick-nav-menu {
  position: absolute;
  top: calc(100% + 0.28rem);
  inset-inline-end: 0;
  min-width: 12.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  z-index: 1200;
}

.header-quick-nav-menu-item {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.62rem;
  border-radius: 6px;
  color: var(--color-primary-dark);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-quick-nav-menu-item:hover {
  background: #eef2f7;
  color: var(--color-primary);
}

.header-quick-nav-menu-item.is-active {
  background: rgba(30, 58, 95, 0.1);
  color: var(--color-primary);
  font-weight: 700;
}

.header-quick-nav-menu-item .header-quick-nav-icon {
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  :root {
    --app-header-height: 6.85rem;
  }

  .header-brand-tagline {
    display: none;
  }

  .header-inner {
    padding-top: 0.5rem;
    padding-bottom: 0.45rem;
  }

  .header-quick-nav-label {
    font-size: 0.76rem;
  }

  .header-quick-nav-link {
    padding: 0.28rem 0.5rem;
  }
}

.user-name {
  font-size: 0.9rem;
  opacity: 0.95;
}

/* Sync status */
.sync-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa;
}

.sync-status--connected .sync-dot {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

.sync-status--connecting .sync-dot {
  background: var(--color-accent);
  animation: pulse 1.2s infinite;
}

.sync-status--error .sync-dot {
  background: var(--color-error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Buttons */
[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.main-content .btn-outline {
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.main-content .btn-outline:hover {
  background: var(--color-bg);
  color: var(--color-primary-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
  color: #fff;
}

.btn-icon {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.main-content .btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.main-content .btn-primary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  color: #fff;
}

/* Main layout */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  animation: content-enter var(--dur-normal) var(--ease-smooth) backwards;
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 1.75rem;
  animation: content-enter var(--dur-normal) var(--ease-smooth) 0.05s backwards;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@keyframes content-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* انتقال الصفحات (Chrome / Edge حديث) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: page-fade-out 0.22s var(--ease-smooth) forwards;
}

::view-transition-new(root) {
  animation: page-fade-in 0.38s var(--ease-smooth) forwards;
}

@keyframes page-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* شريط تقدم التنقل */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10000;
  background: rgba(30, 58, 95, 0.12);
  pointer-events: none;
}

.page-progress::after {
  content: '';
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-primary-light));
  transform: scaleX(0);
  transform-origin: right center;
  animation: nav-progress 0.65s var(--ease-smooth) forwards;
}

@keyframes nav-progress {
  to { transform: scaleX(0.92); }
}

/* طبقة انتظار الشبكة */
.network-wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: all;
  cursor: wait;
}

.network-wait-overlay[hidden] {
  display: none !important;
}

body.network-wait-active {
  overflow: hidden;
}

.network-wait-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  min-width: 9rem;
  padding: 1.35rem 1.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--color-border);
  box-shadow: 0 12px 40px rgba(30, 58, 95, 0.18);
}

.network-wait-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(30, 58, 95, 0.14);
  border-top-color: var(--color-primary, #1e3a5f);
  border-radius: 50%;
  animation: network-wait-spin 0.75s linear infinite;
}

.network-wait-message {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary-dark, #1e3a5f);
  text-align: center;
}

@keyframes network-wait-spin {
  to { transform: rotate(360deg); }
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  color: var(--color-primary-dark);
}

.page-header p {
  margin: 0;
  color: var(--color-text-muted);
}

@media (min-width: 600px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.page-note {
  margin: -0.5rem 0 1.25rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Flash banner */
.flash-banner {
  padding: 0.75rem 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  animation: content-enter 0.35s var(--ease-smooth);
}

.alert-success {
  background: #e8f8ef;
  color: #1e7e45;
  border-bottom: 1px solid #c3e6cb;
}

/* Tables */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

/* جداول القوائم (فواتير، مستخدمين…) */
.data-table--records {
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.data-table--records th,
.data-table--records td {
  padding: 0.34rem 0.5rem;
  text-align: center;
  line-height: 1.3;
}

.data-table--records th {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--color-primary-dark);
}

.data-table--records td {
  font-size: 0.82rem;
  color: var(--color-text);
}

.data-table--records tbody td {
  font-weight: 400;
}

.data-table--records .col-actions {
  text-align: center;
  width: 1%;
  white-space: nowrap;
}

.data-table--records .table-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
}

.data-table--records .table-action-group .inline-form {
  display: inline-flex;
  margin: 0;
}

.sales-list-filter {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.sales-list-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.sales-list-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 10rem;
}

.sales-list-filter-field--customer {
  flex: 1 1 12rem;
  min-width: 11rem;
  max-width: 18rem;
}

.sales-list-customer-filter {
  position: relative;
  width: 100%;
}

.sales-list-filter .customer-suggestions {
  z-index: 50;
  max-height: 12rem;
}

.sales-list-filter .customer-suggestion-item.is-keyboard-pick,
.sales-list-filter .customer-suggestion-item:hover {
  background: #eef4ff;
}

.sales-list-filter-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}

.sales-list-filter-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.sales-list-filter-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.sales-list-filter .sale-date-field {
  --sale-meta-control-h: 2.25rem;
}

.sales-list-filter .sale-date-field-picker {
  min-width: 9.25rem;
  max-width: 11.5rem;
  width: 100%;
}

.sales-list-filter-field .sale-date-field-control {
  width: 100%;
}

.sales-list-filter-field .sale-date-field-picker {
  max-width: none;
}

.sales-list-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sales-list-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem;
  margin: 0.65rem 0 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.sales-list-summary-stat {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 11rem;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #d5e3f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.06);
}

.sales-list-summary-stat--total {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf9 100%);
  border-color: #c7ebe3;
}

.sales-list-summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #eef4ff 0%, #e0ecfa 100%);
  color: var(--color-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.sales-list-summary-stat--total .sales-list-summary-icon {
  background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
  color: #0f766e;
}

.sales-list-summary-stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.sales-list-summary-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.sales-list-summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary-dark);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.sales-list-summary-stat--total .sales-list-summary-value {
  color: #0f766e;
}

@media (max-width: 520px) {
  .sales-list-summary-stat {
    flex: 1 1 100%;
  }
}

/* ── Sales invoices list — sticky header + filters + table head ── */
.sales-list-page {
  --records-list-chrome-height: 13.5rem;
  --sales-list-thead-gap: 0.55rem;
}

@media (max-width: 599px) {
  .sales-list-page {
    --records-list-chrome-height: 18.5rem;
  }
}

.sales-list-sticky-bar {
  position: sticky;
  top: var(--app-header-height, 4.75rem);
  z-index: 35;
  margin: 0 0 0.35rem;
  padding: 0.35rem 0 0.65rem;
  background: var(--color-bg);
  box-shadow: 0 8px 16px -12px rgba(15, 23, 42, 0.28);
  overflow: visible;
}

.sales-list-sticky-bar::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -0.65rem;
  height: 0.65rem;
  background: var(--color-bg);
  pointer-events: none;
}

.sales-list-page .records-list-chrome {
  position: static;
  z-index: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.sales-list-page .records-list-chrome .page-header {
  margin-bottom: 0.75rem;
}

.sales-list-page .records-list-chrome .sales-list-filter {
  margin-bottom: 0;
}

.sales-list-page .data-table--records .sales-list-col-returns {
  color: #b91c1c;
  font-weight: 600;
}

.sales-list-page .sales-list-table-wrap {
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (min-width: 769px) {
  .sales-list-page .data-table--records {
    border-collapse: separate;
    border-spacing: 0;
  }

  .sales-list-page .sales-list-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  .sales-list-page .data-table--records thead th {
    position: sticky;
    top: calc(
      var(--app-header-height, 4.75rem)
      + var(--records-list-chrome-height, 9.5rem)
      + var(--sales-list-thead-gap, 0.55rem)
    );
    z-index: 34;
    background: #eef2f7 !important;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  }

  .sales-list-page .data-table--records thead th::before {
    content: '';
    position: absolute;
    right: 0;
    left: 0;
    bottom: 100%;
    height: var(--sales-list-thead-gap, 0.55rem);
    background: var(--color-bg);
    pointer-events: none;
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row {
    transition: background 0.15s var(--ease-smooth);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--preliminary {
    background: rgba(254, 243, 199, 0.28);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--prep-required,
  .sales-list-page .data-table--records tbody tr.sales-list-row--re-prep {
    background: rgba(255, 237, 213, 0.32);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--in-prep {
    background: rgba(237, 233, 254, 0.32);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--prepared {
    background: rgba(219, 234, 254, 0.32);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--delivered {
    background: rgba(209, 250, 229, 0.28);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--cancelled {
    background: rgba(254, 226, 226, 0.28);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--preliminary:hover {
    background: rgba(254, 243, 199, 0.42);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--prep-required:hover,
  .sales-list-page .data-table--records tbody tr.sales-list-row--re-prep:hover {
    background: rgba(255, 237, 213, 0.46);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--in-prep:hover {
    background: rgba(237, 233, 254, 0.46);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--prepared:hover {
    background: rgba(219, 234, 254, 0.46);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--delivered:hover {
    background: rgba(209, 250, 229, 0.42);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--cancelled:hover {
    background: rgba(254, 226, 226, 0.42);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--draft {
    background: rgba(254, 243, 199, 0.28);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--posted {
    background: rgba(209, 250, 229, 0.28);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--draft:hover {
    background: rgba(254, 243, 199, 0.42);
  }

  .sales-list-page .data-table--records tbody tr.sales-list-row--posted:hover {
    background: rgba(209, 250, 229, 0.42);
  }
}

.data-table--records .col-datetime {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.table-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.72rem;
  height: 1.72rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  transition:
    background var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-smooth);
}

.table-action-btn:hover {
  background: #eef3f9;
  border-color: #b8c8dc;
  color: var(--color-primary-light);
}

.table-action-btn:active {
  transform: scale(0.96);
}

.table-action-btn--delete {
  color: var(--color-error);
}

.table-action-btn--delete:hover {
  background: #fdf0ee;
  border-color: #e8b4ae;
  color: #a93226;
}

.table-action-btn--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.table-action-btn--primary:hover {
  background: var(--color-primary-light, #1d4ed8);
  border-color: var(--color-primary-light, #1d4ed8);
  color: #fff;
}

.table-action-btn .ui-icon {
  display: block;
  flex-shrink: 0;
}

.data-table th {
  background: #f5f8fb;
  color: var(--color-primary-dark);
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.2s var(--ease-smooth);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 2rem 1rem !important;
}

.col-actions {
  white-space: nowrap;
  width: 1%;
}

/* جداول → بطاقات على الجوال (عام — ما عدا المخzون) */
@media (max-width: 768px) {
  .table-wrap:has(.data-table--mobile-cards) {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    padding: 0;
  }

  .data-table--mobile-cards {
    border-collapse: separate;
    border-spacing: 0;
  }

  .data-table--mobile-cards thead {
    display: none;
  }

  .data-table--mobile-cards tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .data-table--mobile-cards tbody tr {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.85rem 0.9rem;
    box-shadow: var(--shadow-sm);
  }

  .data-table--mobile-cards tbody tr:hover {
    background: var(--color-surface);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--preliminary {
    background: rgba(254, 243, 199, 0.35);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--prep-required,
  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--re-prep {
    background: rgba(255, 237, 213, 0.38);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--in-prep {
    background: rgba(237, 233, 254, 0.38);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--prepared {
    background: rgba(219, 234, 254, 0.38);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--delivered {
    background: rgba(209, 250, 229, 0.35);
  }

  .sales-list-page .data-table--mobile-cards tbody tr.sales-list-row--cancelled {
    background: rgba(254, 226, 226, 0.35);
  }

  .data-table--mobile-cards tbody tr:last-child td {
    border-bottom: none;
  }

  .data-table--mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.38rem 0;
    border: none;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  .data-table--mobile-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    text-align: right;
  }

  .data-table--mobile-cards td.table-empty {
    display: block;
    text-align: center;
    padding: 2rem 1rem !important;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
  }

  .data-table--mobile-cards td.table-empty::before {
    display: none;
  }

  .data-table--mobile-cards td.col-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #e8edf2;
    margin-top: 0.45rem;
    padding-top: 0.65rem;
    white-space: normal;
    width: 100%;
  }

  .data-table--mobile-cards td.col-actions::before {
    width: 100%;
    margin-bottom: 0.35rem;
  }
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.row-warning {
  background: #fff9e6;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-ok {
  background: #e8f8ef;
  color: #1e7e45;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-muted {
  background: #eef1f5;
  color: var(--color-text-muted);
}

/* Modal CRUD */
.crud-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-md);
  animation: modal-in 0.3s var(--ease-smooth);
}

.crud-modal::backdrop {
  background: rgba(21, 42, 69, 0.45);
  backdrop-filter: blur(2px);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.crud-form {
  padding: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--color-primary-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  padding: 1.25rem;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.searchable-select {
  position: relative;
}

.searchable-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.searchable-select-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.searchable-select-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.searchable-select-list {
  z-index: 60;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
}

.form-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
}

.user-treasury-access-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: #fafbfd;
}

.user-treasury-access-head .form-field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.user-treasury-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.35rem 0.75rem;
}

.user-treasury-checkbox {
  margin: 0;
  font-size: 0.9rem;
}

.user-treasury-default-label {
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
  background: #fafbfd;
}

.crud-modal .modal-footer .btn-outline {
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.crud-modal .modal-footer .btn-outline:hover {
  background: var(--color-bg);
  color: var(--color-primary-light);
}

#modal-customer,
#modal-supplier,
#modal-quick-customer {
  max-width: 560px;
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.55rem 0.65rem;
  }

  .data-table--records th,
  .data-table--records td {
    padding: 0.3rem 0.4rem;
  }

  .table-action-btn {
    width: 1.6rem;
    height: 1.6rem;
  }
}

/* Nav grid */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.28s var(--ease-smooth),
    box-shadow 0.28s var(--ease-smooth),
    border-color 0.28s var(--ease-smooth),
    background 0.28s var(--ease-smooth);
  color: var(--color-text);
  animation: content-enter 0.45s var(--ease-smooth) backwards;
}

.nav-grid .nav-card:nth-child(1) { animation-delay: 0.04s; }
.nav-grid .nav-card:nth-child(2) { animation-delay: 0.08s; }
.nav-grid .nav-card:nth-child(3) { animation-delay: 0.12s; }
.nav-grid .nav-card:nth-child(4) { animation-delay: 0.16s; }
.nav-grid .nav-card:nth-child(5) { animation-delay: 0.2s; }

.nav-card:active {
  transform: scale(0.98);
}

.nav-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
  color: var(--color-text);
}

.nav-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.nav-card-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary-dark);
}

.nav-card-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Placeholder */
.placeholder-card {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  animation: content-enter 0.5s var(--ease-smooth) 0.08s backwards;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.placeholder-card h2 {
  margin: 0 0 0.5rem;
  color: var(--color-primary);
}

.placeholder-card p {
  margin: 0.25rem 0;
  color: var(--color-text-muted);
}

.placeholder-hint {
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.75rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.login-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: var(--color-primary-dark);
}

.login-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.login-tagline {
  margin: 0 0 0.65rem !important;
  font-weight: 300;
  font-size: 0.88rem !important;
  color: var(--color-text-muted);
}

.login-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.login-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  transition: border-color 0.15s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fdecea;
  color: var(--color-error);
  border: 1px solid #f5c6cb;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: 0.85rem 1.1rem;
  background: var(--color-primary-dark);
  color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}

.toast--fade {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* سجل الاتصال */
.connection-log-dialog {
  border: none;
  border-radius: var(--radius-lg, 12px);
  padding: 0;
  max-width: min(520px, 96vw);
  width: 100%;
  background: transparent;
}

.connection-log-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.connection-log-panel {
  background: var(--color-surface, #fff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.connection-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-primary, #1e3a5f);
  color: #fff;
}

.connection-log-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.connection-log-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.connection-log-stats {
  padding: 0.75rem 1.25rem;
  background: #f4f7fb;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  font-size: 0.85rem;
}

.connection-log-stats p {
  margin: 0.25rem 0;
}

.log-stat-ok { color: var(--color-success, #27ae60); }
.log-stat-warn { color: #d68910; }
.log-stat-error { color: var(--color-error, #c0392b); }

.connection-log-body {
  max-height: 50vh;
  overflow: auto;
  padding: 0.5rem 0;
}

.connection-log-empty {
  padding: 1rem 1.25rem;
  color: #64748b;
}

.connection-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.connection-log-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  align-items: start;
}

.connection-log-item time {
  color: #64748b;
  white-space: nowrap;
}

.connection-log-level {
  font-weight: 600;
  white-space: nowrap;
}

.connection-log-item--ok .connection-log-level { color: var(--color-success, #27ae60); }
.connection-log-item--warn .connection-log-level { color: #d68910; }
.connection-log-item--error .connection-log-level { color: var(--color-error, #c0392b); }
.connection-log-item--info .connection-log-level { color: #3b82f6; }

.connection-log-msg {
  grid-column: 1 / -1;
}

.connection-log-detail {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: #94a3b8;
  word-break: break-all;
}

.connection-log-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
  background: #fafbfc;
}

#connection-log-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
}

/* الإشعارات */
.notifications-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.notify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  border-radius: 999px;
}

.page-subtitle {
  margin: -0.25rem 0 1.25rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.notif-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.notif-card--unread {
  border-color: var(--color-primary-light);
  background: #f8fbff;
}

.notif-card--read {
  opacity: 0.88;
}

.notif-card-message {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.notif-card-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.notif-card-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.form-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.table-wrap--wide {
  overflow-x: auto;
}

.inventory-table-wrap {
  overflow: auto;
  max-height: calc(100dvh - var(--inventory-chrome-height));
  -webkit-overflow-scrolling: touch;
}

.data-table--compact th,
.data-table--compact td {
  font-size: 0.88rem;
  padding: 0.5rem 0.45rem;
}

.crud-modal--wide {
  max-width: 640px;
}

.purchase-expense-link-dialog {
  max-width: min(1100px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
}

.purchase-expense-link-body {
  padding-inline: 1.15rem;
}

.purchase-expense-link-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-bottom: 0.65rem;
  font-size: 0.92rem;
}

.purchase-expense-link-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem 1.35rem;
  align-items: stretch;
  margin-block: 0.35rem 0.5rem;
}

.purchase-expense-link-col {
  min-width: 0;
  padding: 0.55rem 0.75rem 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  background: rgba(248, 250, 252, 0.65);
}

.purchase-expense-link-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.purchase-expense-link-table-wrap {
  max-height: min(340px, 42vh);
  overflow: auto;
  margin-inline: 0.15rem;
}

.purchase-expense-link-table th,
.purchase-expense-link-table td {
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
  line-height: 1.2;
  vertical-align: middle;
}

.purchase-expense-link-table .col-check {
  width: 1.6rem;
  text-align: center;
}

.purchase-expense-link-row--disabled {
  opacity: 0.55;
}

.purchase-expense-link-row--selected {
  background: rgba(30, 58, 95, 0.06);
}

.purchase-expense-link-source-badge {
  display: inline-block;
  margin-inline-start: 0.25rem;
  padding: 0.02rem 0.28rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #9a3412;
  background: #ffedd5;
  vertical-align: middle;
}

.purchase-expense-link-amount {
  width: 5.5rem;
  max-width: 100%;
  height: 1.45rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.78rem;
  text-align: left;
}

.purchase-expense-link-table .btn-sm {
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
  min-height: 1.4rem;
}

.purchase-expense-link-dialog .form-success {
  margin: 0.45rem 0 0;
  color: #166534;
  font-size: 0.88rem;
}

.purchase-expense-links-panel {
  margin-top: 0;
}

.purchase-expense-links-panel-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.82rem;
  color: #64748b;
}

.purchase-expense-links-panel-summary strong {
  color: #0f172a;
}

.purchase-expense-links-panel-hint {
  margin: 0 0 0.45rem;
  padding: 0.15rem 0.55rem 0;
}

.purchase-expense-links-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.purchase-expense-link-table-wrap--inline {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.purchase-expense-link-table--inline {
  margin: 0;
}

.treasury-supplier-registers-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  min-width: 0;
}

.treasury-supplier-registers-col .treasury-receipt-panel--history {
  flex: 1 1 auto;
  min-height: 0;
}

.treasury-supplier-registers-col .treasury-receipt-history-body {
  max-height: 240px;
}

@media (max-width: 900px) {
  .purchase-expense-link-columns {
    grid-template-columns: 1fr;
  }

  .treasury-supplier-registers-col .treasury-receipt-history-body {
    max-height: 220px;
  }
}

.invoice-quick-item-dialog {
  max-width: min(920px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
  overflow-x: hidden;
}

.crud-modal--kardex {
  max-width: min(960px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
}

.sale-line-kardex-body {
  padding: 0.75rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

.sale-line-kardex-meta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.sale-line-kardex-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

.sale-line-kardex-customer-filter {
  flex: 1 1 12rem;
  max-width: 18rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sale-line-kardex-filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-line-kardex-customer-picker {
  position: relative;
}

.sale-line-kardex-table-wrap {
  max-height: min(52vh, 420px);
  overflow: auto;
  margin: 0;
  box-shadow: none;
}

.sale-line-kardex-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex: 1;
  text-align: start;
}

.crud-modal--kardex .modal-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.col-kardex-balance-current {
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #14532d;
  background: color-mix(in srgb, #22c55e 18%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #16a34a 35%, transparent);
}

.settings-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-section-header h2,
.settings-section-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.settings-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.settings-nav-link:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.settings-nav-link.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ——— سجل تعديلات النظام ——— */
.system-changelog-page .system-changelog-intro {
  margin: 0 0 1rem;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.system-changelog-count {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text);
}

.system-changelog-filters {
  margin-bottom: 1rem;
}

.changelog-table .col-changelog-date {
  width: 7.5rem;
  white-space: nowrap;
}

.changelog-table .col-changelog-type {
  width: 8.5rem;
}

.changelog-table .col-changelog-title {
  min-width: 12rem;
}

.changelog-table .col-changelog-desc {
  min-width: 16rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.changelog-type-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.changelog-type-badge--development {
  background: #dbeafe;
  color: #1e40af;
}

.changelog-type-badge--bugfix {
  background: #ffedd5;
  color: #c2410c;
}

.changelog-type-badge--other {
  background: #f3f4f6;
  color: #4b5563;
}

.settings-group {
  margin-bottom: 2rem;
}

.settings-group-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--color-primary);
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--color-border);
}

.settings-app-desc {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.settings-app-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.settings-sync-status.sync-status {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  cursor: pointer;
}

.settings-notifications-link {
  position: relative;
}

.settings-notify-badge {
  background: var(--color-error);
  color: #fff;
}

.settings-shortcuts-panel {
  margin-top: 1rem;
}

.settings-shortcut-unique-note {
  margin: 0.55rem 0 0;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.86rem;
  line-height: 1.45;
}

.settings-shortcut-unique-note--error {
  border: 1px solid #fdba74;
}

.settings-shortcut-input--released {
  border-color: #f97316;
  background: #fff7ed;
}

.settings-shortcuts-intro {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.settings-shortcuts-overview-wrap {
  margin-bottom: 1rem;
}

.settings-shortcut-form {
  display: grid;
  gap: 0.75rem;
}

.settings-shortcuts-overview kbd.settings-shortcut-kbd {
  display: inline-block;
  min-width: 2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.82rem;
  font-family: inherit;
  text-align: center;
}

.settings-shortcut-scope {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.settings-shortcut-field {
  display: grid;
  gap: 0.35rem;
}

.settings-shortcut-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.settings-shortcut-input {
  max-width: 16rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.04em;
}

.settings-shortcut-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 25%, transparent);
}

.settings-shortcut-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.settings-shortcut-current kbd,
.sale-action-kbd {
  display: inline-block;
  margin-inline: 0.15rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.78rem;
  font-family: inherit;
  line-height: 1.4;
  vertical-align: middle;
}

.sale-new-invoice-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sale-action-kbd {
  opacity: 0.85;
  font-weight: 600;
}

.settings-shortcut-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-panels {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-panel-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: right;
  font: inherit;
  color: var(--color-text);
}

.settings-panel-toggle:hover {
  background: var(--color-bg);
}

.settings-panel-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary);
  flex: 1;
}

.settings-panel-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.settings-panel-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-left: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.settings-panel.is-open .settings-panel-chevron {
  transform: rotate(135deg);
}

.settings-panel-body {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-panel-body[hidden] {
  display: none !important;
}

.invoice-editor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.invoice-header-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.invoice-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.invoice-search-results {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.invoice-search-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  text-align: right;
  cursor: pointer;
  font: inherit;
}

.invoice-search-item:hover {
  background: var(--color-bg);
}

.invoice-search-item:last-child {
  border-bottom: none;
}

.invoice-lines-table input,
.invoice-lines-table select {
  width: 100%;
  min-width: 0;
}

.invoice-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge--draft {
  background: #fef3c7;
  color: #92400e;
}

.status-badge--posted {
  background: #d1fae5;
  color: #065f46;
}

.status-badge--cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge--sale-preliminary {
  background: #fef3c7;
  color: #92400e;
}

.status-badge--sale-prep-required,
.status-badge--sale-re-prep {
  background: #ffedd5;
  color: #c2410c;
}

.status-badge--sale-in-prep {
  background: #ede9fe;
  color: #6d28d9;
}

.status-badge--sale-prepared {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge--sale-delivered {
  background: #d1fae5;
  color: #065f46;
}

.status-badge--sale-qty-adjust {
  background: #fff7ed;
  color: #9a3412;
}

.status-badge--sale-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge--sale-receipt-pending {
  background: #fef3c7;
  color: #92400e;
  margin-inline-start: 0.35rem;
}

.status-badge--sale-whatsapp-pending {
  background: #dcfce7;
  color: #166534;
  margin-inline-start: 0.35rem;
}

.status-badge--sale-whatsapp-sent {
  background: #dcfce7;
  color: #166534;
  margin-inline-start: 0.35rem;
}

.sales-list-status-badges .status-badge--sale-whatsapp-pending {
  margin-inline-start: 0;
}

.sales-list-status-badges .status-badge--sale-whatsapp-sent {
  margin-inline-start: 0;
}

.sales-list-status-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.sales-list-status-badges .status-badge--sale-receipt-pending {
  margin-inline-start: 0;
}

a.status-badge--sale-receipt-link {
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

a.status-badge--sale-receipt-link:hover,
a.status-badge--sale-receipt-link:focus-visible {
  background: #fde68a;
  color: #78350f;
  outline: 2px solid #f59e0b;
  outline-offset: 1px;
}

.sales-list-status-suffix {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  white-space: normal;
}

@media (max-width: 768px) {
  .sales-list-page .data-table--mobile-cards td.sales-list-status-cell {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .sales-list-page .data-table--mobile-cards .sales-list-status-badges {
    justify-content: flex-end;
    max-width: 100%;
  }
}

.sale-invoice-tab--attention {
  color: #b45309;
  font-weight: 600;
}

.sale-invoice-tab--attention.is-active {
  border-color: #f59e0b;
  color: #92400e;
}

.sale-invoice-subpage--receipt {
  flex: 1;
  min-height: 0;
  padding: 0.15rem 0.25rem 0;
  gap: 0.85rem;
}

.sale-receipt-page-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 56rem;
  margin-inline: auto;
}

.sale-receipt-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.sale-receipt-driver-view-text {
  margin: 0.65rem 0 0;
  font-size: 0.92rem;
  color: #334155;
}

.sale-receipt-driver-view-label {
  color: #64748b;
  margin-inline-end: 0.35rem;
}

.sale-receipt-notice-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
}

.sale-receipt-notice-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #78350f;
}

.sale-receipt-notice-text strong {
  color: #92400e;
}

.sale-receipt-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: stretch;
}

@media (min-width: 860px) {
  .sale-receipt-options {
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: stretch;
  }

  .sale-receipt-choice-divider {
    flex-direction: column;
    margin: 1.5rem 0.65rem;
    min-width: 2rem;
  }

  .sale-receipt-choice-divider::before,
  .sale-receipt-choice-divider::after {
    width: 1px;
    height: auto;
    flex: 1;
  }

  .sale-receipt-choice-divider span {
    padding: 0.35rem 0;
  }
}

.sale-receipt-option-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.sale-receipt-option-card--upload {
  border-top: 3px solid var(--color-primary, #2563eb);
}

.sale-receipt-option-card--recipient {
  border-top: 3px solid #64748b;
}

.sale-receipt-option-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sale-receipt-option-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 800;
}

.sale-receipt-option-card--upload .sale-receipt-option-num {
  background: #dbeafe;
  color: var(--color-primary-dark, #1e40af);
}

.sale-receipt-option-head-text {
  flex: 1;
  min-width: 0;
}

.sale-receipt-option-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.45;
}

.sale-receipt-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.sale-receipt-upload-lead {
  margin: 0 0 1rem;
  color: var(--text-muted, #64748b);
  line-height: 1.6;
}

.sale-receipt-choice-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
}

.sale-receipt-choice-divider::before,
.sale-receipt-choice-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.sale-receipt-recipient-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.sale-receipt-recipient-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
}

.sale-receipt-recipient-input {
  width: 100%;
  min-height: 2.65rem;
  font-size: 0.95rem;
}

.sale-receipt-recipient-error {
  margin: 0;
  color: #b91c1c;
  font-weight: 500;
  font-size: 0.85rem;
}

.sale-receipt-actions {
  display: flex;
  justify-content: stretch;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid #f1f5f9;
}

.sale-receipt-upload-btn,
.sale-receipt-recipient-btn {
  width: 100%;
  min-height: 2.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.sale-receipt-recipient-view-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 56rem;
  margin-inline: auto;
  padding: 1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.sale-receipt-recipient-view-text {
  margin: 0;
  font-size: 1rem;
  color: #334155;
}

.sale-receipt-recipient-view-sep {
  color: #94a3b8;
  margin-inline: 0.2rem;
}

.sale-receipt-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.sale-receipt-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex: 1;
  min-height: 11rem;
  padding: 1.35rem 1rem;
  border: 2px dashed #cbd5e1;
  border-radius: 0.65rem;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.sale-receipt-dropzone:hover,
.sale-receipt-dropzone:focus-visible {
  border-color: #94a3b8;
  background: #f1f5f9;
  outline: none;
}

.sale-receipt-dropzone.is-dragover {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.sale-receipt-dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  line-height: 1;
}

.sale-receipt-dropzone-icon svg {
  display: block;
}

.sale-receipt-dropzone.is-dragover .sale-receipt-dropzone-icon {
  background: #fde68a;
  color: #92400e;
}

.sale-receipt-dropzone-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: #334155;
}

.sale-receipt-dropzone-sub {
  display: none;
}

.sale-receipt-dropzone-hint {
  margin: 0.35rem 0 0;
  color: #94a3b8;
  font-size: 0.82rem;
  line-height: 1.5;
}

.sale-receipt-browse-btn {
  pointer-events: auto;
}

.sale-receipt-file-input {
  display: none;
}

.sale-receipt-preview-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fff;
}

.sale-receipt-preview-wrap.is-saved {
  border-color: #86efac;
  background: #f0fdf4;
}

.sale-receipt-preview-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.sale-receipt-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.sale-receipt-preview-rotate {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sale-receipt-preview-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.sale-receipt-crop-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sale-receipt-rotate-btn,
.sale-receipt-crop-btn {
  min-width: 2.35rem;
  padding-inline: 0.55rem;
  font-size: 1rem;
  line-height: 1;
}

.sale-receipt-preview-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 8rem;
  padding: 0.35rem;
  border-radius: 0.35rem;
  background: #f8fafc;
}

.sale-receipt-preview-wrap.is-cropping .sale-receipt-preview-img {
  transition: none;
}

.sale-receipt-crop-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  user-select: none;
}

.sale-receipt-crop-shade {
  position: absolute;
  background: rgba(15, 23, 42, 0.55);
  pointer-events: none;
}

.sale-receipt-crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #fff;
  outline: 1px solid rgba(37, 99, 235, 0.85);
  cursor: move;
}

.sale-receipt-crop-handle {
  position: absolute;
  width: 0.72rem;
  height: 0.72rem;
  border: 2px solid #2563eb;
  border-radius: 999px;
  background: #fff;
  box-sizing: border-box;
}

.sale-receipt-crop-handle[data-crop-handle='nw'] { top: -0.45rem; left: -0.45rem; cursor: nwse-resize; }
.sale-receipt-crop-handle[data-crop-handle='ne'] { top: -0.45rem; right: -0.45rem; cursor: nesw-resize; }
.sale-receipt-crop-handle[data-crop-handle='sw'] { bottom: -0.45rem; left: -0.45rem; cursor: nesw-resize; }
.sale-receipt-crop-handle[data-crop-handle='se'] { bottom: -0.45rem; right: -0.45rem; cursor: nwse-resize; }
.sale-receipt-crop-handle[data-crop-handle='n'] { top: -0.45rem; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sale-receipt-crop-handle[data-crop-handle='s'] { bottom: -0.45rem; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sale-receipt-crop-handle[data-crop-handle='e'] { top: 50%; right: -0.45rem; transform: translateY(-50%); cursor: ew-resize; }
.sale-receipt-crop-handle[data-crop-handle='w'] { top: 50%; left: -0.45rem; transform: translateY(-50%); cursor: ew-resize; }

.sale-receipt-preview-wrap.is-saved .sale-receipt-preview-title {
  color: #166534;
}

.sale-receipt-preview-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 24rem;
  margin: 0 auto;
  border-radius: 0.35rem;
  object-fit: contain;
  background: transparent;
  transition: transform 0.2s ease;
  transform-origin: center center;
}

.sale-receipt-preview-img:not([src]),
.sale-receipt-preview-img[src=''] {
  display: none;
}

.sale-receipt-preview-note {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.sale-receipt-upload-success {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.45rem;
  background: #ecfdf5;
  color: #166534;
  font-weight: 600;
}

.sale-receipt-preview-file {
  margin: 0;
  font-weight: 500;
}

.sale-receipt-upload-error {
  margin: 0;
  color: #b91c1c;
  font-weight: 500;
  font-size: 0.85rem;
}

.sale-receipt-view-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 56rem;
  margin-inline: auto;
  padding: 1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.sale-receipt-view-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
}

.sale-receipt-view-figure {
  margin: 0;
}

.sale-receipt-view-image {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 32rem);
  margin: 0 auto;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
}

.sale-receipt-view-frame-wrap {
  width: 100%;
  height: min(42vh, 20rem);
  max-height: min(42vh, 20rem);
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f8fafc;
}

.sale-receipt-view-pdf {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(42vh, 20rem);
  border: 0;
}

.sale-receipt-view-actions {
  margin: 0;
}

.sale-receipt-view-meta {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.sale-receipt-view-meta dt {
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}

.sale-receipt-view-meta dd {
  margin: 0;
  font-weight: 500;
}

@media (max-width: 640px) {
  .sale-receipt-page-body {
    max-width: none;
  }

  .sale-receipt-option-card {
    padding: 0.9rem;
  }

  .sale-receipt-dropzone {
    min-height: 9.5rem;
    padding: 1.1rem 0.85rem;
  }
}

/* ── Sale invoice page — split viewport (desktop) ── */
.sale-invoice-page {
  --sale-page-chrome: calc(var(--app-header-height, 4.75rem) + 5.5rem);
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  height: calc(100dvh - var(--app-header-height, 4.75rem));
  margin: 0;
  padding: 0.65rem 1rem 0.75rem;
  overflow: hidden;
  box-sizing: border-box;
}

.sale-invoice-page-chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  margin-bottom: 0.55rem;
  background: var(--color-surface, #fff);
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  overflow: visible;
}

.sale-invoice-command-bar {
  flex-shrink: 0;
  margin-bottom: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  position: static;
  top: auto;
  z-index: auto;
}

.sale-invoice-command-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.sale-invoice-command-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}

.sale-invoice-command-identity h1 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-primary-dark);
  line-height: 1.35;
}

.sale-invoice-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.sale-invoice-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
  color: var(--color-primary-dark);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

a.sale-invoice-nav-btn:hover {
  background: #f1f5f9;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.sale-invoice-nav-btn.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.sale-invoice-command-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-width: 0;
  direction: ltr;
}

.sale-invoice-actions-form {
  display: contents;
}

.sale-invoice-action-buttons {
  display: contents;
}

.sale-invoice-action-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  width: 0;
  min-width: 4.5rem;
  max-width: 6.25rem;
  min-height: 1.65rem;
  padding: 0.18rem 0.28rem;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.sale-invoice-command-actions .btn-sm.sale-invoice-action-btn {
  padding: 0.18rem 0.28rem;
  font-size: 0.72rem;
}

.sale-invoice-command-actions .sale-new-invoice-btn {
  flex-direction: row;
  gap: 0.22rem;
}

.sale-invoice-command-actions .sale-action-kbd {
  margin-inline: 0;
  padding: 0.04rem 0.28rem;
  font-size: 0.6rem;
  line-height: 1.1;
}

.sale-invoice-command-actions .btn-primary.sale-invoice-action-btn {
  box-shadow: 0 2px 6px rgba(30, 58, 95, 0.22);
}

.sale-invoice-command-actions .btn-danger.sale-invoice-action-btn {
  box-shadow: 0 2px 6px rgba(153, 27, 27, 0.18);
}

.sale-invoice-action-btn--whatsapp {
  gap: 0.25rem;
  background: #25d366;
  border-color: #128c7e;
  color: #fff;
}

.sale-invoice-action-btn--whatsapp:hover:not(:disabled) {
  background: #1ebe57;
  border-color: #0f7a6c;
  color: #fff;
}

.sale-invoice-action-btn--whatsapp .ui-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

.sale-invoice-action-btn--whatsapp.is-busy {
  opacity: 0.7;
  cursor: wait;
}

.sale-invoice-toolbar-slot {
  display: none;
}

@media (max-width: 719px) {
  .sale-invoice-command-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sale-invoice-command-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.28rem;
    justify-content: stretch;
  }

  .sale-invoice-command-actions .sale-invoice-action-btn {
    flex: none;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .sale-invoice-context-bar {
    display: block;
  }

  .sale-invoice-context-bar--split {
    display: block;
  }

  .sale-invoice-context-nav {
    width: 100%;
    padding-inline: 0.65rem;
  }

  .sale-invoice-context-bar--split .sale-invoice-context-nav,
  .sale-invoice-context-bar--split .sale-invoice-context-meta {
    grid-column: auto;
  }

  .sale-invoice-context-meta {
    flex-wrap: nowrap;
    width: 100%;
    margin-inline-start: 0;
    padding: 0.22rem 0.65rem 0.24rem;
    border-inline-start: none;
    border-top: 1px solid #d5e3f0;
    overflow: visible;
  }

  .sale-invoice-context-meta .sale-meta-compact-item--customer {
    flex: 1 1 auto;
    width: auto;
    min-width: 5.5rem;
    max-width: 10rem;
  }
}

.sale-invoice-context-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
  overflow: visible;
}

.sale-invoice-context-bar--split {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
}

.sale-invoice-context-bar--split .sale-invoice-context-nav {
  flex: 0 0 auto;
  min-width: 0;
}

.sale-invoice-context-bar--split .sale-invoice-context-meta {
  flex: 1 1 auto;
  margin-inline-start: 0;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
}

.sale-invoice-page--lines-full .sale-invoice-context-meta {
  flex: 1 1 auto;
  width: 100%;
  margin-inline-start: 0;
}

.sale-invoice-context-bar--split .sale-invoice-context-meta .sale-meta-compact-item--customer {
  flex: 1 1 auto;
  width: auto;
  max-width: 11rem;
  min-width: 5.5rem;
}

.sale-invoice-context-nav {
  flex-shrink: 0;
  padding-inline: 0.85rem;
}

.sale-invoice-context-meta {
  --sale-meta-control-h: 1.72rem;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.38rem 0.55rem;
  min-width: 0;
  margin-inline-start: auto;
  padding: 0.22rem 0.7rem 0.24rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%);
  border-inline-start: 1px solid #d5e3f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: visible;
}

.sale-invoice-context-meta--compact {
  flex-wrap: nowrap;
}

.sale-invoice-context-meta .sale-meta-compact-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.08rem;
  min-width: 0;
  flex-shrink: 1;
}

.sale-invoice-context-meta .sale-meta-compact-item--date,
.sale-invoice-context-meta .sale-meta-compact-item--price,
.sale-invoice-context-meta .sale-meta-compact-item--customer-readonly {
  flex-shrink: 0;
}

.sale-invoice-context-meta .sale-meta-compact-item--customer {
  flex: 1 1 auto;
  width: auto;
  min-width: 7.5rem;
  max-width: 12rem;
  overflow: visible;
  position: relative;
  z-index: 80;
}

.sale-invoice-context-meta .sale-invoice-warehouse-notes {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
}

.sale-invoice-context-meta .sale-invoice-warehouse-notes textarea {
  width: 100%;
  min-height: 2rem;
  max-width: 100%;
  resize: vertical;
}

.sale-invoice-context-meta .sale-invoice-warehouse-notes--readonly .sale-meta-readonly-value {
  font-size: 0.74rem;
  line-height: 1.35;
  color: #334155;
  white-space: pre-wrap;
}

.sale-invoice-context-meta .sale-meta-label {
  height: auto;
  line-height: 1.05;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin: 0;
  text-align: center;
  white-space: nowrap;
}

.sale-invoice-context-meta .sale-input--compact,
.sale-invoice-context-meta .customer-picker-row .sale-input--compact {
  box-sizing: border-box;
  width: 100%;
  height: var(--sale-meta-control-h);
  margin: 0;
  padding: 0 0.4rem;
  font-size: 0.78rem;
  line-height: 1;
  border-radius: 5px;
}

.sale-invoice-context-meta .sale-meta-compact-item--date {
  flex: 0 0 auto;
}

.sale-invoice-context-meta .sale-date-field-text {
  font-size: 0.78rem;
}

.sale-date-field {
  position: relative;
  flex: 0 0 auto;
}

.sale-date-field-control {
  display: inline-flex;
  align-items: center;
  height: var(--sale-meta-control-h, 2rem);
}

.sale-date-field-picker {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  direction: rtl;
  box-sizing: border-box;
  width: auto;
  min-width: 6.75rem;
  max-width: 9.5rem;
  height: var(--sale-meta-control-h, 2rem);
  margin: 0;
  padding: 0 0.35rem;
  border: 1px solid rgba(30, 58, 95, 0.18);
  border-radius: 5px;
  background: #fff;
  color: var(--color-primary-dark);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.sale-date-field-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  unicode-bidi: plaintext;
}

.sale-date-field-icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

.sale-date-field-picker:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: #f0f7ff;
}

.sale-date-field-picker:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.sale-date-field.is-open .sale-date-field-picker:not(:disabled) {
  border-color: var(--color-primary);
  background: #e0f2fe;
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.sale-date-calendar {
  position: absolute;
  top: calc(100% + 0.25rem);
  inset-inline-end: 0;
  z-index: 80;
  width: 15.5rem;
  padding: 0.55rem;
  border: 1px solid #d5e3f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.sale-date-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
}

.sale-date-calendar-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-align: center;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.sale-date-calendar-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.sale-date-calendar-nav:hover {
  border-color: #93c5fd;
  color: var(--color-primary);
}

.sale-date-calendar-weekdays,
.sale-date-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.sale-date-calendar-weekdays {
  margin-bottom: 0.25rem;
}

.sale-date-calendar-weekday {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
}

.sale-date-calendar-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.sale-date-calendar-day:hover:not(.is-empty) {
  background: #e0f2fe;
  color: var(--color-primary);
}

.sale-date-calendar-day.is-selected {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

.sale-date-calendar-day.is-empty {
  pointer-events: none;
}

.sale-date-calendar-day.is-today:not(.is-selected) {
  border: 1px solid #93c5fd;
  font-weight: 700;
  color: var(--color-primary);
}

.sale-date-calendar-foot {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e8edf2;
}

.sale-date-calendar-today,
.sale-date-calendar-clear {
  padding: 0.2rem 0.75rem;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--color-primary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.sale-date-calendar-clear {
  color: #64748b;
}

.sale-date-calendar-today:hover,
.sale-date-calendar-clear:hover {
  border-color: #93c5fd;
  background: #e0f2fe;
}

.sale-invoice-context-meta .sale-meta-compact-item--price .sale-input--compact {
  width: 5.5rem;
  padding-inline-end: 1.3rem;
}

.sale-invoice-context-meta .customer-picker {
  position: relative;
  width: 100%;
  min-width: 0;
  z-index: 80;
  overflow: visible;
}

.sale-invoice-context-meta .customer-picker-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  height: var(--sale-meta-control-h);
}

.sale-invoice-context-meta .customer-picker-row .sale-input--compact {
  flex: 1 1 auto;
  min-width: 0;
}

.sale-invoice-context-meta .customer-add-btn {
  height: var(--sale-meta-control-h);
  width: var(--sale-meta-control-h);
  min-width: var(--sale-meta-control-h);
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sale-invoice-context-meta .customer-suggestions {
  z-index: 120;
  min-width: 16rem;
  width: max(100%, 16rem);
  max-height: 280px;
}

.sale-invoice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  padding: 0;
  border-bottom: none;
}

.sale-invoice-context-bar .sale-invoice-tabs {
  align-self: stretch;
}

.sale-invoice-tab {
  display: inline-flex;
  align-items: center;
  margin-bottom: -2px;
  padding: 0.5rem 1rem 0.55rem;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sale-invoice-tab:hover {
  background: #f1f5f9;
  border-bottom-color: #cbd5e1;
  color: var(--color-primary-dark);
}

.sale-invoice-tab.is-active {
  background: transparent;
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 700;
}

.sale-invoice-subpage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.sale-invoice-subpage.sale-invoice-subpage--receipt {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.sale-subpage-head {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f0f7ff 100%);
  border: 1px solid #d5e3f0;
  border-radius: 10px;
}

.sale-subpage-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
}

.sale-prep-changes-btn {
  flex-shrink: 0;
}

.sale-subpage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.sale-subpage-meta strong {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.sale-permit-wh-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sale-permit-wh-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #dbe4ee;
  background: #fff;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
}

.sale-permit-wh-tab:hover {
  border-color: #93c5fd;
  color: var(--color-primary);
}

.sale-permit-wh-tab.is-active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.sale-permit-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.sale-permit-sheet-head {
  width: 100%;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e8edf2;
}

.sale-permit-sheet-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sale-permit-sheet-sub {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.sale-permit-invoice-note {
  margin: 0.45rem 0 0;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  font-size: 0.78rem;
  line-height: 1.45;
}

.sale-permit-sheet .table-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  background: transparent;
  box-shadow: none;
}

.sale-permit-table {
  width: max-content;
  max-width: min(1040px, 100%);
  margin-inline: auto;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.3;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.sale-permit-table th,
.sale-permit-table td {
  padding: 0.32rem 0.5rem;
  border-bottom: 1px solid #cbd5e1;
  border-inline-start: 1px solid #cbd5e1;
  vertical-align: middle;
}

.sale-permit-table thead tr > *:first-child,
.sale-permit-table tbody tr > *:first-child {
  border-inline-start: none;
}

.sale-permit-table thead th {
  background: #f1f5f9;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.sale-permit-table tbody tr:last-child td {
  border-bottom: none;
}

.sale-permit-table--centered {
  text-align: center;
}

.sale-permit-table--centered th,
.sale-permit-table--centered td {
  vertical-align: middle;
}

.sale-permit-table .col-permit-num {
  width: 2.1rem;
  min-width: 2.1rem;
  text-align: center;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.sale-permit-table .col-permit-code {
  width: 2.6rem;
  min-width: 2.6rem;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary-dark);
}

.sale-permit-table .col-permit-qty {
  width: 4.2rem;
  min-width: 4.2rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sale-permit-table .col-permit-notes {
  width: 9.5rem;
  min-width: 6.5rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 400;
  text-align: right;
}

.sale-permit-table thead th.col-permit-notes {
  white-space: normal;
  line-height: 1.15;
}

.sale-permit-qty-hint {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
  border-radius: var(--radius-sm, 6px);
}

.sale-permit-reprep-hint {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.sale-prep-changes-dialog {
  max-width: min(1100px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
}

.sale-prep-changes-body {
  padding: 0.85rem 1.15rem 0.65rem;
}

.sale-prep-changes-sub {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.sale-prep-changes-table {
  max-width: 100%;
  width: 100%;
}

.sale-prep-change-detail {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-prep-change-when {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--color-text-muted);
}

.sale-prep-change-reason {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.sale-prep-change-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.sale-prep-change-badge--added,
.sale-prep-change-row--added {
  background: #ecfdf5;
}

.sale-prep-change-badge--added {
  color: #047857;
}

.sale-prep-change-badge--removed,
.sale-prep-change-row--removed {
  background: #fef2f2;
}

.sale-prep-change-badge--removed {
  color: #b91c1c;
}

.sale-prep-change-badge--qty_increase,
.sale-prep-change-row--qty_increase {
  background: #eff6ff;
}

.sale-prep-change-badge--qty_increase {
  color: #1d4ed8;
}

.sale-prep-change-badge--qty_decrease,
.sale-prep-change-row--qty_decrease {
  background: #fffbeb;
}

.sale-prep-change-badge--qty_decrease {
  color: #b45309;
}

.sale-permit-qty-input {
  width: 4rem;
  max-width: 100%;
  padding: 0.2rem 0.35rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
  background: var(--color-surface);
}

.sale-permit-row--active {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.sale-invoice-save-status {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-inline-start: 0.5rem;
}

.sale-invoice-save-status--saving {
  color: var(--color-primary);
}

.sale-invoice-save-status--saved {
  color: var(--color-success, #15803d);
}

.sale-invoice-save-status--error {
  color: var(--color-danger, #b91c1c);
}

.sale-line-row--active {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.sale-line-item-part {
  flex-shrink: 0;
  font-size: 0.64rem;
  line-height: 1;
  padding-block: 0.06rem;
}

.sale-permit-status-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.sale-invoice-subpage--log .table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sale-invoice-subpage--log .table-empty {
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sale-log-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  overflow: hidden;
}

.sale-log-split--single {
  grid-template-columns: minmax(0, 1fr);
}

.sale-status-log-empty {
  flex: 1;
  min-height: 10rem;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.sale-qty-log-table {
  table-layout: auto;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.sale-qty-log-table th:not(:first-child),
.sale-qty-log-table td:not(:first-child) {
  border-inline-start: 1px solid var(--color-border);
}

.sale-qty-log-table tbody tr:nth-child(even) {
  background: rgba(240, 247, 255, 0.55);
}

.sale-qty-log-table tbody tr:hover {
  background: rgba(224, 242, 254, 0.65);
}

@media (max-width: 960px) {
  .sale-log-split {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .sale-status-log-sheet {
    min-height: 16rem;
  }
}

.sale-status-log-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sale-status-log-sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.sale-status-log-head {
  flex-shrink: 0;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #e8edf2;
}

.sale-status-log-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sale-status-log-sub {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.sale-status-log-table {
  table-layout: auto;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.sale-status-log-table th:not(:first-child),
.sale-status-log-table td:not(:first-child) {
  border-inline-start: 1px solid var(--color-border);
}

.sale-status-log-table .col-log-index {
  width: 1%;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 0.76rem;
  padding-inline: 0.35rem;
}

.sale-status-log-table .col-log-move {
  width: 1%;
  white-space: nowrap;
  padding-inline: 0.45rem;
}

.sale-status-log-move {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.32rem;
}

.sale-status-log-arrow {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.sale-status-log-table .status-badge {
  font-size: 0.72rem;
  padding: 0.18rem 0.45rem;
  white-space: nowrap;
}

.sale-status-log-table .status-badge--log-from {
  opacity: 0.72;
  font-weight: 500;
}

.sale-status-log-table .col-log-user {
  width: 1%;
  white-space: nowrap;
  padding-inline: 0.45rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.sale-status-log-table .col-log-datetime {
  width: 1%;
  white-space: nowrap;
  padding-inline: 0.45rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.sale-status-log-table .col-log-note {
  width: 99%;
  min-width: 0;
  white-space: normal;
  text-align: right;
  font-size: 0.8rem;
  line-height: 1.35;
  word-break: break-word;
  padding-inline: 0.65rem;
}

.sale-status-log-table .col-log-note--empty {
  color: var(--color-text-muted);
}

.sale-status-log-table .col-log-note .sale-log-note-text {
  display: block;
  margin-bottom: 0.35rem;
}

.sale-log-show-changes {
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.sale-status-log-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.sale-status-log-table tbody tr:hover {
  background: #f0f7ff;
}

.sale-status-advance-dialog {
  max-width: 26rem;
}

.sale-status-advance-body {
  padding: 1rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sale-status-advance-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.sale-status-advance-arrow {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  user-select: none;
}

.sale-status-advance-question {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  text-align: center;
  line-height: 1.45;
}

.sale-status-advance-error {
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm, 6px);
  text-align: center;
  line-height: 1.5;
}

.sale-status-advance-note {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sale-status-advance-note-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-status-advance-note .sale-input {
  width: 100%;
}

.sale-status-advance-packing {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sale-status-advance-packing-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.sale-status-advance-packing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 520px) {
  .sale-status-advance-packing-grid {
    grid-template-columns: 1fr;
  }
}

.sale-status-advance-packing-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sale-status-advance-packing-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-status-advance-packing-field .sale-input {
  width: 100%;
}

.sale-status-advance-recipient {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
}

.sale-status-advance-recipient-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sale-status-advance-recipient-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-status-advance-recipient-field .sale-input {
  width: 100%;
}

.sale-status-advance-recipient-hint {
  margin: 0;
  font-size: 0.74rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.sale-status-advance-recipient-field select.sale-input {
  width: 100%;
}

.sale-status-advance-recipient-field select.sale-input--invalid,
.sale-status-advance-recipient-field .sale-input--invalid {
  border-color: #dc2626;
}

.sale-invoice-packing-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--color-surface-muted, #f9fafb);
  font-size: 0.82rem;
}

.sale-invoice-packing-display--inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  padding-inline-start: 0.35rem;
  border: none;
  border-inline-start: 1px solid #d5e3f0;
  border-radius: 0;
  background: transparent;
  font-size: 0.72rem;
  line-height: 1.3;
  flex-shrink: 0;
  white-space: nowrap;
}

.sale-invoice-context-meta .sale-invoice-packing-display--inline {
  align-self: flex-end;
  gap: 0.35rem 0.45rem;
}

.sale-invoice-context-meta .sale-invoice-packing-display--inline .sale-invoice-packing-display-item {
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
}

.sale-invoice-context-meta .sale-invoice-packing-display--inline .sale-invoice-packing-display-label {
  font-size: 0.66rem;
  line-height: 1.05;
}

.sale-invoice-context-meta .sale-invoice-packing-display--inline .sale-invoice-packing-display-value {
  font-size: 0.78rem;
  line-height: var(--sale-meta-control-h, 1.72rem);
}

.sale-invoice-context-meta .sale-invoice-packing-display--inline .sale-invoice-packing-display-sep {
  display: none;
}

.sale-meta-compact-item--customer-readonly {
  flex: 0 0 auto;
  min-width: 0;
}

.sale-meta-compact-item--customer-readonly .sale-meta-readonly-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11rem;
}

.sale-invoice-context-meta .sale-meta-compact-item--customer-readonly .sale-meta-readonly-value {
  display: block;
  min-height: var(--sale-meta-control-h);
  line-height: var(--sale-meta-control-h);
}

.sale-invoice-packing-display-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.sale-invoice-packing-display--inline .sale-invoice-packing-display-label {
  font-weight: 600;
  font-size: 0.68rem;
}

.sale-invoice-packing-display--inline .sale-invoice-packing-display-value {
  font-weight: 700;
  font-size: 0.72rem;
}

.sale-invoice-packing-display-label {
  color: var(--color-text-muted);
  font-weight: 600;
}

.sale-invoice-packing-display-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sale-invoice-packing-display-sep {
  color: var(--color-text-muted);
  opacity: 0.65;
}

.sale-invoice-packing-edit {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  flex-shrink: 0;
  padding-inline-start: 0.35rem;
  border-inline-start: 1px solid #d5e3f0;
}

.sale-invoice-context-meta .sale-invoice-packing-edit {
  flex-direction: row;
  align-items: flex-end;
  gap: 0;
  align-self: flex-end;
  padding-inline-start: 0.3rem;
}

.sale-invoice-packing-edit-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.sale-invoice-context-meta .sale-invoice-packing-edit-label {
  display: none;
}

.sale-invoice-packing-edit-grid {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.sale-invoice-context-meta .sale-invoice-packing-edit-grid {
  align-items: flex-end;
  gap: 0.28rem 0.35rem;
}

.sale-invoice-packing-edit-field {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.sale-invoice-context-meta .sale-invoice-packing-edit-field {
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  font-size: 0.66rem;
}

.sale-invoice-packing-edit-field .sale-input {
  width: 3.5rem;
  min-height: var(--sale-meta-control-h, 2rem);
  padding-inline: 0.35rem;
}

.sale-invoice-context-meta .sale-invoice-packing-edit-field .sale-input {
  width: 2.85rem;
  text-align: center;
  padding-inline: 0.2rem;
  font-size: 0.78rem;
}

.sale-invoice-packing-edit #pack-edit-save-btn {
  flex-shrink: 0;
  min-height: var(--sale-meta-control-h, 2rem);
  padding-inline: 0.55rem;
}

.sale-invoice-context-meta .sale-invoice-packing-edit #pack-edit-save-btn {
  align-self: flex-end;
  min-height: var(--sale-meta-control-h, 1.72rem);
  padding: 0 0.45rem;
  font-size: 0.74rem;
  line-height: 1;
}

.sale-invoice-packing-edit-hint {
  display: none;
}

.sale-invoice-packing-edit-error {
  width: 100%;
  margin: 0;
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 600;
}

.sale-invoice-packing-edit-success {
  width: 100%;
  margin: 0;
  color: #166534;
  font-size: 0.82rem;
  font-weight: 600;
}

.sale-receipt-replace-panel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.sale-receipt-replace-lead {
  margin: 0 0 0.85rem;
  color: #64748b;
  line-height: 1.6;
}

.sale-invoice-cancel-dialog {
  max-width: 24rem;
}

.sale-invoice-cancel-body {
  padding: 1rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sale-invoice-cancel-warning {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #991b1b;
  text-align: center;
  line-height: 1.45;
}

.sale-invoice-cancel-password {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sale-invoice-cancel-password-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-invoice-cancel-password .sale-input {
  width: 100%;
}

.sale-prep-qty-error {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b91c1c;
}

.stock-adjustment-dialog {
  max-width: 26rem;
}

.stock-adjustment-dialog-body {
  padding: 1rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stock-adjustment-dialog-hint {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--color-text);
  text-align: center;
  line-height: 1.5;
}

.stock-adjustment-password-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stock-adjustment-password-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.stock-adjustment-password-field .sale-input {
  width: 100%;
}

.stock-adjustment-dialog-error {
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm, 6px);
  text-align: center;
}

.stock-adjustment-dialog-success {
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm, 6px);
  text-align: center;
  line-height: 1.5;
}

.stock-adjustment-dialog-footer {
  gap: 0.5rem;
}

.sale-input--invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.sale-customer-missing-dialog {
  max-width: 26rem;
}

.sale-customer-missing-body {
  padding: 1rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sale-customer-missing-text,
.sale-customer-missing-question {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  text-align: center;
  line-height: 1.55;
}

.sale-customer-missing-question {
  font-weight: 700;
}

.sale-customer-missing-footer {
  gap: 0.5rem;
}

.sale-panel-head--lines-toolbar {
  flex-wrap: wrap;
}

.sale-status-note-field {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  margin-top: 0.15rem;
}

.sale-status-note-label {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.sale-status-note-input {
  width: 100%;
  max-width: none;
}

.sale-invoice-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.5rem;
}

.sale-split-viewport {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.sale-split-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  overflow: visible;
}

.sale-split-viewport--readonly .sale-split-right {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0.65rem;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sale-split-viewport--readonly .sale-split-right:has(> .sale-panel--returns-side):has(> .purchase-expense-links-panel) {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}

.sale-split-viewport--readonly .sale-panel--lines {
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.sale-panel--returns {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sale-panel--returns-side {
  min-height: 0;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.sale-split-viewport--readonly .sale-panel--returns-side,
.sale-split-viewport--readonly .purchase-expense-links-panel {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sale-panel-body--returns .sale-returns-table-wrap,
.purchase-expense-link-table-wrap--inline {
  margin: 0.45rem 0.55rem 0.55rem;
  border-radius: 0;
  box-shadow: none;
  border: 1px solid #e2e8f0;
  overflow: auto;
}

.sale-panel-body--returns {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sale-returns-table-wrap {
  max-height: 100%;
  flex: 1;
  min-height: 0;
}

.sale-returns-empty {
  margin: 0;
  padding: 1.25rem 0.85rem;
}

.sale-panel {
  background: var(--color-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.sale-panel--search,
.sale-panel--lines {
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.sale-panel--lines {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sale-panel--search {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sale-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, #fafbfc 0%, #f4f7fa 100%);
  border-bottom: 1px solid #e8edf2;
  flex-shrink: 0;
}

.sale-panel-head--compact {
  padding: 0.45rem 0.75rem;
}

.sale-panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sale-panel-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 700;
}

.sale-panel-head--lines-toolbar {
  gap: 0.55rem;
}

.sale-lines-toolbar-start,
.sale-lines-toolbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.sale-lines-toolbar-end {
  margin-inline-start: auto;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.sale-lines-toolbar-discount {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sale-lines-toolbar-discount-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.sale-lines-toolbar-discount-input {
  width: 4.5rem;
  min-width: 4.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sale-lines-toolbar-discount-input--amount {
  width: 5.5rem;
  min-width: 5.5rem;
}

.sale-lines-discount-row td {
  border-top: 1px solid #dbe4ee;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
}

.sale-lines-discount-label {
  text-align: start;
}

.sale-lines-discount-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-lines-toolbar-discount-note {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.sale-lines-toolbar-total {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding-inline-end: 0.35rem;
  border-inline-end: 1px solid #dbe4ee;
}

.sale-lines-toolbar-total-label {
  font-size: 0.74rem;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.sale-lines-toolbar-total-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0d9488;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-profit-reveal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.sale-profit-reveal:hover {
  color: #0f766e;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.sale-profit-reveal.is-revealing {
  color: #0f766e;
  border-color: #2dd4bf;
  background: #ccfbf1;
}

.sale-line-action-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.sale-line-total-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  min-width: 0;
}

.sale-line-total-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-line-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
}

.sale-profit-reveal--line {
  width: 1.75rem;
  height: 1.75rem;
}

.sale-line-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  min-width: 0;
}

.sale-line-price-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-line-profit,
.sale-line-unit-profit,
.sale-invoice-profit-total {
  font-size: 0.68rem;
  line-height: 1.2;
  color: #7c3aed;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sale-invoice-profit-total {
  margin-inline-start: 0.15rem;
}

.sale-lines-toolbar-total {
  flex-wrap: wrap;
  row-gap: 0.15rem;
}

.sale-lines-toolbar-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.sale-invoice-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  padding: 0.35rem 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.sale-invoice-actions--permits {
  width: 100%;
  max-width: 20rem;
}

.sale-invoice-actions-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.sale-invoice-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem;
}

.sale-invoice-status-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
}

.sale-invoice-status-action-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  line-height: 1;
}

.sale-permit-status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem;
  margin: 0;
}

.sale-panel-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sale-panel-badge--total {
  background: #ecfdf5;
  color: #0d9488;
  font-variant-numeric: tabular-nums;
}

.sale-panel-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.sale-panel-body--flush {
  padding: 0;
}

.sale-panel-body--lines {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sale-lines-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* ── Meta compact (top-right) ── */
.sale-panel--meta-compact,
.sale-panel--meta-compact.sale-panel {
  --sale-meta-control-h: 2rem;
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f0f7ff 100%);
  border-color: #d5e3f0;
  overflow: visible;
  position: relative;
  z-index: 12;
}

.sale-meta-compact-row {
  display: grid;
  grid-template-columns: 4.75rem 8.75rem 6.5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: end;
}

.sale-meta-compact-item {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.sale-meta-label {
  display: block;
  height: 0.95rem;
  line-height: 0.95rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #64748b;
  white-space: nowrap;
}

.sale-panel--meta-compact .sale-meta-number,
.sale-panel--meta-compact .sale-input--compact {
  box-sizing: border-box;
  width: 100%;
  height: var(--sale-meta-control-h);
  margin: 0;
  padding: 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1;
  border-radius: 6px;
}

.sale-meta-number {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: #fff;
  border: 1px solid rgba(30, 58, 95, 0.12);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sale-panel--meta-compact input[type="date"].sale-input--compact {
  padding-inline: 0.35rem;
}

.sale-panel--meta-compact select.sale-input--compact {
  padding-inline: 0.4rem;
  padding-inline-end: 1.35rem;
  appearance: auto;
}

.sale-input--price-mode {
  font-weight: 600;
  color: var(--color-primary);
  border-color: rgba(30, 58, 95, 0.2);
  background: #fff;
}

.sale-input--price-mode:focus {
  border-color: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.15);
}

.sale-panel--meta-compact .customer-picker-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  height: var(--sale-meta-control-h);
}

.sale-panel--meta-compact .customer-picker-row .sale-input--compact {
  flex: 1;
  min-width: 0;
}

.sale-panel--meta-compact .customer-add-btn {
  height: var(--sale-meta-control-h);
  width: var(--sale-meta-control-h);
  min-width: var(--sale-meta-control-h);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sale-panel--meta-compact .customer-suggestions {
  z-index: 60;
}

.sale-input--compact {
  padding: 0.32rem 0.45rem;
  font-size: 0.82rem;
  border-radius: 6px;
}

.sale-search-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  padding: 0.25rem;
  overflow: hidden;
}

.sale-search-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  background: #fafbfc;
  user-select: none;
  -webkit-user-select: none;
}

.sale-search-result-count {
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.sale-item-filters {
  margin-bottom: 0 !important;
  padding: 0.35rem 0.45rem !important;
  flex-shrink: 0;
  border: none !important;
  box-shadow: none !important;
  background: #fafbfc !important;
  border-bottom: 1px solid #e8edf2;
}

.sale-search-row {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
  flex-wrap: nowrap;
  gap: 0.65rem 0.85rem;
}

.sale-search-row .sale-search-field-label,
.sale-search-row .inventory-filter-label > span {
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.2;
  color: #64748b;
}

.sale-search-row .sale-search-field-label--spacer {
  visibility: hidden;
  user-select: none;
}

.sale-search-row .sale-search-add-field {
  flex: 0 0 auto;
}

.sale-search-row .invoice-item-add-btn,
.sale-search-row .inventory-filter-label input {
  box-sizing: border-box;
  height: 2.25rem;
  min-height: 2.25rem;
}

.sale-search-row .invoice-item-add-btn {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.25rem;
  min-width: 2.25rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(34, 139, 84, 0.35);
  border-radius: 4px;
  background: #bbf7d0;
  box-shadow: none;
  color: #14532d;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sale-item-filters--with-add {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.55rem;
}

.sale-item-filters--with-add .sale-search-row {
  flex: 1 1 auto;
  min-width: 0;
}

.inventory-filter-label-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.invoice-item-add-btn:hover,
.invoice-item-add-btn:focus-visible {
  background: #86efac;
  border-color: rgba(34, 139, 84, 0.5);
  color: #14532d;
  outline: none;
}

.invoice-item-add-btn__icon {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.sale-search-row .inventory-filter-label--name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.sale-search-row .inventory-filter-label--code {
  flex: 0 0 auto;
  width: calc(6ch + 2.75rem + 2px);
}

.sale-search-row .inventory-filter-label--code > span {
  text-align: center;
}

.sale-search-row .inventory-filter-label--code input {
  text-align: center;
}

.sale-search-stock-toggle {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.sale-search-stock-toggle-box {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.25rem;
  padding: 0 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.sale-search-stock-toggle input {
  margin: 0;
  width: 0.95rem;
  height: 0.95rem;
  accent-color: #0f766e;
}

.sale-search-stock-toggle:has(input:checked) .sale-search-stock-toggle-box {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.sale-search-actions {
  align-self: flex-end;
  min-height: 0;
  padding-bottom: 0.1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sale-picker-table-wrap {
  margin: 0;
}

.sale-picker-list {
  border-collapse: separate;
  border-spacing: 0;
}

.sale-picker-list tbody tr {
  background: #fff;
}

.sale-picker-list tbody tr + tr .inventory-picker-compact {
  border-top: 1px solid #e8edf2;
}

.sale-picker-list .inventory-picker-compact-cell {
  padding: 0;
  vertical-align: middle;
  border: none;
}

.sale-picker-list .table-empty {
  padding: 1.25rem 0.75rem;
}

.inventory-picker-compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.18rem;
  min-height: 2.85rem;
  padding: 0.38rem 0.55rem;
}

.inventory-picker-compact-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.inventory-picker-compact-line--head {
  gap: 0.32rem;
}

.inventory-picker-compact-line--meta {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  margin-top: 0;
  font-size: 0.74rem;
  color: var(--color-text);
}

.inventory-picker-compact-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-picker-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
  max-width: 7.5rem;
  flex-shrink: 1;
}

.inventory-picker-meta-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-picker-meta-item .inventory-card-icon {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  color: #64748b;
}

.inventory-picker-meta-item--warehouse,
.inventory-picker-meta-item--warehouse span {
  color: #dc2626;
  font-size: 0.72rem;
  max-width: 6.5rem;
}

.inventory-picker-meta-item--warehouse .inventory-card-icon {
  color: #dc2626;
}

.inventory-picker-sep {
  width: 1px;
  height: 0.85rem;
  background: #dde4ec;
  flex-shrink: 0;
}

.inventory-picker-qty .inventory-qty-num {
  font-size: 0.82rem;
  line-height: 1;
}

.inventory-picker-qty .inventory-qty-status {
  font-size: 0.58rem;
  padding: 0.02rem 0.28rem;
  line-height: 1.2;
}

.inventory-picker-prices {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}

.inventory-picker-price {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 3.1rem;
  white-space: nowrap;
  padding: 0.12rem 0.28rem 0.1rem;
  border-radius: 4px;
  transition: background 0.15s, box-shadow 0.15s;
}

.inventory-picker-price--active {
  background: rgba(39, 174, 96, 0.14);
  box-shadow: inset 0 0 0 1px rgba(39, 174, 96, 0.28);
}

.inventory-picker-price-label {
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text-muted);
  text-align: center;
}

.inventory-picker-price--active .inventory-picker-price-label {
  color: #1e8449;
}

.inventory-picker-price-value {
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.inventory-picker-price--active .inventory-picker-price-value {
  color: #145a32;
  font-weight: 700;
}

.inventory-card--picker-compact {
  padding: 0.42rem 0.55rem;
}

.inventory-card--picker-compact .inventory-picker-compact {
  padding: 0;
}

.sale-picker-cards-wrap {
  padding: 0.4rem;
}

.sale-picker-cards-wrap .inventory-cards-list {
  gap: 0.45rem;
}

.sale-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}

.sale-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

.sale-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.customer-picker {
  position: relative;
  width: 100%;
}

.customer-picker-row {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}

.customer-picker-row .sale-input {
  flex: 1;
  min-width: 0;
}

.customer-add-btn {
  padding-inline: 0.55rem;
  min-width: 2rem;
}

.customer-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 2px);
  right: 0;
  left: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  overflow-y: auto;
}

.customer-suggestion-header {
  padding: 0.35rem 0.7rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.15rem;
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

.customer-suggestion-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: none;
  background: transparent;
  text-align: right;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}

.customer-suggestion-item__name {
  font-weight: 600;
  color: #0f172a;
}

.customer-suggestion-item__meta {
  font-size: 0.74rem;
  color: #64748b;
}

.customer-suggestion-item:hover,
.customer-suggestion-item.is-keyboard-pick {
  background: var(--color-bg);
}

.customer-suggestion-empty {
  padding: 0.5rem 0.7rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.inventory-pick-row {
  cursor: pointer;
  transition: background 0.12s;
}

.inventory-pick-row:hover {
  background: #ecfdf5 !important;
}

.inventory-pick-row.is-keyboard-pick {
  background: #ecfdf5 !important;
  box-shadow: inset 0 0 0 2px rgba(30, 58, 95, 0.45);
}

.inventory-pick-row--disabled,
.inventory-pick-row--disabled:hover {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8fafc !important;
}

.inventory-pick-row--disabled .inventory-pick-btn {
  opacity: 0.35;
}

.inventory-card.inventory-pick-row:hover {
  border-color: #86efac;
}

.inventory-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.inventory-card-pick-hint {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.72rem;
  color: var(--color-primary);
  text-align: center;
}

.col-pick {
  width: 2rem;
  text-align: center;
}

.sale-lines-table .sale-line-input {
  width: 100%;
  min-width: 0;
  padding: 0.32rem 0.38rem;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  font: inherit;
  font-size: 0.84rem;
}

.sale-line-input--qty,
.sale-line-input--price {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.sale-line-input--qty {
  min-width: calc(4.5ch + 1.1rem);
}

.sale-line-input--price {
  min-width: calc(5.5ch + 0.75rem);
}

.col-line-num {
  width: 1.5rem;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
}

.sale-lines-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.86rem;
}

.sale-lines-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  border-radius: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  background: #d8e0ea;
  border-bottom: 1px solid #bcc6d4;
  box-shadow: none;
  font-size: 0.78rem;
  padding: 0.42rem 0.32rem;
  white-space: nowrap;
}

.sale-lines-table thead th.col-line-qty,
.sale-lines-table thead th.col-line-price,
.sale-lines-table thead th.col-line-rmb,
.sale-lines-table thead th.col-line-total,
.sale-lines-table thead th.col-line-actions {
  text-align: center;
}

.sale-lines-table tbody td.col-line-qty,
.sale-lines-table tbody td.col-line-price,
.sale-lines-table tbody td.col-line-rmb,
.sale-lines-table tbody td.col-line-total,
.sale-lines-table tbody td.col-line-actions {
  text-align: center;
}

.sale-lines-table tbody td {
  padding: 0.65rem 0.32rem;
  vertical-align: middle;
  overflow: visible;
  line-height: normal;
}

.sale-lines-table tbody td.col-line-item {
  padding: 0.7rem 0.38rem;
  overflow: visible;
  vertical-align: middle;
}

.sale-lines-table tbody tr {
  min-height: 2.95rem;
}

.sale-lines-table .col-line-num {
  width: 1.35rem;
}

.sale-lines-table .col-line-item {
  width: auto;
  max-width: 0;
}

.sale-lines-table .col-line-qty {
  width: 6.25rem;
  min-width: 6.25rem;
  text-align: center;
}

.sale-lines-table .col-line-rmb {
  width: 6.5rem;
  min-width: 5.5rem;
  text-align: center;
}

.sale-lines-table .col-line-price {
  width: 6.75rem;
  min-width: 6.75rem;
  text-align: center;
}

.sale-lines-table .col-line-total {
  width: 6rem;
  min-width: 6rem;
  text-align: center;
}

.sale-lines-table .col-line-notes {
  width: 8.5rem;
  min-width: 6.5rem;
  max-width: 10rem;
}

.sale-lines-table tbody td.col-line-notes {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-line-input--notes {
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
}

.sale-line-notes-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--color-text);
}

.sale-lines-table .col-line-actions,
.sale-lines-table .col-line-action {
  width: 4.2rem;
  min-width: 4.2rem;
  padding-inline: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.sale-lines-table thead th.col-line-actions {
  font-size: 0.72rem;
  white-space: nowrap;
}

.sale-line-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
}

.sale-line-edit,
.sale-line-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  background: #fff;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.sale-line-edit {
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.sale-line-edit:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.sale-line-edit .ui-icon {
  width: 13px;
  height: 13px;
}

.sale-line-row--card-reviewed {
  background: #ecfdf5;
  box-shadow: inset -3px 0 0 #059669;
}

.sale-line-edit--reviewed {
  border-color: #6ee7b7;
  background: #d1fae5;
  color: #047857;
}

.sale-line-edit--reviewed:hover {
  background: #a7f3d0;
  border-color: #34d399;
  color: #065f46;
}

.sale-line-remove {
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.95rem;
  font-weight: 700;
}

.sale-line-remove:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.sale-line-item-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  min-width: 0;
  width: 100%;
  min-height: 2.45rem;
  padding-block: 0.04rem;
  overflow: visible;
}

.sale-line-item-codes {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.32rem;
  width: 100%;
  min-width: 0;
  min-height: 1.05rem;
  line-height: 1;
}

.sale-line-item-wh-row {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0.95rem;
  line-height: 1;
}

.sale-line-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.55rem;
  width: 100%;
  min-width: 0;
}

.sale-line-item-code-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex-shrink: 0;
}

.sale-line-item-code-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sale-line-item-code {
  flex-shrink: 0;
  font-size: 0.64rem;
  line-height: 1;
  padding-block: 0.06rem;
}

.sale-line-item-name {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1rem;
}

.sale-line-item-wh {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  color: #dc2626;
  overflow: visible;
}

.sale-line-wh-icon {
  flex-shrink: 0;
  color: #dc2626;
}

.sale-line-wh-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.64rem;
  line-height: 1.1;
  color: #dc2626;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 0;
}

.sale-entry-issues {
  margin: 0 0.75rem 0.4rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sale-line-row--pending {
  background: #fffbeb;
}

.sale-line-row--missing {
  background: #fef2f2;
}

.sale-line-row--stock-warn {
  background: #fef2f2;
}

.sale-line-row--stock-warn .sale-line-input--qty {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.sale-line-stock-warn {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #b91c1c;
}

.sale-lines-table .line-total {
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

.sale-invoice-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.08);
}

.sale-invoice-total {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sale-invoice-total-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.sale-invoice-total-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0d9488;
}

.sale-invoice-footer .sale-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sale-pick-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 0.45rem 0.85rem;
  background: #065f46;
  color: #fff;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.sale-pick-toast--error {
  background: #991b1b;
}

@media (max-width: 1099px) {
  .sale-invoice-page {
    height: auto;
    overflow: auto;
    padding-bottom: 2rem;
  }

  .sale-invoice-form {
    height: auto;
  }

  .sale-split-viewport {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    overflow: visible;
  }

  .sale-split-viewport--readonly .sale-split-right {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sale-split-viewport--readonly .sale-split-right:has(> .sale-panel--returns-side):has(> .purchase-expense-links-panel) {
    grid-template-rows: unset;
  }

  .sale-split-viewport--readonly .sale-panel--returns-side,
  .sale-split-viewport--readonly .purchase-expense-links-panel,
  .sale-split-viewport--readonly .sale-panel--lines {
    height: auto;
    min-height: 12rem;
  }

  .sale-search-row {
    flex-wrap: wrap;
  }

  .sale-search-row .inventory-filter-label--name,
  .sale-search-row .inventory-filter-label--code {
    flex: 1 1 calc(50% - 0.45rem);
    min-width: 0;
  }

  .sale-search-row .inventory-filter-label--code {
    width: auto;
  }

  .sale-search-actions {
    flex: 1 1 100%;
  }

  .sale-panel--search {
    min-height: 320px;
  }

  .sale-lines-wrap {
    max-height: 360px;
  }

  .sale-panel-head--lines-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sale-lines-toolbar-end {
    margin-inline-start: 0;
    justify-content: space-between;
  }

  .sale-lines-toolbar-total {
    border-inline-end: none;
    padding-inline-end: 0;
  }
}

.inventory-filters {
  background: var(--color-surface);
  border: 1px solid #dde4ec;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.inventory-filters-row,
.inventory-search-row,
.inventory-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: end;
}

.inventory-filters-row {
  width: 100%;
}

.inventory-filter-label--warehouse,
.inventory-filter-label--stock {
  flex: 0 1 9.5rem;
  min-width: 7.5rem;
}

.inventory-filter-label--name {
  flex: 1 1 12rem;
  min-width: 8rem;
  max-width: 22rem;
}

.inventory-filter-label--code {
  flex: 0 0 auto;
  width: calc(6ch + 2.75rem + 2px);
  align-items: center;
}

.inventory-filter-row {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.inventory-search-row {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e8edf2;
}

.inventory-filters-row .inventory-filter-label--code > span {
  text-align: center;
  width: 100%;
}

.inventory-filters-row .inventory-filter-label--code input {
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  min-width: 0;
}

.inventory-filters-row .inventory-filter-label {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.inventory-filters-row .inventory-filter-label > span {
  display: block;
  min-height: 0.77rem;
}

.inventory-filters-row .inventory-filter-label.is-active {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.inventory-filters-row .inventory-filter-label.is-active > span {
  color: #1e8449;
}

.inventory-filters-row .inventory-filter-label.is-active input,
.inventory-filters-row .inventory-filter-label.is-active input:focus {
  background: #ecfdf5;
  border-color: rgba(39, 174, 96, 0.45);
  box-shadow: none;
}

.inventory-filters-row .inventory-filter-label input:focus {
  outline: none;
  border-color: rgba(39, 174, 96, 0.55);
  background: #fff;
  box-shadow: none;
}

.inventory-filters-row .inventory-filter-label:not(.is-active) input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.85;
}

.inventory-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.inventory-filter-label > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

.inventory-filter-label input,
.inventory-filter-label select {
  width: 100%;
  padding: 0.48rem 0.7rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--color-text);
  border: 1px solid #dde4ec;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.inventory-filter-label input::placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
}

.inventory-filter-label input:hover,
.inventory-filter-label select:hover {
  border-color: #c9d4e0;
  background: #fff;
}

.inventory-filter-label input:focus,
.inventory-filter-label select:focus {
  outline: none;
  border-color: var(--color-primary-light);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(45, 90, 142, 0.1);
}

/* فاتورة البيع: شريط بحث — نفس نمط المخزون */
.sale-search-row .inventory-filter-label input,
.sale-search-row .inventory-filter-label select {
  width: 100%;
  min-width: 0;
}

.inventory-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  align-self: end;
  min-height: 2.35rem;
}

#inventory-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#inventory-table th.col-item,
#inventory-table td.col-item {
  width: 28%;
  min-width: 8rem;
  padding-inline: 0.4rem;
}

#inventory-table th.col-meta,
#inventory-table td.col-meta {
  width: 3.85rem;
  min-width: 0;
  max-width: 3.85rem;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  padding-inline: 0.15rem;
}

#inventory-table th.col-storage-location,
#inventory-table td.col-storage-location {
  width: 5.5rem;
  min-width: 0;
  max-width: 5.5rem;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  padding-inline: 0.15rem;
}

#inventory-table th.col-qty,
#inventory-table td.col-qty {
  width: 2.9rem;
  min-width: 0;
  max-width: 2.9rem;
  padding-inline: 0.1rem;
}

#inventory-table th.col-supply-status,
#inventory-table td.col-supply-status {
  width: 6.75rem;
  min-width: 0;
  max-width: 6.75rem;
  padding-inline: 0.15rem;
}

#inventory-table th.col-transfer-status,
#inventory-table td.col-transfer-status {
  width: 7.1rem;
  min-width: 0;
  max-width: 7.1rem;
  padding-inline: 0.15rem;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

#inventory-table th.col-price,
#inventory-table td.col-price {
  width: 3.35rem;
  min-width: 0;
  max-width: 3.35rem;
  white-space: nowrap;
  box-sizing: border-box;
  font-size: 0.72rem;
  padding-inline: 0.1rem;
}

#inventory-table th.col-actions,
#inventory-table td.col-actions {
  width: 3.15rem;
  min-width: 3.15rem;
  max-width: 3.15rem;
  padding: 0.15rem;
  text-align: center;
}

#inventory-table .table-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}

#inventory-table .table-action-btn {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 5px;
}

#inventory-table .table-action-btn .ui-icon {
  width: 14px;
  height: 14px;
}

.warehouse-transfer-summary {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface-muted, #f4f6f8);
  border: 1px solid var(--color-border, #e0e4e8);
  border-radius: 8px;
  font-size: 0.92rem;
}

.warehouse-transfer-summary p {
  margin: 0.25rem 0;
}

.warehouse-transfer-label {
  color: var(--color-text-muted, #667);
}

.stock-prefill-balance {
  margin: 0;
  font-size: 1rem;
}

.stock-prefill-qty {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-primary, #2563eb);
}

#inventory-table th:not(:last-child),
#inventory-table td:not(:last-child) {
  border-left: 1px solid #e8edf2;
}

#inventory-table th:first-child,
#inventory-table td:first-child {
  text-align: right;
}

#inventory-table th:not(:first-child),
#inventory-table td:not(:first-child) {
  text-align: center;
  vertical-align: middle;
}

#inventory-table td:not(:first-child) .inventory-qty-cell {
  margin-inline: auto;
}

#inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f3f6f9;
  border-bottom: 1px solid #dde4ec;
  box-shadow: 0 2px 4px rgba(30, 58, 95, 0.06);
}

.item-cell-name {
  font-weight: 400;
  margin-top: 0.25rem;
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}

.item-cell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  justify-content: flex-start;
  direction: rtl;
}

.data-table .item-badge {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  line-height: 1.3;
}

.data-table .item-badge--code {
  background-color: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.data-table .item-badge--part {
  background-color: rgba(217, 119, 6, 0.1);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.22);
}

#inventory-tbody.inventory-loading {
  opacity: 0.55;
  pointer-events: none;
}

.inventory-result-count[hidden] {
  display: none;
}

.inventory-qty-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  line-height: 1.2;
}

.inventory-picker-qty.inventory-qty-cell {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.22rem;
  flex-shrink: 0;
}

.inventory-qty-num {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-text);
}

.inventory-qty-status {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.25;
}

.inventory-qty-status--qty-out {
  background: #fee2e2;
  color: #991b1b;
}

.inventory-qty-status--qty-low {
  background: #fef3c7;
  color: #92400e;
}

.inventory-qty-status--qty-ok {
  background: #dcfce7;
  color: #166534;
}

.supply-status {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.25;
}

.supply-status-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  line-height: 1.15;
  text-align: center;
  width: fit-content;
  max-width: 100%;
}

.supply-status-lines {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  width: fit-content;
  max-width: 100%;
}

.supply-status-line {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
}

.supply-status-line.supply-status--order {
  background: #dbeafe;
  color: #1e40af;
}

.supply-status-line.supply-status--in-supply {
  background: #fef3c7;
  color: #92400e;
}

.supply-status-line.supply-status--in-shipping {
  background: #e0e7ff;
  color: #3730a3;
}

.supply-status-qty {
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.supply-status-label {
  font-size: 0.6rem;
  font-weight: 700;
  white-space: nowrap;
}

.supply-status-extra {
  font-size: 0.58rem;
  font-weight: 700;
  opacity: 0.85;
}

.supply-status--none {
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 0;
}

.supply-status-stack.supply-status--order {
  background: #dbeafe;
  color: #1e40af;
}

.supply-status-stack.supply-status--in-supply {
  background: #fef3c7;
  color: #92400e;
}

.supply-status-stack.supply-status--in-shipping {
  background: #e0e7ff;
  color: #3730a3;
}

th.col-supply-status,
.col-supply-status,
td.col-supply-status {
  width: 1%;
  min-width: 0;
  max-width: 6.75rem;
  padding-inline: 0.2rem;
  text-align: center;
  vertical-align: middle;
  background: transparent;
}

th.col-supply-status {
  white-space: nowrap;
  font-size: 0.74rem;
  line-height: 1.2;
}

.inventory-card-row--supply-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.inventory-card-row--supply-status .inventory-card-meta-label {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.inventory-result-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.inventory-foot-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.inventory-foot-summary[hidden] {
  display: none !important;
}

.inventory-total-stock {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin: 0;
}

.inventory-total-stock[hidden] {
  display: none !important;
}

.inventory-total-stock-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.inventory-total-stock-value {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
}

/* بطاقات المخzون — جوال */
.inventory-cards-wrap {
  display: none;
}

.inventory-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inventory-cards-list.inventory-loading {
  opacity: 0.55;
  pointer-events: none;
}

.inventory-cards-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.inventory-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow-sm);
}

.inventory-card-head {
  margin-bottom: 0.5rem;
}

.inventory-card-name {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.35;
  word-break: break-word;
}

.inventory-card .item-badge {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  line-height: 1.3;
}

.inventory-card .item-badge--code {
  background-color: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.inventory-card .item-badge--part {
  background-color: rgba(217, 119, 6, 0.1);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.22);
}

.inventory-card-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.inventory-card-row--qty {
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e8edf2;
}

.inventory-card-row--meta {
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  color: var(--color-text);
}

.inventory-card-row--storage {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  color: var(--color-text);
}

.inventory-card-storage-location {
  min-width: 0;
  word-break: break-word;
}

.inventory-card-qty {
  flex-direction: row;
  justify-content: flex-start;
  gap: 0.45rem;
  flex-shrink: 0;
}

.inventory-card-qty .inventory-qty-num {
  font-size: 1rem;
}

.inventory-card-warehouse,
.inventory-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  flex: 1;
}

.inventory-card-warehouse {
  justify-content: flex-end;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.inventory-card-meta-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-card-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.inventory-card-icon {
  flex-shrink: 0;
  color: #64748b;
}

.inventory-card-sep {
  width: 1px;
  height: 0.95rem;
  background: #dde4ec;
  flex-shrink: 0;
}

.inventory-card-prices {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid #e8edf2;
}

.inventory-card-price-compact {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
  justify-content: center;
}

.inventory-card-price-compact:first-child {
  justify-content: flex-start;
}

.inventory-card-price-compact:last-child {
  justify-content: flex-end;
}

.inventory-card-price-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.inventory-card-price-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .inventory-table-wrap {
    display: none;
  }

  .inventory-cards-wrap {
    display: block;
  }

  .inventory-filters-row {
    flex-wrap: nowrap;
    gap: 0.75rem;
  }

  .inventory-filter-label--name {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
  }

  .inventory-filter-label--code {
    flex: 0 0 auto;
    width: calc(6ch + 2.75rem + 2px);
  }

  .inventory-filters-row .inventory-filter-label > span {
    white-space: nowrap;
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .inventory-filters-row,
  .inventory-search-row,
  .inventory-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .inventory-filter-label--name,
  .inventory-filter-label--code,
  .inventory-filter-label--warehouse,
  .inventory-filter-label--stock {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }

  .inventory-filter-actions {
    width: 100%;
    justify-content: stretch;
  }

  .inventory-filter-actions .btn {
    flex: 1;
  }
}

.items-excel-panel {
  margin-bottom: 1.25rem;
}

.items-search-bar {
  margin-bottom: 1rem;
}

.items-search-meta {
  font-size: 0.875rem;
  color: var(--text-muted, #5c6b7a);
  align-self: center;
  min-height: 1.25rem;
}

.items-search-hint {
  margin: 0.65rem 0 0;
}

.items-no-results[hidden],
.items-data-row[hidden] {
  display: none;
}

.items-excel-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.items-excel-file-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 220px;
  max-width: 420px;
  font-size: 0.92rem;
}

.items-excel-file-label input[type="file"] {
  font: inherit;
}

.items-excel-columns {
  margin-top: 1rem;
}

.items-excel-columns summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.sale-return-dialog {
  max-width: min(980px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
}

.sale-return-dialog .sale-return-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
}

.sale-return-dialog-meta-bar {
  margin-bottom: 0;
}

.sale-return-dialog .sale-meta-compact-item {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
}

.sale-return-dialog .sale-meta-compact-item--customer {
  flex: 0 1 auto;
  max-width: 14rem;
}

.sale-return-dialog .sale-meta-compact-item--customer .sale-return-meta-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-return-dialog .sale-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  margin: 0;
}

.sale-return-dialog .sale-return-meta-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

.sale-return-dialog-reason {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.sale-return-dialog-reason select {
  min-width: 9rem;
  max-width: 100%;
}

.sale-return-dialog-table-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.sale-return-dialog-table-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.sale-return-lines-wrap {
  max-height: min(52vh, 26rem);
  overflow: auto;
  border: 1px solid #d5e3f0;
  border-radius: var(--radius);
  background: #fff;
}

.sale-return-lines-table--modal {
  font-size: 0.78rem;
  margin: 0;
}

.sale-return-lines-table--modal thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4fb;
  font-size: 0.72rem;
  padding: 0.38rem 0.45rem;
  white-space: nowrap;
  border-bottom: 1px solid #c9d9ea;
}

.sale-return-lines-table--modal tbody td {
  padding: 0.28rem 0.45rem;
  line-height: 1.25;
  vertical-align: middle;
  border-bottom: 1px solid #e2e8ef;
}

.sale-return-lines-table--modal .col-auto-code {
  width: 4.5rem;
  text-align: center;
}

.sale-return-lines-table--modal .col-part-no {
  min-width: 5.5rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.74rem;
  color: #475569;
}

.sale-return-lines-table--modal .col-item-name {
  min-width: 9rem;
  max-width: 14rem;
}

.sale-return-lines-table--modal .col-num {
  width: 3.25rem;
  text-align: center;
  white-space: nowrap;
}

.sale-return-lines-table--modal .col-qty {
  width: 4.5rem;
  text-align: center;
}

.sale-return-lines-table--modal .col-qty .sale-input {
  width: 3.5rem;
  min-width: 3.5rem;
  text-align: center;
  padding: 0.2rem 0.25rem;
  font-size: 0.78rem;
}

.sale-return-lines-table--modal .col-warehouse {
  min-width: 8.5rem;
}

.sale-return-lines-table--modal .col-warehouse select {
  width: 100%;
  min-width: 7.5rem;
  font-size: 0.74rem;
  padding: 0.2rem 0.35rem;
}

.sale-return-lines-table--modal tbody tr {
  background: #fafbfc;
}

.sale-return-lines-table--modal tbody tr:nth-child(even) {
  background: #f4f7fa;
}

.sale-return-lines-table--modal tbody tr.has-return-qty {
  background: #eef6ff;
}

.sale-return-lines-table--modal tbody tr.has-return-qty:nth-child(even) {
  background: #e3effc;
}

.sale-return-lines-table--modal tbody tr.is-disabled {
  opacity: 0.5;
}

.sale-return-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%);
  border: 1px solid #d5e3f0;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
}

.sale-return-total-bar--modal {
  flex: 1 1 auto;
  min-width: 11rem;
  margin: 0;
}

.sale-return-total-bar--modal strong {
  font-size: 1rem;
  color: var(--color-primary-dark, #152a45);
}

.sale-return-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sale-return-dialog-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sale-return-dialog-actions .btn-outline {
  border-color: #cbd5e1;
  color: #475569;
  background: #fff;
}

.sale-return-error {
  margin: 0;
  padding: 0.45rem 0.65rem;
  color: var(--danger, #c0392b);
  font-size: 0.82rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
}

.sale-return-refund-section {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
}

.sale-return-refund-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-primary-dark, #152a45);
}

.sale-return-refund-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: #64748b;
}

.sale-return-refund-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem 0.75rem;
}

.sale-return-refund-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.sale-return-refund-field--notes {
  grid-column: 1 / -1;
}

.sale-return-refund-card {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
}

.sale-return-refund-card-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.sale-return-refund-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
}

.sale-return-refund-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.treasury-refund-payable-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--color-success, #16a34a) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-success, #16a34a) 28%, transparent);
}

.treasury-refund-payable-banner__label {
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}

.treasury-refund-payable-banner__value {
  font-size: 1.125rem;
  color: var(--color-success, #16a34a);
}

.treasury-refund-payable-banner__hint {
  width: 100%;
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
}

.treasury-receipt-type-badge--refund {
  background: color-mix(in srgb, var(--color-warning, #d97706) 18%, transparent);
  color: var(--color-warning, #d97706);
}

.sale-return-lines-table tr.is-disabled {
  opacity: 0.55;
}

.sale-return-original-hint {
  margin-top: -0.35rem;
}

.sales-returns-item-filter {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e8edf2;
}

.sales-returns-item-filter-hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: #64748b;
}

.sales-returns-item-filter .item-lookup {
  gap: 0.5rem;
}

.purchases-extended-filter .purchases-filter-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
}

.purchases-filter-field--invoice {
  flex: 0 1 11rem;
  min-width: 9rem;
}

.purchases-filter-field--warehouse {
  flex: 0 1 10rem;
  min-width: 8.5rem;
}

.purchases-filter-item-lookup {
  flex: 1 1 18rem;
  min-width: min(100%, 16rem);
}

.purchases-filter-item-lookup .item-lookup {
  gap: 0.5rem;
}

.purchases-filter-item-lookup .item-lookup-search-wrap {
  width: 100%;
}

.purchases-filter-item-lookup .inventory-search-row {
  margin: 0;
  padding: 0;
  border-top: none;
  flex-wrap: nowrap;
}

.purchases-filter-item-lookup .inventory-filter-label--name {
  flex: 1 1 12rem;
  max-width: none;
  min-width: 8rem;
}

.purchases-filter-item-lookup .inventory-filter-label--code {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .purchases-filter-item-lookup .inventory-search-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .purchases-extended-filter .purchases-filter-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .purchases-filter-field--invoice,
  .purchases-filter-field--warehouse,
  .purchases-filter-item-lookup {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }
}

.sale-return-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%);
  border: 1px solid #d5e3f0;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.sale-return-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  width: 100%;
}

.sale-return-page .sale-meta-compact-item {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
}

.sale-return-page .sale-meta-compact-item--customer {
  flex: 0 1 auto;
  max-width: 14rem;
}

.sale-return-page .sale-meta-compact-item--customer .sale-return-meta-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-return-meta-item--notes {
  flex: 1 1 100%;
  align-items: flex-start;
}

.sale-return-page .sale-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  margin: 0;
}

.sale-return-page .sale-return-meta-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

.sale-return-meta-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.sale-return-meta-link:hover {
  text-decoration: underline;
}

.sale-return-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.sale-return-status--posted {
  background: #e8f5ee;
  color: #1f7a45;
}

.sale-return-status--cancelled {
  background: #fdecec;
  color: #b42318;
}

.sale-return-status--draft {
  background: #eef2f7;
  color: #475569;
}

.sale-return-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  overflow: auto;
}

.sale-return-total-bar--page {
  margin-top: 0.65rem;
}

.sale-returns-table,
.sale-return-lines-table--detail {
  font-size: 0.8125rem;
}

.sale-returns-table th,
.sale-returns-table td,
.sale-return-lines-table--detail th,
.sale-return-lines-table--detail td {
  padding: 0.32rem 0.5rem;
  line-height: 1.3;
  vertical-align: middle;
  text-align: center;
}

.sale-panel-body--returns .purchase-returns-table th,
.sale-panel-body--returns .purchase-returns-table td {
  text-align: center;
}

.sale-returns-table .btn-sm,
.sale-return-lines-table--detail .btn-sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.sale-returns-table tbody tr {
  background: #fdeeee;
}

.sale-returns-table tbody tr:nth-child(even) {
  background: #f9e0e0;
}

.sale-returns-table tbody tr:hover {
  background: #f5d4d4;
}

.sale-returns-table tbody tr:nth-child(even):hover {
  background: #efcccc;
}

.sale-returns-table tbody td {
  border-bottom: 1px solid #e0aaaa;
}

.sale-returns-table tbody tr:last-child td {
  border-bottom: none;
}

.sale-return-lines-table--detail tbody tr {
  background: #f8fafc;
}

.sale-return-lines-table--detail tbody tr:nth-child(even) {
  background: #f1f5f9;
}

/* ── Stock adjustment / item tracking pages ── */
.stock-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stock-page-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stock-page-card {
  background: #fff;
  border: 1px solid var(--border, #d8e0ea);
  border-radius: 4px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stock-page-card-header {
  margin-bottom: 0.85rem;
}

.stock-page-card-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.stock-page-card-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.stock-page-card-header--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.stock-page-card-meta {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted, #64748b);
}

.stock-page-grid {
  margin-top: 0.25rem;
}

.item-lookup {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-lookup-search-wrap {
  position: relative;
}

.item-lookup-search-row {
  margin: 0;
  padding-top: 0;
  border-top: none;
  position: relative;
}

.item-lookup-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  z-index: 40;
  max-height: min(18rem, 50vh);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border, #d8e0ea);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.item-lookup-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: transparent;
  text-align: right;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.item-lookup-option:last-child {
  border-bottom: 0;
}

.item-lookup-option:hover,
.item-lookup-option.is-keyboard-pick {
  background: #eef4ff;
}

.item-lookup-option-name {
  flex: 1 1 auto;
  font-weight: 600;
  min-width: 0;
}

.item-lookup-option-part {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}

.item-lookup-option-stock {
  font-size: 0.82rem;
  color: #0f766e;
  font-weight: 600;
}

.item-lookup-empty,
.item-lookup-loading {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--muted, #64748b);
  text-align: center;
}

.item-lookup-selected {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #f0f7ff;
  border: 1px solid #c7daf5;
  border-radius: 4px;
}

.item-lookup-selected-label {
  flex: 1 1 auto;
  font-weight: 600;
  line-height: 1.45;
}

.item-lookup-selected-part {
  font-weight: 500;
  color: var(--muted, #64748b);
}

.item-movements-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: visible;
}

.item-movements-customer-picker {
  position: relative;
  width: 100%;
  z-index: 30;
}

.item-movements-customer-picker .customer-suggestions {
  z-index: 60;
  max-height: 14rem;
}

.item-movements-row--in {
  background: #ecfdf5;
}

.item-movements-row--out {
  background: #fff7ed;
}

.item-movements-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.8rem;
}

.item-movements-table thead th {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.38rem 0.32rem;
  vertical-align: bottom;
}

.item-movements-table th,
.item-movements-table td {
  padding: 0.32rem 0.38rem;
}

.item-movements-table tbody td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  vertical-align: middle;
}

.item-movements-table .col-kardex-date { width: 6.4rem; }
.item-movements-table .col-kardex-type { width: 5.1rem; }
.item-movements-table .col-kardex-invoice { width: 6.2rem; }
.item-movements-table .col-kardex-name { width: 18%; }
.item-movements-table .col-kardex-warehouse { width: 7.2rem; }
.item-movements-table .col-kardex-delta {
  width: 3.1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.item-movements-table .col-kardex-price {
  width: 5.4rem;
  font-variant-numeric: tabular-nums;
}
.item-movements-table .col-kardex-balance {
  width: 4.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.item-movements-table .col-kardex-notes { width: 22%; }

.item-movements-table tbody tr.item-movements-row--in:hover {
  background: #d1fae5;
}

.item-movements-table tbody tr.item-movements-row--out:hover {
  background: #ffedd5;
}

@media (max-width: 768px) {
  .item-movements-table.data-table--mobile-cards {
    table-layout: auto;
  }

  .item-movements-table.data-table--mobile-cards thead th,
  .item-movements-table.data-table--mobile-cards tbody td {
    width: auto;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

.item-movements-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding-top: 0.15rem;
  border-top: 1px solid #eef2f7;
  overflow: visible;
}

.item-movements-filters .inventory-filter-label {
  flex: 1 1 14rem;
  max-width: 20rem;
}

.item-movements-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-movements-results .table-wrap {
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .item-movements-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .item-movements-filters .inventory-filter-label {
    max-width: none;
  }

  .item-movements-actions .btn {
    width: 100%;
  }
}

.purchase-invoices-table tbody tr {
  background: #edf7ed;
}

.purchase-invoices-table tbody tr:nth-child(even) {
  background: #e0f2e0;
}

.purchase-invoices-table tbody tr:hover {
  background: #d4ecd4;
}

.purchase-invoices-table tbody td {
  border-bottom: 1px solid #b8d4b8;
}

.purchase-returns-table tbody tr {
  background: #fdeeee;
}

.purchase-returns-table tbody tr:nth-child(even) {
  background: #f9e0e0;
}

.purchase-returns-table tbody tr:hover {
  background: #f5d4d4;
}

.purchase-returns-table tbody td {
  border-bottom: 1px solid #e0aaaa;
}

.purchase-invoice-page {
  --sale-page-chrome: calc(var(--app-header-height, 4.75rem) + 5.5rem);
}

.purchase-invoice-page .purchase-invoice-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
}

.purchase-invoice-page .purchase-invoice-context-bar .sale-invoice-context-nav {
  flex: 0 0 auto;
  border-bottom: 1px solid #e2e8f0;
}

.purchase-invoice-page .purchase-invoice-context-bar .sale-invoice-context-meta {
  flex: 1 1 18rem;
  min-width: 0;
  margin-inline-start: 0;
  border-inline-start: none;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.4rem;
  overflow: visible;
}

.purchase-invoice-page .sale-invoice-context-meta .sale-meta-compact-item--customer {
  flex: 1 1 11rem;
  width: auto;
  max-width: 18rem;
  min-width: 9rem;
}

.purchase-invoice-page .sale-meta-compact-item--warehouse {
  flex: 0 1 auto;
  min-width: 9rem;
  max-width: 14rem;
}

.purchase-invoice-page .sale-meta-compact-item--warehouse .sale-input--compact {
  min-width: 7.5rem;
  max-width: 11rem;
}

.purchase-invoice-page .sale-invoice-context-meta .customer-picker {
  position: relative;
  width: 100%;
  min-width: 0;
}

.purchase-invoice-page .sale-invoice-context-meta .customer-suggestions {
  z-index: 90;
}

.purchase-invoice-page .purchase-context-notes {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
}

.purchase-invoice-page .purchase-context-notes textarea {
  width: 100%;
  min-height: 2rem;
  max-width: 100%;
  resize: vertical;
}

@media (min-width: 900px) {
  .purchase-invoice-page .purchase-invoice-context-bar {
    flex-wrap: nowrap;
  }

  .purchase-invoice-page .purchase-invoice-context-bar .sale-invoice-context-nav {
    border-bottom: none;
  }

  .purchase-invoice-page .purchase-invoice-context-bar .sale-invoice-context-meta {
    border-bottom: none;
    border-inline-start: 1px solid #d5e3f0;
  }

  .purchase-invoice-page .purchase-context-notes {
    flex: 1 1 8rem;
    max-width: 16rem;
  }
}

.purchase-invoice-page .sale-lines-toolbar-total-value {
  color: #15803d;
}

.purchase-invoice-page .inventory-picker-price--cost .inventory-picker-price-value {
  font-weight: 700;
}

.invoice-quick-item-flow-hint {
  margin-top: -0.35rem;
}

.invoice-quick-item-dialog .modal-header {
  padding: 0.7rem 1rem;
}

.invoice-quick-item-dialog .modal-header h2 {
  font-size: 1.05rem;
}

.invoice-quick-item-hint,
.invoice-quick-item-settings-hint,
.invoice-quick-item-line-hint {
  margin: 0.2rem 1rem 0;
  font-size: 0.76rem;
  line-height: 1.35;
}

.invoice-quick-item-line-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.55rem;
  margin: 0.15rem 1rem 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: #f0f7ff;
  border: 1px solid #d5e3f0;
}

.invoice-quick-item-line-total-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e3a5f;
}

.invoice-quick-item-line-total-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.invoice-quick-item-settings-hint {
  margin-bottom: 0.15rem;
}

.invoice-quick-item-dialog .form-grid {
  padding: 0.55rem 1rem;
  gap: 0.45rem 0.65rem;
}

.invoice-quick-item-dialog .form-grid label {
  gap: 0.2rem;
  font-size: 0.8rem;
}

.invoice-quick-item-dialog .form-grid input,
.invoice-quick-item-dialog .form-grid select,
.invoice-quick-item-dialog .searchable-select-input {
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.invoice-quick-item-dialog .searchable-select {
  min-width: 0;
  max-width: 100%;
}

.invoice-quick-item-grid--card {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.invoice-quick-item-grid--line {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: 0;
  padding-bottom: 0.35rem;
}

.invoice-quick-item-grid--prices {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 0;
  padding-bottom: 0.15rem;
}

.invoice-quick-item-dialog[data-invoice-mode="purchase"] .invoice-quick-item-grid--prices label {
  font-size: 0.82rem;
}

.invoice-quick-item-section {
  margin-bottom: 0.35rem;
}

.invoice-quick-item-section-title {
  margin: 0 0 0.25rem;
  padding: 0 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary);
}

.invoice-quick-item-section--line {
  padding-top: 0.35rem;
  border-top: 1px solid #e8edf2;
}

.invoice-quick-item-grid {
  gap: 0.45rem 0.65rem;
}

.form-readonly-value {
  display: block;
  padding: 0.45rem 0.55rem;
  background: #f3f6f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--color-text, #1e293b);
}

.form-readonly-field,
.invoice-quick-item-info-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.form-readonly-label,
.invoice-quick-item-info-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
}

.invoice-quick-item-info-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.inventory-card-row--cost {
  margin-top: 0.15rem;
}

.item-cell--warehouse {
  min-width: 0;
  max-width: 100%;
}

.warehouse-page .table-wrap--wide {
  overflow-x: hidden;
}

.warehouse-page .inventory-table-wrap {
  overflow-x: hidden;
}

.warehouse-page #inventory-table.data-table--compact th,
.warehouse-page #inventory-table.data-table--compact td {
  padding: 0.35rem 0.15rem;
}

.warehouse-page #inventory-table.data-table--compact th.col-item,
.warehouse-page #inventory-table.data-table--compact td.col-item {
  padding: 0.4rem 0.4rem;
}

.warehouse-page #inventory-table thead th {
  font-size: 0.74rem;
  padding-block: 0.4rem;
}

#inventory-table .inventory-qty-num {
  font-size: 0.82rem;
}

#inventory-table .inventory-qty-status {
  font-size: 0.62rem;
  padding: 0 0.2rem;
}

.item-cell-badges--compact {
  margin-bottom: 0.2rem;
}

.item-cell-name--clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
  font-size: 0.88rem;
  word-break: break-word;
}

.inventory-data-row {
  cursor: pointer;
}

.inventory-data-row.is-selected {
  background: #eff6ff;
  outline: 1px solid #93c5fd;
  outline-offset: -1px;
}

.inventory-data-row:focus-visible {
  outline: 1px solid var(--color-primary);
  outline-offset: -1px;
}

.warehouse-page-hint {
  margin: 0 0 0.75rem;
}

.warehouse-page-hint kbd,
.page-header-actions kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #f8fafc;
  font-size: 0.75rem;
  font-family: inherit;
}

#item-search-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#item-search-table th.col-item,
#item-search-table td.col-item {
  width: 30%;
  min-width: 8rem;
  padding-inline: 0.4rem;
}

#item-search-table th.col-meta,
#item-search-table td.col-meta {
  width: 3.85rem;
  min-width: 0;
  max-width: 3.85rem;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  padding-inline: 0.15rem;
}

#item-search-table th.col-storage-location,
#item-search-table td.col-storage-location {
  width: 5.5rem;
  min-width: 0;
  max-width: 5.5rem;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  padding-inline: 0.15rem;
}

#item-search-table th.col-qty,
#item-search-table td.col-qty {
  width: 6.5rem;
  min-width: 0;
  max-width: 6.5rem;
  padding-inline: 0.25rem;
  text-align: right;
  vertical-align: middle;
}

#item-search-table th.col-supply-status,
#item-search-table td.col-supply-status {
  width: 6.75rem;
  min-width: 0;
  max-width: 6.75rem;
  padding-inline: 0.15rem;
}

#item-search-table th.col-transfer-status,
#item-search-table td.col-transfer-status {
  width: 7.1rem;
  min-width: 0;
  max-width: 7.1rem;
  padding-inline: 0.15rem;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

#item-search-table th.col-price,
#item-search-table td.col-price {
  width: 3.35rem;
  min-width: 0;
  max-width: 3.35rem;
  white-space: nowrap;
  box-sizing: border-box;
  font-size: 0.72rem;
  padding-inline: 0.1rem;
}

#item-search-table th.col-actions,
#item-search-table td.col-actions {
  width: 2.4rem;
  min-width: 2.4rem;
  max-width: 2.4rem;
  padding: 0.15rem;
  text-align: center;
}

.item-search-qty-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  align-items: flex-start;
  line-height: 1.25;
}

.item-search-qty-line {
  font-size: 0.72rem;
  color: var(--color-text);
  white-space: nowrap;
}

.item-search-qty-wh {
  color: var(--color-text-muted);
}

.item-search-qty-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.item-search-qty-empty {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.item-search-page .inventory-card-row--qty {
  align-items: flex-start;
}

.item-search-page .item-search-qty-breakdown {
  width: 100%;
}

#item-search-name-dialog {
  max-width: min(720px, calc(100vw - 2rem));
}

#item-search-name-dialog .modal-header h2 {
  font-size: 1.25rem;
}

#item-search-name-dialog .modal-footer .btn {
  font-size: 0.95rem;
}

.item-search-name-body {
  padding: 1.25rem;
}

.item-search-name-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  font-size: 0.95rem;
  font-weight: 500;
}

.item-search-name-field input {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  font-size: 1.05rem;
}

#item-search-name-dialog .item-search-name-body .stock-adjustment-dialog-error {
  margin: 0.75rem 0 0;
}

.inventory-card-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
}

.invoice-quick-item-dialog .modal-footer {
  padding: 0.6rem 1rem;
}

.invoice-quick-item-error {
  margin: 0.2rem 1rem 0;
  color: #b91c1c;
  font-size: 0.82rem;
}

.invoice-quick-item-dialog .input-numeric-wide,
.invoice-quick-item-dialog #quick-item-cost,
.invoice-quick-item-dialog #quick-item-wholesale,
.invoice-quick-item-dialog #quick-item-bulk-wholesale,
.invoice-quick-item-dialog #quick-item-retail,
.invoice-quick-item-dialog #quick-item-qty,
.invoice-quick-item-dialog #quick-item-line-price {
  width: 100%;
  min-width: 0;
  max-width: none;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .invoice-quick-item-grid--card,
  .invoice-quick-item-grid--line,
  .invoice-quick-item-grid--prices {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .invoice-quick-item-grid--card,
  .invoice-quick-item-grid--line,
  .invoice-quick-item-grid--prices {
    grid-template-columns: 1fr;
  }
}

.crud-modal .modal-footer .btn-danger {
  min-width: 5.5rem;
}

#modal-item #item-cost,
#modal-item #item-wholesale,
#modal-item #item-bulk-wholesale,
#modal-item #item-retail {
  width: 100%;
  min-width: calc(6ch + 1.5rem);
  max-width: 11rem;
  font-variant-numeric: tabular-nums;
}

.purchase-invoice-page .sale-line-wh-select {
  max-width: 9rem;
  font-size: 0.78rem;
  padding: 0.15rem 0.35rem;
}

.purchase-split-viewport {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.purchase-split-viewport--readonly {
  grid-template-columns: minmax(14rem, 22rem) 1fr;
}

@media (max-width: 900px) {
  .purchase-split-viewport--readonly {
    grid-template-columns: 1fr;
  }
}

.purchase-invoice-main {
  min-width: 0;
}

.purchase-meta-bar {
  margin-bottom: 0.85rem;
}

.purchase-notes-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.5rem;
}

.purchase-supplier-field {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.purchase-supplier-picker {
  position: relative;
  width: 100%;
}

.purchase-item-search-row {
  margin-bottom: 0.65rem;
}

.purchase-lines-wrap {
  margin-bottom: 0.75rem;
}

.purchase-form-actions {
  margin-top: 0.75rem;
}

.purchase-return-page .sale-return-meta-bar {
  margin-bottom: 0.75rem;
}

.is-inactive-row {
  opacity: 0.55;
}

/* —— طلب التوريد —— */
.supply-request-page {
  --supply-request-chrome-height: 12rem;
}

.supply-request-page:not(.is-ready) .supply-request-table-scroller {
  opacity: 0.55;
}

.supply-request-page.is-ready .supply-request-table-scroller {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.supply-request-data-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.35rem;
}

.supply-request-search-row {
  background: #f8fbff;
}

.supply-request-search-row:hover {
  background: #eff6ff;
}

.supply-request-search-badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

.supply-request-search-badge--draft {
  background: #e2e8f0;
  color: #475569;
}

.supply-request-search-badge--active {
  background: #dbeafe;
  color: #1d4ed8;
}

.supply-request-sticky-bar {
  position: sticky;
  top: var(--app-header-height, 7.35rem);
  z-index: 35;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0 0.65rem;
  background: var(--color-bg);
  box-shadow: 0 8px 16px -12px rgba(15, 23, 42, 0.28);
  overflow: visible;
}

.supply-request-sticky-bar .page-header {
  margin-bottom: 0.75rem;
}

.supply-request-sticky-bar .supply-request-tabs {
  margin-bottom: 0.65rem;
}

.supply-request-sticky-bar .supply-request-toolbar,
.supply-request-sticky-bar .supply-request-stage-toolbar,
.supply-request-sticky-bar .supply-request-filter {
  margin-bottom: 0;
}

.supply-request-page .supply-request-table-scroller {
  position: relative;
  max-height: calc(
    100dvh - var(--app-header-height, 7.35rem) - var(--supply-request-chrome-height, 12rem) - 1.75rem
  );
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.supply-request-table-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.supply-request-table-loading[hidden] {
  display: none !important;
}

.supply-request-table-loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  min-width: 8.5rem;
  padding: 1rem 1.35rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.12);
}

.supply-request-table-loading-message {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary-dark, #1e3a5f);
  text-align: center;
}

.supply-request-table-scroller.is-table-loading .supply-request-table tbody {
  opacity: 0.55;
  pointer-events: none;
}

#supply-request-draft-tbody.is-draft-stale .supply-request-draft-row {
  opacity: 0.72;
  transition: opacity 0.12s ease;
}

.supply-request-draft-loading-more td {
  color: var(--color-text-muted, #64748b);
  font-size: 0.875rem;
  padding-block: 0.65rem;
}

.supply-request-page .supply-request-table-scroller--card {
  max-height: min(42dvh, 24rem);
}

.supply-request-page .supply-request-table-scroller .table-wrap {
  overflow: visible;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 769px) {
  .supply-request-page .supply-request-table-scroller .supply-request-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .supply-request-page .supply-request-table-scroller .supply-request-table thead {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef2f7;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  }

  .supply-request-page .supply-request-table-scroller .supply-request-table thead tr {
    background: #eef2f7;
  }

  .supply-request-page .supply-request-table-scroller .supply-request-table thead th {
    background: #eef2f7 !important;
    border-bottom: 1px solid var(--color-border);
  }

  .supply-request-page .supply-request-table-scroller .supply-request-table thead th.col-actions {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #eef2f7 !important;
  }
}

.supply-request-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
  padding: 0;
  border-bottom: 2px solid #e2e8f0;
}

.supply-request-tabs-stages {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0;
  min-width: 0;
}

.supply-request-tab-arrow {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
  padding: 0 0.2rem;
  margin-bottom: 0.35rem;
  color: #94a3b8;
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
}

.supply-request-tab-arrow .ui-icon {
  width: 14px;
  height: 14px;
}

.supply-request-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem 0.6rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.supply-request-tab:hover {
  background: #f8fafc;
  color: var(--color-primary-dark);
}

.supply-request-tab.is-active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}

.supply-request-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
}

.supply-request-tab.is-active .supply-request-tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.supply-request-tab--excluded {
  flex-shrink: 0;
  margin-inline-start: auto;
  color: #b91c1c;
}

.supply-request-tab--excluded:hover {
  background: #fef2f2;
  color: #991b1b;
}

.supply-request-tab--excluded.is-active {
  color: #991b1b;
  border-bottom-color: #f87171;
  background: #fef2f2;
}

.supply-request-tab--excluded .supply-request-tab-count {
  background: #fee2e2;
  color: #b91c1c;
}

.supply-request-tab--excluded.is-active .supply-request-tab-count {
  background: #fecaca;
  color: #991b1b;
}

.supply-request-sort-th {
  padding: 0;
  vertical-align: bottom;
}

.supply-request-sort-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  width: 100%;
  min-height: 100%;
  padding: 0.55rem 1rem 0.6rem;
  margin-bottom: -2px;
  border-bottom: 3px solid transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.col-num.supply-request-sort-th .supply-request-sort-link {
  justify-content: flex-end;
}

.supply-request-sort-link:hover {
  background: #f8fafc;
  color: var(--color-primary-dark);
}

.supply-request-sort-link.is-active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}

.supply-request-sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.85rem;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1;
}

.supply-request-sort-link.is-active .supply-request-sort-indicator {
  color: var(--color-primary);
  font-weight: 700;
}

.supply-request-col-header {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100%;
}

.supply-request-col-header .supply-request-sort-link {
  flex: 1 1 auto;
  min-width: 0;
}

.supply-request-col-header--filterable.has-manufacturer-filter {
  box-shadow: inset 0 -3px 0 rgba(59, 130, 246, 0.35);
}

.supply-request-col-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: stretch;
  width: 1.65rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline-start: 1px solid #e2e8f0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.supply-request-col-filter-btn:hover {
  background: #f8fafc;
  color: var(--color-primary-dark);
}

.supply-request-col-filter-btn.is-active {
  color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
}

.supply-request-col-filter-btn .ui-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.supply-request-manufacturer-filter-popover {
  position: fixed;
  z-index: 1200;
  width: min(16rem, calc(100vw - 1rem));
  max-height: min(18rem, calc(100vh - 6rem));
  overflow: auto;
  padding: 0.45rem 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.supply-request-manufacturer-filter-head {
  padding: 0.35rem 0.65rem 0.45rem;
  border-bottom: 1px solid #f1f5f9;
}

.supply-request-manufacturer-filter-select-all-wrap,
.supply-request-manufacturer-filter-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.supply-request-manufacturer-filter-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.supply-request-manufacturer-filter-list li {
  margin: 0;
}

.supply-request-manufacturer-filter-option {
  padding: 0.35rem 0.65rem;
  transition: background 0.12s;
}

.supply-request-manufacturer-filter-option:hover {
  background: #f8fafc;
}

.supply-request-manufacturer-filter-option-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-request-manufacturer-filter-option-count {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.75rem;
}

.supply-request-table {
  table-layout: fixed;
  width: 100%;
}

.supply-request-table th,
.supply-request-table td {
  padding: 0.42rem 0.32rem;
  vertical-align: middle;
  line-height: 1.35;
}

.supply-request-table .supply-request-sort-link {
  padding: 0.38rem 0.28rem 0.42rem;
  gap: 0.15rem;
  font-size: 0.78rem;
}

.supply-request-table .supply-request-sort-indicator {
  min-width: 0.55rem;
  font-size: 0.62rem;
  flex-shrink: 0;
}

.supply-request-table col.col-check {
  width: 2.2rem;
}

.supply-request-table col.col-code {
  width: 2.6rem;
}

.supply-request-table col.col-part {
  width: 4.6rem;
}

.supply-request-table col.col-item-name {
  width: 28%;
}

.supply-request-table col.col-manufacturer {
  width: 5.5rem;
}

.supply-request-table col.col-supplier {
  width: 5.2rem;
}

.supply-request-table col.col-cost {
  width: 4rem;
}

.supply-request-table col.col-rmb {
  width: 4rem;
}

.supply-request-table col.col-qty {
  width: 2.9rem;
}

.supply-request-rmb-dialog.supply-request-dialog,
.supply-request-rmb-dialog.crud-modal {
  max-width: min(780px, calc(100vw - 1.5rem));
  width: calc(100% - 1.5rem);
}

.supply-request-rmb-body {
  max-height: min(60vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
}

.supply-request-rmb-body .table-wrap {
  overflow-x: hidden;
}

.supply-request-rmb-table {
  width: 100%;
  table-layout: fixed;
}

.supply-request-rmb-table th,
.supply-request-rmb-table td {
  padding: 0.45rem 0.55rem;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  vertical-align: middle;
}

.supply-request-rmb-table .col-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.supply-request-table col.col-supply-status {
  width: 6.75rem;
}

.supply-request-table col.col-status {
  width: 4.2rem;
}

.supply-request-table col.col-total {
  width: 4.2rem;
}

.supply-request-table col.col-notes {
  width: 7rem;
}

.supply-request-table col.col-datetime {
  width: 7rem;
}

.supply-request-table col.col-actions {
  width: 10rem;
}

.supply-request-table col.col-warehouse {
  width: 9rem;
}

.supply-request-excluded-table col.col-item-name,
.supply-request-table--transfer col.col-item-name {
  width: 40%;
}

.supply-request-table--transfer .supply-request-wh-select {
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
  padding: 0.3rem 0.35rem;
}

.supply-request-table .col-code,
.supply-request-table td.col-code {
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-request-table .col-part,
.supply-request-table td.col-part {
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-request-table td.supply-request-copy-cell {
  cursor: copy;
  user-select: none;
}

.supply-request-table td.supply-request-copy-cell:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--color-primary-dark);
}

.supply-request-table td.supply-request-copy-cell:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.supply-request-table td.supply-request-copy-cell.is-copy-flash {
  animation: supply-request-copy-flash 0.55s ease;
}

@keyframes supply-request-copy-flash {
  0%, 40% {
    background: rgba(34, 197, 94, 0.24);
  }
  100% {
    background: transparent;
  }
}

.supply-request-table .col-supplier,
.supply-request-table td.col-supplier {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-request-table .col-manufacturer,
.supply-request-table td.col-manufacturer {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-request-table td.col-item-name {
  font-size: 0.82rem;
  vertical-align: middle;
}

.supply-request-table td.col-item-name .supply-item-name-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  font-weight: 600;
  line-height: 1.35;
}

.supply-request-table td.col-item-name strong.supply-item-name-text {
  font-weight: 600;
}

.supply-request-table .col-num,
.supply-request-table td.col-num {
  font-size: 0.78rem;
  padding-inline: 0.2rem;
}

.supply-request-table .col-datetime,
.supply-request-table td.col-datetime {
  font-size: 0.72rem;
  white-space: nowrap;
}

.supply-request-table .inventory-qty-status {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.32rem;
  white-space: nowrap;
}

.supply-request-table .inventory-qty-num {
  font-weight: 700;
}

.supply-request-table .inventory-qty-num--qty-out {
  color: #991b1b;
}

.supply-request-table .inventory-qty-num--qty-low {
  color: #92400e;
}

.supply-request-table .inventory-qty-num--qty-ok {
  color: #166534;
}

.supply-request-table th.col-supply-status,
.supply-request-table td.col-supply-status {
  min-width: 0;
  max-width: 6.75rem;
  padding-inline: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.supply-request-table th.col-supply-status {
  white-space: nowrap;
  font-size: 0.74rem;
  line-height: 1.2;
}

.supply-request-table .supply-status-lines {
  gap: 0.15rem;
}

.supply-request-table .supply-status-line {
  font-size: 0.58rem;
  padding: 0.06rem 0.22rem;
}

.supply-request-table th.col-actions,
.supply-request-table td.col-actions {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 10rem;
  width: 10rem;
  padding-inline: 0.35rem;
  border-inline-start: 1px solid var(--color-border);
  box-shadow: none;
}

.supply-request-table thead th.col-actions {
  z-index: 3;
  background: #eef2f7 !important;
  border-inline-start: 1px solid var(--color-border);
}

.supply-request-page .supply-request-table tbody td.col-actions {
  z-index: 1;
  background: var(--color-surface);
}

.supply-request-table .table-action-btn {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 5px;
  flex-shrink: 0;
}

.supply-request-table .table-action-btn .ui-icon {
  width: 14px;
  height: 14px;
}

.supply-request-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #f8fafc;
}

.supply-request-toolbar--draft {
  padding: 0.45rem 0.65rem;
  gap: 0;
}

.supply-request-toolbar--draft .supply-request-toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

.supply-request-toolbar--draft .supply-request-bulk-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.supply-request-toolbar--draft .supply-request-toolbar-sep {
  flex: 0 0 1px;
  align-self: stretch;
  width: 1px;
  min-height: 1.75rem;
  margin-inline: 0.15rem;
  background: #dbe3ee;
}

.supply-request-toolbar--draft .supply-request-stock-select {
  min-width: 7.25rem;
  max-width: 9rem;
  height: 2rem;
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
}

.supply-request-toolbar--draft .supply-request-bulk-group .supply-request-filter {
  margin-bottom: 0;
  gap: 0.35rem;
  flex-wrap: nowrap;
  align-items: center;
}

.supply-request-toolbar--draft .supply-request-bulk-group .supply-request-filter-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.supply-request-toolbar--draft .supply-request-bulk-group .supply-request-filter-select {
  min-width: 7.5rem;
  max-width: 10rem;
  height: 2rem;
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
}

.supply-request-toolbar--draft .supply-request-bulk-group .supply-request-filter .btn-sm {
  height: 2rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.supply-request-toolbar--draft .supply-request-bulk-buttons {
  flex-wrap: nowrap;
  gap: 0.28rem;
}

.supply-request-toolbar--draft .supply-request-bulk-buttons .btn-sm {
  height: 2rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.supply-request-toolbar--draft .supply-request-item-add {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.supply-request-toolbar--draft .supply-request-item-search-row--with-add {
  align-items: center;
  gap: 0.35rem;
}

.supply-request-toolbar--draft .supply-request-item-search {
  height: 2rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
}

.supply-request-toolbar--draft .supply-request-item-search-field {
  gap: 0;
}

.supply-request-toolbar--draft .supply-request-item-search-field--code {
  flex: 0 0 5.25rem;
  max-width: 5.25rem;
}

.supply-request-toolbar--draft .invoice-item-add-btn {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
}

@media (max-width: 960px) {
  .supply-request-toolbar--draft .supply-request-toolbar-row {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .supply-request-toolbar--draft .supply-request-toolbar-sep {
    display: none;
  }

  .supply-request-toolbar--draft .supply-request-item-add {
    flex: 1 1 100%;
  }
}

.supply-request-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.supply-request-bulk-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.supply-request-bulk-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.supply-request-stock-select {
  min-width: 180px;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.86rem;
}

.supply-request-bulk-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.supply-request-toolbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.supply-request-inline-form {
  display: inline;
}

.supply-request-item-add {
  flex: 1;
  min-width: min(100%, 320px);
  max-width: 560px;
}

.supply-request-item-add-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.supply-request-item-add-wrap {
  position: relative;
}

.supply-request-item-search-row {
  display: grid;
  grid-template-columns: 1fr minmax(96px, 120px);
  gap: 0.55rem;
  align-items: end;
  position: relative;
}

.autofill-decoys {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.supply-request-item-search-row--with-add {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.supply-request-item-search-row--with-add .supply-request-item-search-field {
  flex: 1 1 auto;
  min-width: 0;
}

.supply-request-item-search-row--with-add .supply-request-item-search-field--code {
  flex: 0 1 120px;
  max-width: 120px;
}

.supply-request-item-search-row--with-add .invoice-item-add-btn {
  flex: 0 0 auto;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(180, 130, 0, 0.45);
  border-radius: 4px;
  background: #fde047;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  color: #16a34a;
  cursor: pointer;
}

.supply-request-item-search-row--with-add .invoice-item-add-btn:hover,
.supply-request-item-search-row--with-add .invoice-item-add-btn:focus-visible {
  background: #facc15;
  border-color: rgba(161, 98, 7, 0.55);
  outline: none;
}

.supply-request-item-search-row--with-add .invoice-item-add-btn__icon {
  width: 1rem;
  height: 1rem;
}

.supply-request-item-search-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.supply-request-item-search-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.supply-request-item-search {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.88rem;
}

.supply-request-item-search-field--code .supply-request-item-search {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.supply-request-item-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.supply-request-item-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.supply-request-item-list-entry--exists {
  background: #f8fafc;
}

.supply-request-item-list-entry--repeat {
  background: #f0fdf4;
}

.supply-request-item-pick {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  text-align: start;
  font-size: 0.84rem;
  line-height: 1.35;
  cursor: pointer;
}

.supply-request-item-pick:not(.supply-request-item-pick--exists) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.supply-request-item-pick:hover {
  background: #f1f5f9;
}

.supply-request-item-list-entry.is-selected > .supply-request-item-pick {
  background: rgba(59, 130, 246, 0.08);
}

.supply-request-item-list-entry.is-selected > .supply-request-item-pick:hover {
  background: rgba(59, 130, 246, 0.11);
}

.supply-request-item-pick--exists {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  color: #334155;
}

.supply-request-item-pick--exists:hover {
  background: #eef2ff;
}

.supply-request-item-pick--repeat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  color: #334155;
}

.supply-request-item-pick--repeat:hover {
  background: #dcfce7;
}

.supply-request-item-stage-badge--info {
  background: #dbeafe;
  color: #1d4ed8;
}

.supply-request-item-repeat-hint {
  flex-shrink: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.supply-request-item-exists-main {
  min-width: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.supply-request-item-stage-badge {
  flex-shrink: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.supply-request-item-list-entry--exists + .supply-request-item-list-entry--exists,
.supply-request-item-list-entry + .supply-request-item-list-entry--exists {
  border-top: 1px solid #eef2f7;
}

.supply-request-item-pick-code {
  color: #64748b;
  font-size: 0.78rem;
}

.supply-request-item-empty {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.82rem;
  color: #64748b;
}

.supply-request-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.supply-request-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.supply-request-stage-toolbar .supply-request-filter {
  margin-bottom: 0;
}

.supply-request-stage-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.supply-request-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.supply-request-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.supply-request-filter-select {
  min-width: 220px;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
}

.supply-request-shipping-suppliers {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.supply-request-supplier-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
  overflow: hidden;
}

.supply-request-supplier-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.supply-request-supplier-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.supply-request-supplier-card-count {
  margin-inline-start: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.supply-request-notice {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.86rem;
}

.supply-request-notice--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.supply-request-dialog {
  max-width: 460px;
}

.supply-request-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.25rem;
}

.supply-request-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.supply-request-dialog-field .form-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #475569;
}

.supply-request-dialog-field .form-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.92rem;
}

.supply-request-qty-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.supply-request-dialog-item-card {
  padding: 0.65rem 0.75rem;
  border-radius: 0.45rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.supply-request-dialog-item-card--supplier {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.supply-request-dialog-item-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.supply-request-dialog-item,
.supply-request-dialog-supplier {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.45;
}

.supply-request-dialog-item-summary {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.supply-request-dialog-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.supply-request-dialog-item-meta-item strong {
  color: #334155;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.supply-request-dialog-item-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.45;
}

.supply-request-dialog-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.55;
}

.supply-request-dialog-error {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.4rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.82rem;
}

.form-required {
  color: #dc2626;
}

.supply-request-dialog .modal-footer .btn-outline {
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.supply-request-dialog .modal-footer .btn-outline:hover {
  background: var(--color-bg);
  color: var(--color-primary-light);
}

.supply-request-transfer-lines .supply-request-table--transfer {
  width: 100%;
}

.supply-request-transfer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin: 0.35rem 0 0.25rem;
}

.supply-request-transfer-select-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.supply-request-transfer-selected-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.supply-request-table--transfer col.col-check {
  width: 2.1rem;
}

.supply-request-table--transfer .col-check {
  text-align: center;
  vertical-align: middle;
}

.supply-request-supplier-card .col-check {
  width: 2.1rem;
  text-align: center;
  vertical-align: middle;
}

.supply-request-transfer-one-btn {
  min-width: 2rem;
}

.supply-request-table--transfer tr.is-transfer-deselected {
  opacity: 0.55;
}

.supply-request-table--transfer tr.is-transfer-deselected .supply-request-wh-select,
.supply-request-table--transfer tr.is-transfer-deselected .supply-request-transfer-rmb {
  background: #f1f5f9;
}

.supply-request-draft-rows-summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
}

.supply-request-draft-rows-summary-label {
  font-weight: 600;
}

.supply-request-draft-rows-summary-value {
  font-weight: 700;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
}

.supply-request-bulk-move-order-dialog {
  width: min(78rem, calc(100vw - 1.5rem));
  max-width: min(78rem, calc(100vw - 1.5rem));
  overflow-x: hidden;
}

.supply-request-bulk-move-order-dialog.supply-request-dialog {
  max-width: min(78rem, calc(100vw - 1.5rem));
}

.supply-request-bulk-move-order-dialog .modal-body {
  overflow-x: hidden;
}

.supply-request-bulk-move-order-lines {
  max-height: min(50vh, 24rem);
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 0.35rem;
}

.supply-request-bulk-move-order-lines .table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
}

.supply-request-bulk-move-order-lines .supply-request-table--bulk-move {
  width: 100%;
  table-layout: fixed;
}

.supply-request-table--bulk-move col.col-code {
  width: 2.6rem;
}

.supply-request-table--bulk-move col.col-part {
  width: 4.6rem;
}

.supply-request-table--bulk-move col.col-item-name {
  width: 38%;
}

.supply-request-table--bulk-move col.col-supply-status {
  width: 6.25rem;
}

.supply-request-table--bulk-move col.col-stock-qty {
  width: 3.4rem;
}

.supply-request-table--bulk-move col.col-qty {
  width: 4.25rem;
}

.supply-request-table--bulk-move .col-item-name {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  vertical-align: middle;
  font-size: 0.82rem;
}

.supply-request-table--bulk-move .col-item-name .supply-item-name-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.35;
  font-weight: 600;
  white-space: normal;
  text-overflow: unset;
}

.supply-request-table--bulk-move .col-part .supply-bulk-move-part-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-request-table--bulk-move td.col-supply-status {
  min-width: 0;
  max-width: none;
  padding-inline: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.supply-request-table--bulk-move .supply-status-lines {
  gap: 0.15rem;
}

.supply-request-table--bulk-move .supply-status-line {
  font-size: 0.58rem;
  padding: 0.06rem 0.22rem;
}

.supply-request-table--bulk-move .supply-request-bulk-move-qty {
  width: 100%;
  max-width: 3.75rem;
  min-width: 3.25rem;
  box-sizing: border-box;
  padding-inline: 0.3rem;
}

.supply-request-table--bulk-move th.col-stock-qty,
.supply-request-table--bulk-move td.col-stock-qty {
  text-align: center;
  padding-inline: 0.15rem;
  vertical-align: middle;
}

.supply-request-table--bulk-move th.col-stock-qty {
  font-size: 0.68rem;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.supply-request-table--bulk-move td.col-stock-qty .inventory-qty-num {
  font-size: 0.78rem;
}

.supply-request-table--bulk-advance-order col.col-supplier {
  width: 4.8rem;
}

.supply-request-table--bulk-advance-order col.col-item-name {
  width: 34%;
}

.supply-request-table--bulk-advance-order .col-supplier .supply-bulk-move-supplier-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
}

.supply-request-bulk-advance-order-dialog.supply-request-bulk-move-order-dialog {
  width: min(82rem, calc(100vw - 1.5rem));
  max-width: min(82rem, calc(100vw - 1.5rem));
}

.supply-request-bulk-advance-order-dialog.supply-request-bulk-move-order-dialog.supply-request-dialog {
  max-width: min(82rem, calc(100vw - 1.5rem));
}

.supply-request-transfer-table .supply-request-wh-select,
.supply-request-table--transfer .supply-request-wh-select {
  min-width: 0;
}

.supply-request-table--transfer col.col-rmb {
  width: 5.2rem;
}

.supply-request-table--transfer .supply-request-transfer-rmb {
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
  padding: 0.3rem 0.35rem;
  text-align: center;
}

.btn-danger-text {
  color: #b91c1c;
}

.supply-request-supplier-card--warn {
  border-color: #fde68a;
}

.supply-request-supplier-card--warn .supply-request-supplier-card-head {
  background: #fffbeb;
}

.supply-request-supplier-card--warn .supply-request-notice {
  margin: 0 1rem;
}

.supply-request-log-dialog {
  width: min(32rem, 96vw);
}

.supply-request-log-dialog-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  font-weight: 400;
}

.supply-request-log-dialog-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  line-height: 1.45;
}

.supply-request-table .table-action-group {
  flex-wrap: nowrap;
  gap: 0.18rem;
}

.supply-request-data-row.is-selected > td.col-actions {
  background: rgba(59, 130, 246, 0.08);
}

.supply-request-data-row.is-selected.is-highlight-flash > td.col-actions {
  background: rgba(59, 130, 246, 0.12);
}

.supply-request-table .supply-request-line-notes-cell {
  max-width: none;
  vertical-align: middle;
  font-size: 0.78rem;
}

.supply-request-table .supply-request-line-notes-cell .supply-line-notes-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.supply-request-table .col-check {
  width: 2.75rem;
  text-align: center;
  vertical-align: middle;
}

.supply-request-table .col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
}

.supply-request-line-notes-cell {
  max-width: 14rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  color: var(--color-text-muted, #64748b);
}

.supply-request-supplier-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.supply-request-excluded-hint {
  margin: 0 0 0.75rem;
  max-width: 42rem;
}

.supply-request-excluded-toolbar .supply-request-item-add {
  margin-top: 0;
}

.supply-request-excluded-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.supply-request-excluded-toolbar-actions {
  flex: 0 0 auto;
}

.supply-request-data-row {
  cursor: pointer;
}

.supply-request-data-row.is-selected > td {
  background: rgba(59, 130, 246, 0.08);
}

@keyframes supply-request-row-highlight {
  0%, 35% {
    background-color: rgba(245, 158, 11, 0.22);
  }
  100% {
    background-color: transparent;
  }
}

.supply-request-data-row.is-highlight-flash > td {
  animation: supply-request-row-highlight 2.5s ease-out;
}

.supply-request-data-row.is-selected.is-highlight-flash > td {
  animation: none;
  background: rgba(59, 130, 246, 0.12);
}

.supply-request-data-row:focus {
  outline: none;
}

.supply-request-data-row:focus-visible:not(.is-selected) > td {
  background: rgba(59, 130, 246, 0.05);
}

.supply-request-item-log-body {
  max-height: min(50vh, 24rem);
  overflow: auto;
}

.supply-request-item-log-empty,
.supply-request-item-log-loading,
.supply-request-item-log-error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}

.supply-request-item-log-error {
  color: #b91c1c;
}

.supply-request-item-log-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.supply-request-item-log-entry {
  position: relative;
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  gap: 0.75rem;
  padding-bottom: 1.25rem;
}

.supply-request-item-log-entry:not(.is-last)::before {
  content: '';
  position: absolute;
  top: 0.75rem;
  right: 0.5625rem;
  width: 2px;
  height: calc(100% - 0.25rem);
  background: var(--border, #e2e8f0);
}

.supply-request-item-log-entry-marker {
  position: relative;
  z-index: 1;
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.25rem;
  border-radius: 50%;
  border: 2px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
}

.supply-request-item-log-entry.is-current .supply-request-item-log-entry-marker {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.supply-request-item-log-entry-body {
  min-width: 0;
}

.supply-request-item-log-entry-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.supply-request-item-log-entry.is-current .supply-request-item-log-entry-title {
  color: var(--primary, #2563eb);
}

.supply-request-item-log-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
}

.supply-request-item-log-qty,
.supply-request-item-log-supplier,
.supply-request-item-log-user {
  white-space: nowrap;
}

.supply-request-item-log-notes {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
}

.items-excel-page .items-excel-card {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
}

.items-excel-card-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.items-excel-card-desc {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.items-excel-card-meta {
  color: var(--color-text);
  font-weight: 600;
}

.items-excel-card--supply-exclude {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff 0%, #fffbfb 100%);
}

.items-excel-card--transfer {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.items-excel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.items-excel-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.items-excel-columns-table {
  margin-top: 0.35rem;
}

.items-excel-import-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.items-excel-file-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 28rem;
}

.items-excel-file-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.items-excel-file-input {
  padding: 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.84rem;
  background: #fff;
}

.items-excel-import-notes {
  margin: 0;
  padding-inline-start: 1.15rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.items-excel-import-notes li + li {
  margin-top: 0.35rem;
}

.suppliers-import-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.suppliers-import-panel {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #f8fafc;
}

.suppliers-import-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.suppliers-import-desc {
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.suppliers-import-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.suppliers-import-file-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 28rem;
}

.suppliers-import-file-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.suppliers-import-file-input {
  padding: 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.84rem;
  background: #fff;
}

.suppliers-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ——— الخزائن المالية (قائمة بسيطة) ——— */
.treasury-list-page {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 1.5rem;
}

.treasury-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0.15rem 0 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}

.treasury-list-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 800;
  color: var(--color-primary-dark, #1e3a5f);
  line-height: 1.25;
}

.treasury-list-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid #c7ebe3;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf9 100%);
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.06);
}

.treasury-list-total__label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
  line-height: 1.35;
}

.treasury-list-total__value {
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f766e;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.treasury-list-table-wrap {
  border: 1px solid #d5e3f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.06);
}

.treasury-list-table {
  margin: 0;
  width: 100%;
}

.treasury-list-page .treasury-list-table thead th {
  background: #eef3f8;
  border-bottom: 1px solid #d5e3f0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary-dark, #1e3a5f);
  padding: 0.7rem 0.65rem;
}

.treasury-list-page .treasury-list-table tbody td {
  padding: 0.72rem 0.65rem;
  border-bottom: 1px solid #e8eef5;
  vertical-align: middle;
}

.treasury-list-page .treasury-list-table tbody tr:last-child td {
  border-bottom: none;
}

.treasury-list-row--a {
  background: #f0fdf6;
}

.treasury-list-row--b {
  background: #fffbeb;
}

.treasury-list-page .treasury-list-table tbody tr.treasury-list-row:hover {
  filter: brightness(0.985);
}

.treasury-list-name {
  font-weight: 600;
  color: var(--color-text, #0f172a);
}

.treasury-list-balance {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary-dark, #1e3a5f);
}

.treasury-list-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  white-space: nowrap;
}

.treasury-list-page .treasury-list-table .col-actions {
  width: 1%;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .treasury-list-header {
    flex-direction: column;
    align-items: stretch;
  }

  .treasury-list-total {
    align-items: stretch;
  }
}

/* ——— الخزائن المالية (لوحة قديمة — صفحات أخرى قد تعتمد بعض الأنماط) ——— */
.treasury-dashboard-page {
  max-width: 1180px;
  margin: 0 auto;
  padding-bottom: 1.5rem;
}

.treasury-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr);
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding: 1.35rem 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 168, 56, 0.18) 0%, transparent 42%),
    linear-gradient(135deg, #152a45 0%, #1e3a5f 52%, #2d5a8e 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.treasury-dashboard-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-smooth);
}

.treasury-dashboard-back:hover {
  color: #fff;
}

.treasury-dashboard-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}

.treasury-dashboard-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 800;
}

.treasury-dashboard-subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.82);
  max-width: 34ch;
}

.treasury-dashboard-hero-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
}

.treasury-dashboard-hero-stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}

.treasury-dashboard-hero-stat-value {
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.treasury-dashboard-hero-stat-meta {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.treasury-dashboard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.treasury-dashboard-action {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 4.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth);
}

.treasury-dashboard-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #b8c9de;
  color: var(--color-text);
}

.treasury-dashboard-action--primary {
  border-color: #1e4f86;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
  color: #fff;
}

.treasury-dashboard-action--primary:hover {
  border-color: #2d5a8e;
  color: #fff;
}

.treasury-dashboard-action--primary small {
  color: rgba(255, 255, 255, 0.78);
}

.treasury-dashboard-action-icon {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f1f5f9;
  font-size: 1.1rem;
}

.treasury-dashboard-action--primary .treasury-dashboard-action-icon {
  background: rgba(255, 255, 255, 0.14);
}

.treasury-dashboard-action-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.treasury-dashboard-action-text strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.treasury-dashboard-action-text small {
  font-size: 0.74rem;
  color: var(--color-text-muted);
}

.treasury-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.treasury-dashboard-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.treasury-dashboard-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.treasury-dashboard-panel-link {
  font-size: 0.82rem;
  color: var(--color-primary-light);
  text-decoration: none;
  font-weight: 600;
}

.treasury-dashboard-panel-link:hover {
  text-decoration: underline;
}

.treasury-dashboard-wallets,
.treasury-dashboard-activity {
  padding: 1rem 1.05rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.treasury-dashboard-wallet-grid {
  display: grid;
  gap: 0.7rem;
}

.treasury-dashboard-wallet {
  padding: 0.9rem 0.95rem;
  border: 1px solid #e6edf5;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
  transition: border-color var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-fast) var(--ease-smooth);
}

.treasury-dashboard-wallet:hover {
  border-color: #c5d4e8;
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.08);
}

.treasury-dashboard-wallet-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.treasury-dashboard-wallet-icon {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #e8f0fa;
  font-size: 1.15rem;
}

.treasury-dashboard-wallet-meta h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.treasury-dashboard-wallet-type {
  display: inline-block;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.treasury-dashboard-wallet-balance {
  margin: 0 0 0.55rem;
  font-size: 1.28rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.treasury-dashboard-wallet-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-light);
  text-decoration: none;
}

.treasury-dashboard-wallet-link:hover {
  text-decoration: underline;
}

.treasury-dashboard-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 28rem;
  overflow: auto;
  padding-left: 0.1rem;
}

.treasury-dashboard-activity-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem 0.75rem;
  border: 1px solid #edf2f7;
  border-radius: var(--radius-sm);
  background: #fafcff;
  transition: background var(--dur-fast) var(--ease-smooth);
}

.treasury-dashboard-activity-item:hover {
  background: #f3f7fc;
}

.treasury-dashboard-activity-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
}

.treasury-dashboard-activity-item--in .treasury-dashboard-activity-icon {
  background: #dcfce7;
  color: #166534;
}

.treasury-dashboard-activity-item--out .treasury-dashboard-activity-icon,
.treasury-dashboard-activity-item--refund .treasury-dashboard-activity-icon {
  background: #fee2e2;
  color: #991b1b;
}

.treasury-dashboard-activity-body {
  min-width: 0;
}

.treasury-dashboard-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.treasury-dashboard-activity-row strong {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.treasury-dashboard-activity-row--meta {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.treasury-dashboard-activity-party {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treasury-dashboard-activity-amount {
  flex-shrink: 0;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.treasury-dashboard-activity-amount--in {
  color: #15803d;
}

.treasury-dashboard-activity-amount--out {
  color: #b91c1c;
}

.treasury-dashboard-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1.25rem 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.treasury-dashboard-empty--compact {
  padding: 1rem 0.35rem;
}

.treasury-dashboard-records {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.55rem;
}

.treasury-dashboard-record {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth);
}

.treasury-dashboard-record:hover {
  transform: translateY(-1px);
  border-color: #b8c9de;
  color: var(--color-primary-dark);
}

@media (max-width: 960px) {
  .treasury-dashboard-hero {
    grid-template-columns: 1fr;
  }

  .treasury-dashboard-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .treasury-dashboard-page {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .treasury-dashboard-hero {
    padding: 1rem 1.05rem;
  }

  .treasury-dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .treasury-dashboard-action {
    min-height: 3.75rem;
    padding: 0.65rem 0.7rem;
  }

  .treasury-dashboard-action-text small {
    display: none;
  }
}

/* ——— كشوفات حسابات الزبائن ——— */
.customer-accounts-page {
  max-width: 1180px;
  margin: 0 auto;
  font-family: "Traditional Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --customer-accounts-in-bg: #f0fdf4;
  --customer-accounts-in-border: #bbf7d0;
  --customer-accounts-in-text: #166534;
  --customer-accounts-out-bg: #fef2f2;
  --customer-accounts-out-border: #fecaca;
  --customer-accounts-out-text: #991b1b;
}

.customer-accounts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid #c5d3e3;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  box-shadow: var(--shadow-sm);
}

.customer-accounts-head-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  min-width: 0;
}

.customer-accounts-head h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #1e3a5f;
}

.customer-accounts-head-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.customer-accounts-head-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #dbe4f0;
  background: #fff;
}

.customer-accounts-head-stat span {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 700;
}

.customer-accounts-head-stat strong {
  font-size: 0.92rem;
  color: #0f172a;
}

.customer-accounts-head-stat--net strong {
  color: #1e3a5f;
}

.customer-accounts-back {
  display: inline-block;
  font-size: 0.78rem;
  color: #475569;
  text-decoration: none;
  font-weight: 700;
}

.customer-accounts-back:hover {
  color: #1e3a5f;
}

.customer-statement-page {
  max-width: 1180px;
  margin: 0 auto;
}

.customer-statement-page.customer-statement-ledger {
  max-width: none;
  width: 100%;
  font-family: "Traditional Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  padding-inline: 1.25rem;
  --customer-statement-width: min(900px, calc(100% - 2.5rem));
  --customer-statement-in-bg: #f0fdf4;
  --customer-statement-in-border: #bbf7d0;
  --customer-statement-in-text: #166534;
  --customer-statement-out-bg: #fef2f2;
  --customer-statement-out-border: #fecaca;
  --customer-statement-out-text: #991b1b;
}


.customer-statement-chrome .customer-accounts-back {
  color: var(--color-primary-light);
}

.customer-statement-chrome .customer-accounts-back:hover {
  color: var(--color-primary-dark);
}

.customer-statement-meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.customer-accounts-head-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.customer-accounts-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.customer-accounts-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.customer-accounts-head-btn--excel {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}

.customer-accounts-head-btn--excel:hover {
  background: #15803d;
  color: #fff;
}

.customer-accounts-head-btn--pdf {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

.customer-accounts-head-btn--pdf:hover {
  background: #b91c1c;
  color: #fff;
}

.customer-accounts-searchbar {
  margin-bottom: 0.65rem;
}

.customer-accounts-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.45rem;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.customer-accounts-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 280px;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid #dbe4f0;
  background: #f8fafc;
}

.customer-accounts-search-input-wrap:focus-within {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.customer-accounts-search-icon {
  display: inline-flex;
  color: #64748b;
  flex-shrink: 0;
}

.customer-accounts-search-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.customer-accounts-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 0.92rem;
  color: #0f172a;
  outline: none;
}

.customer-accounts-search-input::placeholder {
  color: #94a3b8;
}

.customer-accounts-search-form-actions {
  display: inline-flex;
  align-items: stretch;
  gap: 0.35rem;
}

.customer-accounts-search-btn {
  min-width: 5rem;
  padding: 0.45rem 1rem;
  border: 1px solid #1d4ed8;
  background: #2563eb;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.customer-accounts-search-btn:hover {
  background: #1d4ed8;
}

.customer-accounts-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.customer-accounts-search-clear:hover {
  background: #f8fafc;
  color: #0f172a;
}

.customer-accounts-table-wrap {
  border: 1px solid #94a3b8;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.customer-accounts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.customer-accounts-table thead th,
.customer-accounts-table tbody td {
  padding: 0.5rem 0.55rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #b8c4d4;
}

.customer-accounts-table thead th {
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.86rem;
  font-weight: 700;
}

.customer-accounts-table .col-num {
  width: 4.5%;
}

.customer-accounts-table .col-name {
  width: 20%;
}

.customer-accounts-table .col-balance {
  width: 14%;
}

.customer-accounts-table .col-last-op {
  width: 18%;
}

.customer-accounts-table .col-phone {
  width: 12%;
}

.customer-accounts-table .col-city {
  width: 12%;
}

.customer-accounts-table .col-actions {
  width: 16%;
}

.customer-accounts-last-op-cell {
  text-align: center;
}

.customer-accounts-last-op {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.45rem;
  border-radius: 0;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  max-width: 100%;
}

.customer-accounts-last-op.customer-statement-row--in {
  background: var(--customer-accounts-in-bg);
  border-color: var(--customer-accounts-in-border);
}

.customer-accounts-last-op.customer-statement-row--out {
  background: var(--customer-accounts-out-bg);
  border-color: var(--customer-accounts-out-border);
}

.customer-accounts-last-op__type {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e3a5f;
  line-height: 1.25;
  word-break: break-word;
}

.customer-accounts-last-op__date {
  font-size: 0.76rem;
  color: #64748b;
  font-weight: 600;
}

.customer-accounts-sort-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

.customer-accounts-sort-link:hover {
  color: #1d4ed8;
}

.customer-accounts-sort-link.is-active {
  color: #1d4ed8;
}

.customer-accounts-sort-indicator {
  font-size: 0.75rem;
  line-height: 1;
}

.customer-accounts-table tbody tr:hover td {
  background: #f8fafc;
}

.customer-accounts-name-cell {
  text-align: right;
}

.customer-accounts-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.customer-accounts-person-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  flex-shrink: 0;
}

.customer-accounts-person-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.customer-accounts-name-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  min-width: 0;
}

.customer-accounts-name-text strong {
  font-size: 0.95rem;
  color: #0f172a;
}

.customer-accounts-muted-cell {
  color: #64748b;
  font-size: 0.86rem;
}

.customer-accounts-balance-cell {
  white-space: nowrap;
}

.customer-accounts-balance-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 0;
  border: 1px solid transparent;
}

.customer-accounts-balance-badge__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
}

.customer-accounts-balance-badge__value {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.1;
}

.customer-accounts-balance-badge--is-debit {
  background: var(--customer-accounts-out-bg);
  border-color: var(--customer-accounts-out-border);
}

.customer-accounts-balance-badge--is-debit .customer-accounts-balance-badge__label,
.customer-accounts-balance-badge--is-debit .customer-accounts-balance-badge__value {
  color: var(--customer-accounts-out-text);
}

.customer-accounts-balance-badge--is-credit {
  background: var(--customer-accounts-in-bg);
  border-color: var(--customer-accounts-in-border);
}

.customer-accounts-balance-badge--is-credit .customer-accounts-balance-badge__label,
.customer-accounts-balance-badge--is-credit .customer-accounts-balance-badge__value {
  color: var(--customer-accounts-in-text);
}

.customer-accounts-balance-badge--is-zero {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.customer-accounts-balance-badge--is-zero .customer-accounts-balance-badge__label,
.customer-accounts-balance-badge--is-zero .customer-accounts-balance-badge__value {
  color: #475569;
}

.customer-accounts-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.customer-accounts-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: 0.22rem 0.45rem;
  border-radius: 0;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.customer-accounts-action-btn--view {
  width: 1.75rem;
  padding: 0.22rem;
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.customer-accounts-action-btn--view:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.customer-accounts-action-btn--view .ui-icon {
  width: 14px;
  height: 14px;
}

.customer-accounts-action-btn--excel {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}

.customer-accounts-action-btn--excel:hover {
  background: #15803d;
  color: #fff;
}

.customer-accounts-action-btn--pdf {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

.customer-accounts-action-btn--pdf:hover {
  background: #b91c1c;
  color: #fff;
}

.customer-accounts-print-page {
  max-width: 1120px;
  margin: 0 auto;
}

.customer-accounts-print-toolbar {
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.customer-accounts-print-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
}

.customer-accounts-print-type-badge {
  display: inline-block;
  margin-bottom: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.72rem;
  font-weight: 700;
}

.customer-accounts-print-sheet {
  background: #fff;
}

.customer-accounts-print-page {
  padding: 1rem;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.customer-accounts-print-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid #1e3a5f;
}

.customer-accounts-print-brand h1 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  color: #1e3a5f;
}

.customer-accounts-print-brand p,
.customer-accounts-print-doc p {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
}

.customer-accounts-print-doc h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: #0f172a;
}

.customer-accounts-print-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
  font-size: 0.84rem;
}

.customer-accounts-print-meta span {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
}

.customer-accounts-print-meta strong {
  color: #0f172a;
}

.customer-accounts-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.customer-accounts-print-table th,
.customer-accounts-print-table td {
  border: 1px solid #b8c4d4;
  padding: 0.4rem 0.45rem;
  text-align: center;
}

.customer-accounts-print-table th {
  background: #e8eef5;
  color: #1e3a5f;
  font-weight: 700;
}

.customer-accounts-print-empty {
  text-align: center;
  color: #64748b;
}

@media print {
  .customer-accounts-print-page .customer-accounts-print-toolbar {
    display: none !important;
  }

  .customer-accounts-print-page {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .customer-accounts-print-page .customer-accounts-print-page {
    border: none;
    padding: 0;
  }
}

.customer-accounts-balance {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.customer-accounts-balance-label {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.customer-accounts-balance--is-debit strong {
  color: #b45309;
}

.customer-accounts-balance--is-credit strong {
  color: #15803d;
}

.customer-accounts-inactive {
  display: inline-block;
  margin-inline-start: 0.35rem;
  font-size: 0.7rem;
  color: #94a3b8;
}

.customer-statement-chrome {
  width: 100%;
  max-width: var(--customer-statement-width);
  margin-inline: auto;
  margin-bottom: 0.45rem;
  padding: 0.5rem;
  border: 1px solid #c5cdd8;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}

.customer-statement-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(9.5rem, auto);
  align-items: stretch;
  gap: 0.6rem;
}

.customer-statement-panel {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  min-height: 100%;
}

.customer-statement-panel--info {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.45rem;
}

.customer-statement-info-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.customer-statement-info-line__label {
  font-size: 0.84rem;
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
}

.customer-statement-info-line__value--name {
  font-size: 1.28rem;
  font-weight: 800;
  color: #1e3a5f;
  line-height: 1.25;
  padding: 0.22rem 0.6rem;
  border-radius: 5px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
}

.customer-statement-info-line__value--balance {
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.6rem;
  border-radius: 5px;
  border: 1px solid transparent;
}

.customer-statement-info-line--balance.is-debit .customer-statement-info-line__value--balance {
  color: var(--customer-statement-out-text);
  background: var(--customer-statement-out-bg);
  border-color: var(--customer-statement-out-border);
}

.customer-statement-info-line--balance.is-credit .customer-statement-info-line__value--balance {
  color: var(--customer-statement-in-text);
  background: var(--customer-statement-in-bg);
  border-color: var(--customer-statement-in-border);
}

.customer-statement-info-line--balance.is-zero .customer-statement-info-line__value--balance {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.customer-statement-panel--filters {
  background: #fff;
}

.customer-statement-filters {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  height: 100%;
  justify-content: center;
}

.customer-statement-filters__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.customer-statement-filters__row--type {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.customer-statement-filter-type-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.05rem;
}

.customer-statement-action-btn {
  min-height: 1.85rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 700;
  justify-content: center;
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.customer-statement-action-btn--back {
  width: 100%;
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.customer-statement-action-btn--back:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.customer-statement-action-btn__icon {
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
}

.customer-statement-action-btn--excel {
  background: #16a34a;
  border: 1px solid #15803d;
  color: #fff;
}

.customer-statement-action-btn--excel:hover {
  background: #15803d;
  border-color: #166534;
  color: #fff;
}

.customer-statement-action-btn--pdf {
  background: #dc2626;
  border: 1px solid #b91c1c;
  color: #fff;
}

.customer-statement-action-btn--pdf:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.customer-statement-action-row--exports {
  grid-template-columns: 1fr 1fr auto;
}

.customer-statement-action-btn--whatsapp {
  width: auto;
  min-width: 2.1rem;
  padding-inline: 0.45rem;
  background: #25d366;
  border: 1px solid #128c7e;
  color: #fff;
}

.customer-statement-action-btn--whatsapp:hover:not(:disabled) {
  background: #1ebe57;
  border-color: #0f7a6c;
  color: #fff;
}

.customer-statement-action-btn--whatsapp .ui-icon {
  width: 1rem;
  height: 1rem;
}

.customer-statement-action-btn--whatsapp.is-busy {
  opacity: 0.7;
  cursor: wait;
}

.customer-statement-action-btn--receipt {
  background: var(--customer-statement-in-bg);
  border: 1px solid var(--customer-statement-in-border);
  color: var(--customer-statement-in-text);
}

.customer-statement-action-btn--receipt:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #86efac;
  color: #14532d;
}

.customer-statement-action-btn--refund {
  background: var(--customer-statement-out-bg);
  border: 1px solid var(--customer-statement-out-border);
  color: var(--customer-statement-out-text);
}

.customer-statement-action-btn--refund:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.customer-statement-panel--actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.customer-statement-panel--actions .btn:disabled.customer-statement-action-btn--receipt,
.customer-statement-panel--actions .btn:disabled.customer-statement-action-btn--refund {
  opacity: 0.55;
}

.customer-statement-panel--actions {
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
  min-width: 9.5rem;
}

.customer-statement-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.customer-statement-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
  min-width: 0;
}

.customer-statement-filter-item input[type="date"],
.customer-statement-filter-item select {
  width: 100%;
  padding: 0.18rem 0.35rem;
  font-size: 0.72rem;
  min-height: 1.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
}

.customer-statement-filter-item--type select {
  width: 100%;
}

.customer-statement-filter-submit,
.customer-statement-filter-reset {
  min-height: 1.65rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
}

.customer-statement-opening {
  width: 100%;
  max-width: var(--customer-statement-width);
  margin: 0 auto 0.4rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  font-size: 0.74rem;
}

.customer-statement-default-notice {
  width: 100%;
  max-width: var(--customer-statement-width);
  margin: 0 auto 0.45rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.76rem;
  line-height: 1.5;
}

.customer-statement-default-notice a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: underline;
  margin-inline-start: 0.35rem;
}

.customer-statement-default-notice--all {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.customer-statement-default-notice--all a {
  color: #15803d;
}

.customer-statement-table-wrap {
  width: 100%;
  max-width: var(--customer-statement-width);
  margin: 0 auto;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.customer-statement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}

.customer-statement-table th,
.customer-statement-table td {
  padding: 0.36rem 0.5rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #b8c4d4;
  line-height: 1.35;
}

.customer-statement-table thead th {
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.38rem 0.45rem;
}

.customer-statement-table tbody tr.customer-statement-row--in td {
  background: var(--customer-statement-in-bg);
}

.customer-statement-table tbody tr.customer-statement-row--out td {
  background: var(--customer-statement-out-bg);
}

.customer-statement-table .col-num {
  width: 5%;
}

.customer-statement-table .col-date {
  width: 13%;
  font-size: 0.86rem;
}

.customer-statement-table .col-type {
  width: 30%;
  font-size: 0.88rem;
  line-height: 1.3;
  word-break: break-word;
}

.customer-statement-table .col-money {
  white-space: nowrap;
  width: 13%;
  font-size: 0.88rem;
}

.customer-statement-table .customer-statement-col-actions {
  width: 4.5rem;
  min-width: 4.5rem;
  padding-inline: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.customer-statement-action-group {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.2rem;
}

.customer-statement-action-group .table-action-btn {
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
}

.customer-statement-action-empty {
  color: #94a3b8;
  font-size: 0.82rem;
}

.customer-statement-balance-cell {
  font-weight: 700;
  color: #1e3a5f;
  font-size: 0.9rem;
}

.customer-statement-totals th {
  background: #dce6f2;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.34rem 0.3rem;
}

.customer-statement-totals-label {
  text-align: center;
  color: #1e3a5f;
}

.customer-statement-totals-empty {
  background: #dce6f2;
}

.customer-statement-totals-value {
  font-size: 0.92rem;
  color: #0f172a;
}

@media (max-width: 900px) {
  .customer-statement-head {
    grid-template-columns: 1fr;
  }

  .customer-statement-panel--actions {
    min-width: 0;
  }

  .customer-statement-filters__row {
    grid-template-columns: 1fr;
  }

  .customer-statement-filters__row--type {
    grid-template-columns: 1fr;
  }

  .customer-statement-filter-type-actions {
    width: 100%;
  }
}

.customer-account-print-page {
  max-width: 1120px;
  margin: 0 auto;
}

.customer-account-print-toolbar {
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.customer-account-print-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
}

.customer-account-print-type-badge {
  display: inline-block;
  margin-bottom: 0.2rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #e8f0fa;
  color: var(--color-primary-dark);
  font-size: 0.74rem;
  font-weight: 700;
}

.customer-account-print-sheet {
  background: #fff;
}

.customer-account-print-page {
  padding: 1.2rem 1.35rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: #fff;
  font-family: Arial, "Segoe UI", Tahoma, sans-serif;
}

.customer-account-print-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid #1e3a5f;
}

.customer-account-print-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  color: #1e3a5f;
}

.customer-account-print-brand p,
.customer-account-print-doc p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.customer-account-print-doc {
  text-align: left;
}

.customer-account-print-doc h2 {
  margin: 0;
  font-size: 1rem;
  color: #0f172a;
}

.customer-account-print-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
}

.customer-account-print-meta span {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
}

.customer-account-print-meta strong {
  color: #0f172a;
}

.customer-account-print-opening {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
}

.customer-account-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.customer-account-print-table th,
.customer-account-print-table td {
  border: 1px solid #94a3b8;
  padding: 0.3rem 0.38rem;
  text-align: center;
  vertical-align: middle;
  line-height: 1.25;
}

.customer-account-print-table th {
  background: #e8eef5;
  font-weight: 700;
  color: #1e3a5f;
  font-size: 0.74rem;
}

.customer-account-print-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.customer-account-print-table tfoot th {
  background: #dce6f2;
  font-weight: 700;
}

.customer-account-print-totals th:last-child {
  font-size: 0.86rem;
}

.customer-account-print-empty {
  text-align: center;
  color: #64748b;
}

.customer-account-print-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
}

.customer-account-print-sign span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}

.customer-account-print-sign-line {
  height: 1px;
  background: #94a3b8;
}

@media print {
  .customer-account-print-page .customer-account-print-toolbar {
    display: none !important;
  }

  .customer-account-print-page {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .customer-account-print-page .customer-account-print-page {
    border: none;
    border-radius: 0;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .customer-accounts-head {
    flex-direction: column;
    align-items: stretch;
  }

  .customer-accounts-head-end {
    justify-content: space-between;
  }

  .customer-accounts-search-form {
    flex-direction: column;
  }

  .customer-accounts-table {
    font-size: 0.84rem;
  }

  .customer-accounts-action-btn--excel,
  .customer-accounts-action-btn--pdf {
    padding-inline: 0.35rem;
    font-size: 0.7rem;
  }
}

/* ——— كشوفات حسابات الموردين (مرآة الزبائن) ——— */
.supplier-accounts-page,
.supplier-statement-page,
.supplier-accounts-print-page,
.supplier-account-print-page {
  /* يستخدم أنماط customer-accounts-* المشتركة */
}

/* ——— حساب العهد ——— */
.custody-holder-picker {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.custody-holder-picker .form-input,
.custody-holder-picker select {
  flex: 1;
  min-width: 0;
}

.custody-holder-add-btn {
  flex-shrink: 0;
  width: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 0;
}

.custody-holder-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
}

.custody-issue-modal {
  width: min(28rem, calc(100vw - 1.25rem));
  max-width: 28rem;
  padding: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.custody-issue-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.custody-issue-modal .crud-form {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.custody-issue-modal-header {
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.custody-issue-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.custody-issue-modal-lead {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.custody-issue-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
}

.custody-issue-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}

.custody-issue-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.custody-issue-label small {
  font-weight: 500;
  color: #94a3b8;
}

.custody-issue-modal .form-input,
.custody-issue-modal select.form-input,
.custody-issue-modal .sale-date-field .form-input,
.custody-issue-modal .sale-date-field-picker {
  min-height: 2.35rem;
  border-radius: 0;
  font-size: 0.88rem;
}

.custody-issue-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.custody-issue-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.custody-issue-field--date,
.custody-issue-field--notes {
  grid-column: 1 / -1;
}

.custody-issue-modal-footer {
  display: flex;
  justify-content: stretch;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.custody-issue-modal-footer .btn {
  flex: 1;
  min-height: 2.4rem;
  font-weight: 600;
  border-radius: 0;
}

.custody-issue-modal-footer .btn-outline {
  color: #334155;
  border-color: #cbd5e1;
  background: #fff;
}

.custody-issue-modal-footer .btn-outline:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.custody-issue-submit {
  box-shadow: 0 1px 2px rgba(30, 58, 95, 0.18);
}

.custody-holder-quick-modal {
  width: min(22rem, calc(100vw - 1.25rem));
  max-width: 22rem;
  border-radius: 0;
  overflow: hidden;
}

.custody-holder-quick-body {
  padding: 1rem 1.1rem;
}

.custody-holder-quick-modal .modal-footer {
  gap: 0.55rem;
}

.custody-holder-quick-modal .modal-footer .btn {
  flex: 1;
  min-height: 2.3rem;
}

@media (max-width: 520px) {
  .custody-issue-modal-grid {
    grid-template-columns: 1fr;
  }

  .custody-issue-field--date,
  .custody-issue-field--notes {
    grid-column: auto;
  }

  .custody-issue-modal-footer {
    flex-direction: column-reverse;
  }
}

.custody-open-pill {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
}

.custody-status-badge--open {
  background: #dbeafe;
  color: #1e40af;
}

.custody-accounts-page .custody-accounts-section-title {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.custody-accounts-page .table-wrap,
.custody-accounts-page .btn,
.custody-accounts-page .custody-action-btn,
.custody-accounts-page .data-table th,
.custody-accounts-page .data-table td,
.custody-accounts-page .custody-open-pill,
.custody-issue-modal,
.custody-issue-modal .form-input,
.custody-issue-modal select.form-input,
.custody-issue-modal .sale-date-field .form-input,
.custody-issue-modal .sale-date-field-picker,
.custody-issue-modal-footer .btn,
.custody-holder-add-btn,
.custody-holder-quick-modal,
.custody-holder-quick-modal .form-input,
.custody-holder-quick-modal .btn {
  border-radius: 0 !important;
}

.custody-accounts-table .custody-accounts-name {
  font-weight: 600;
}

.custody-accounts-table .custody-money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.custody-accounts-table .custody-money--muted {
  color: var(--text-muted, #64748b);
  font-weight: 500;
}

.custody-accounts-table .custody-money--highlight {
  color: var(--primary-color, #1e3a5f);
}

.custody-accounts-table .col-actions {
  width: 8.5rem;
  white-space: nowrap;
}

.custody-accounts-table th,
.custody-accounts-table td {
  padding: 0.28rem 0.5rem;
  font-size: 0.82rem;
  vertical-align: middle;
  border-radius: 0 !important;
}

.custody-accounts-table tbody tr.custody-row--open {
  background: #ffedd5;
}

.custody-accounts-table tbody tr.custody-row--settled {
  background: #dcfce7;
}

.custody-accounts-table tbody tr.custody-row--open:hover,
.custody-accounts-table tbody tr.custody-row--settled:hover {
  filter: brightness(0.97);
}

.custody-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.custody-action-btn svg {
  flex-shrink: 0;
}

.custody-action-settle {
  min-width: 5.25rem;
}

.custody-action-view {
  min-width: 6.5rem;
  background: #fff;
  border-color: #fdba74;
  color: #9a3412;
}

.custody-action-view:hover {
  background: #fff7ed;
  border-color: #fb923c;
  color: #7c2d12;
}

.custody-settlement-page {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.875rem;
}

.custody-settlement-page .page-header,
.custody-settlement-page-header {
  margin-bottom: 0;
  padding-bottom: 0.15rem;
  flex-shrink: 0;
}

.custody-settlement-page .page-header h1 {
  font-size: 1.15rem;
  margin: 0;
}

.custody-money--highlight {
  color: #1e40af;
}

.custody-money--expense {
  color: #c2410c;
}

.custody-money--return {
  color: #15803d;
}

.custody-settlement-lines-section {
  margin-bottom: 1rem;
}

.custody-settlement-lines-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.custody-settlement-lines-head h2 {
  margin: 0;
  font-size: 1rem;
}

.custody-settlement-lines-table .form-input {
  width: 100%;
  min-width: 0;
}

.custody-settlement-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0;
  background: #fff;
}

.custody-settlement-total-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.custody-settlement-total-item span {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.custody-settlement-total-item--remainder strong {
  color: var(--primary-color, #2563eb);
}

.custody-remainder--over {
  color: #dc2626 !important;
}

.custody-settlement-meta {
  margin-bottom: 0.5rem;
}

.custody-return-treasury-field[hidden] {
  display: none !important;
}

.custody-settlement-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.custody-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 0;
  font-size: 0.7rem;
  font-weight: 600;
}

.custody-status-badge--settled {
  background: #dcfce7;
  color: #166534;
}

.custody-settlement-split {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 0.65rem;
  align-items: stretch;
}

.custody-settlement-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.custody-settlement-panel--form {
  height: fit-content;
}

.custody-settlement-panel--ledger {
  height: 0;
  min-height: 100%;
  overflow: hidden;
}

.custody-settlement-card {
  padding: 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0;
  background: #fff;
  margin-bottom: 0.55rem;
  overflow: hidden;
}

.custody-settlement-panel--form .custody-settlement-card:last-child {
  margin-bottom: 0;
}

.custody-settlement-card--expense {
  border-top: 2px solid #f59e0b;
}

.custody-settlement-card--return {
  border-top: 2px solid #22c55e;
}

.custody-settlement-card--return.is-disabled {
  opacity: 0.75;
}

.custody-settlement-card--ledger {
  border-top: 2px solid var(--primary-color, #1e3a5f);
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.custody-settlement-card--readonly {
  padding: 0.75rem 0.85rem;
  background: var(--surface-muted, #f8fafc);
  font-size: 0.82rem;
}

.custody-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: #f8fafc;
  flex-shrink: 0;
}

.custody-card-header h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.custody-card-subtitle {
  display: none;
}

.custody-form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem 0.35rem;
}

.custody-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.custody-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
}

.custody-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary, #334155);
}

.custody-field-optional {
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
}

.custody-settlement-page .form-input,
.custody-settlement-page .custody-form-input,
.custody-settlement-page .custody-form-field .form-input,
.custody-settlement-page .sale-date-field .form-input,
.custody-settlement-page .sale-date-field-picker,
.custody-settlement-page .btn,
.custody-settlement-page .custody-form-submit,
.custody-settlement-page .custody-type-badge,
.custody-settlement-page .custody-ledger-count {
  border-radius: 0 !important;
}

.custody-form-input,
.custody-form-field .form-input,
.custody-form-field .sale-date-field .form-input {
  min-height: 2rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 0;
  border-color: #cbd5e1;
  background: #fff;
}

.custody-form-input:focus,
.custody-form-field .form-input:focus {
  border-color: var(--primary-color, #1e3a5f);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
  outline: none;
}

.custody-form-input--amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #15803d;
}

.custody-form-actions {
  display: flex;
  justify-content: stretch;
  padding: 0.4rem 0.65rem 0.55rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
  background: #f8fafc;
}

.custody-form-submit {
  width: 100%;
  min-height: 2.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 0;
}

.custody-return-submit {
  background: #15803d;
  border-color: #15803d;
}

.custody-return-submit:hover {
  background: #166534;
  border-color: #166534;
}

.custody-return-empty {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
}

.custody-ledger-count {
  flex-shrink: 0;
  padding: 0.1rem 0.45rem;
  border-radius: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  background: #fff;
  border: 1px solid var(--border-color, #e2e8f0);
}

.custody-ledger-table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  border: none;
  border-radius: 0 !important;
  box-shadow: none;
  background: transparent;
}

.custody-ledger-table {
  margin: 0;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-radius: 0;
}

.custody-ledger-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  padding: 0.3rem 0.35rem;
  border-radius: 0 !important;
}

.custody-ledger-table tbody td {
  padding: 0.22rem 0.35rem;
  font-size: 0.76rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0 !important;
}

.custody-settlement-card--ledger,
.custody-settlement-card--ledger .custody-card-header,
.custody-holder-ledger-card,
.custody-ledger-table-wrap.table-wrap,
.custody-ledger-table thead th:first-child,
.custody-ledger-table thead th:last-child,
.custody-ledger-table tbody td:first-child,
.custody-ledger-table tbody td:last-child {
  border-radius: 0 !important;
}

.custody-ledger-table tbody tr:hover {
  filter: brightness(0.97);
}

.custody-ledger-table .col-num {
  width: 1.8rem;
  color: var(--text-muted, #64748b);
}

.custody-ledger-table .col-date {
  width: 5.4rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.custody-ledger-table .col-type {
  width: 5.6rem;
}

.custody-ledger-table .col-desc {
  width: auto;
}

.custody-ledger-table .col-money {
  width: 4.4rem;
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.custody-ledger-table .col-balance {
  width: 4.6rem;
  font-weight: 700;
}

.custody-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.35rem;
  border-radius: 0;
  font-size: 0.64rem;
  font-weight: 700;
  white-space: nowrap;
}

.custody-type-badge--issue {
  background: #bfdbfe;
  color: #1e3a8a;
}

.custody-type-badge--expense {
  background: #fed7aa;
  color: #9a3412;
}

.custody-type-badge--return {
  background: #bbf7d0;
  color: #14532d;
}

.custody-ledger-desc {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.custody-ledger-debit,
.custody-ledger-credit {
  font-weight: 600;
}

.custody-ledger-balance {
  font-weight: 700;
}

.custody-ledger-row--issue {
  background: #dbeafe;
}

.custody-ledger-row--issue .custody-ledger-debit,
.custody-ledger-row--issue .custody-ledger-balance {
  color: #1e40af;
}

.custody-ledger-row--expense {
  background: #ffedd5;
}

.custody-ledger-row--expense .custody-ledger-credit,
.custody-ledger-row--expense .custody-ledger-balance {
  color: #c2410c;
}

.custody-ledger-row--return {
  background: #dcfce7;
}

.custody-ledger-row--return .custody-ledger-credit,
.custody-ledger-row--return .custody-ledger-balance {
  color: #166534;
}

.custody-accounts-section {
  margin-bottom: 1.75rem;
}

.custody-accounts-section-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.custody-holder-statement-page {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: calc(100vh - 5.5rem);
  max-height: calc(100vh - 5.5rem);
  overflow: hidden;
  font-size: 0.875rem;
}

.custody-holder-statement-page .page-header h1 {
  font-size: 1.15rem;
  margin: 0;
}

.custody-holder-ledger-card {
  flex: 1;
  min-height: 0;
}

@media (max-width: 960px) {
  .custody-settlement-split {
    grid-template-columns: 1fr;
  }

  .custody-settlement-panel--ledger {
    order: -1;
    height: auto;
    min-height: 16rem;
  }

  .custody-ledger-table-wrap {
    max-height: 50vh;
  }

  .custody-form-row {
    grid-template-columns: 1fr;
  }

  .custody-holder-statement-page {
    max-height: none;
    overflow: visible;
  }
}

.card-commissions-intro {
  margin: 0 0 0.85rem;
  max-width: 52rem;
  line-height: 1.5;
}

.card-commissions-table .col-actions {
  white-space: nowrap;
}

.card-commissions-table .col-actions .inline-form {
  display: inline-block;
  margin-inline-start: 0.25rem;
}

.card-commission-modal {
  max-width: 26rem;
  width: calc(100% - 2rem);
  overflow: visible;
}

.card-commission-modal form {
  overflow: visible;
}

.card-commission-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  overflow: visible;
}

.card-commission-modal-body .form-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
  overflow: visible;
}

.card-commission-label {
  display: block;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.card-commission-modal-body .form-input,
.card-commission-modal-body select.form-input,
.card-commission-modal-body textarea.form-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.4rem;
}

.card-commission-modal-body textarea.form-input {
  min-height: 4.25rem;
  resize: vertical;
}

.card-commission-dates-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.card-commission-modal-body .sale-date-field {
  width: 100%;
  flex: none;
  overflow: visible;
  z-index: 1;
}

.card-commission-modal-body .sale-date-field.is-open {
  z-index: 120;
}

.card-commission-modal-body .sale-date-field-control,
.card-commission-modal-body .sale-date-field-picker {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 2.4rem;
  height: 2.4rem;
}

/* محاذاة التقويم لداخل النافذة (في RTL يفتح نحو اليسار دون قص الحافة) */
.card-commission-modal .sale-date-calendar {
  inset-inline-end: auto;
  inset-inline-start: 0;
  z-index: 130;
}

.card-commission-modal .modal-footer {
  gap: 0.55rem;
}

/* نافذة إضافة/تعديل خزينة */
.treasury-edit-modal {
  max-width: 560px;
}

.treasury-edit-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
}

.treasury-edit-modal-body .form-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}

.treasury-edit-label {
  display: block;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.treasury-edit-modal-body .form-input,
.treasury-edit-modal-body select.form-input,
.treasury-edit-modal-body textarea.form-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  font-family: var(--font);
  font-size: 0.92rem;
  border: 1px solid var(--color-border, #d8e0ea);
  border-radius: var(--radius-sm, 8px);
  background: var(--color-bg, #fff);
}

.treasury-edit-modal-body textarea.form-input {
  min-height: 4.5rem;
  resize: vertical;
}

.treasury-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.treasury-payment-methods-fieldset {
  margin: 0;
  padding: 0.7rem 0.85rem 0.75rem;
  border: 1px solid var(--color-border, #d8e0ea);
  border-radius: var(--radius-sm, 8px);
  background: #f8fafc;
}

.treasury-payment-methods-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-primary, #1e3a5f);
}

.treasury-payment-methods-fieldset .form-hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--color-text-muted, #64748b);
}

.treasury-payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.85rem;
}

.treasury-payment-method-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.treasury-payment-method-item input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--color-primary, #1e3a5f);
}

.treasury-edit-active {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  width: fit-content;
}

.treasury-edit-active input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--color-primary, #1e3a5f);
}

@media (max-width: 520px) {
  .treasury-edit-row,
  .treasury-payment-methods-grid {
    grid-template-columns: 1fr;
  }
}

/* لوحة الخزائن — تنسيقات قديمة لصفحات أخرى */
.treasury-page .treasury-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.65rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.treasury-summary-label {
  display: block;
  font-size: 0.82rem;
  color: #64748b;
}

.treasury-summary-value {
  font-size: 1.35rem;
  color: #0f172a;
}

.treasury-summary-meta {
  font-size: 0.85rem;
  color: #64748b;
}

.treasury-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.treasury-card {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.65rem;
  padding: 0.9rem 1rem;
  background: #fff;
}

.treasury-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.treasury-card-head h2 {
  margin: 0;
  font-size: 1rem;
}

.treasury-type-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}

.treasury-card-balance {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.treasury-card-foot {
  display: flex;
  gap: 0.4rem;
}

.treasury-recent-section {
  margin-bottom: 1.25rem;
}

.treasury-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.treasury-direction {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.treasury-direction--in {
  background: #dcfce7;
  color: #166534;
}

.treasury-direction--out {
  background: #fee2e2;
  color: #991b1b;
}

/* كشف حركة الخزينة — نمط كشف الحساب */
.treasury-movements-page {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: calc(100dvh - var(--app-header-height, 4.75rem));
  max-height: calc(100dvh - var(--app-header-height, 4.75rem));
  overflow: hidden;
}

.treasury-movements-chrome {
  flex: 0 0 auto;
}

.treasury-movements-page .btn,
.treasury-movements-page .sales-list-filter,
.treasury-movements-page .sales-list-filter-input,
.treasury-movements-page .sale-date-field .form-input,
.treasury-movements-page .sale-date-field-picker,
.treasury-movements-table-wrap {
  border-radius: 0 !important;
}

.treasury-movements-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.35rem;
  padding: 0.45rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  font-size: 0.82rem;
  color: #334155;
}

.treasury-movements-balance-hint {
  margin: 0 0 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  background: #fff8eb;
  border: 1px solid #f1e0b8;
  color: #6b4f1d;
  font-size: 0.8rem;
  line-height: 1.45;
}

.treasury-movements-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid #94a3b8;
  background: #fff;
  box-shadow: none;
  overflow: auto;
}

.treasury-movements-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}

.treasury-movements-table th,
.treasury-movements-table td {
  padding: 0.32rem 0.4rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #b8c4d4;
  line-height: 1.35;
  border-radius: 0 !important;
}

.treasury-movements-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 0 #94a3b8;
}

.treasury-movements-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 3;
  box-shadow: 0 -1px 0 #94a3b8;
}

.treasury-movements-table tbody tr.treasury-movement-row--in td {
  background: #ecfdf5;
}

.treasury-movements-table tbody tr.treasury-movement-row--out td {
  background: #fff7ed;
}

.treasury-movements-table .col-num {
  width: 2.4rem;
}

.treasury-movements-table .col-date {
  width: 6.2rem;
  white-space: nowrap;
}

.treasury-movements-table .col-type {
  width: 7rem;
}

.treasury-movements-table .col-party {
  width: 7rem;
}

.treasury-movements-table .col-desc,
.treasury-movements-table .col-notes {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treasury-movements-table .col-money {
  width: 7.75rem;
  min-width: 7.75rem;
  padding-inline: 0.45rem;
  white-space: nowrap;
  font-size: 0.74rem;
  letter-spacing: -0.01em;
}

.treasury-movements-table th.col-money {
  font-size: 0.74rem;
}

.treasury-movements-in {
  color: #166534;
  font-weight: 600;
}

.treasury-movements-out {
  color: #c2410c;
  font-weight: 600;
}

.treasury-movements-balance {
  width: 8.5rem;
  min-width: 8.5rem;
  font-weight: 700;
  color: #1e3a5f;
}

.treasury-movements-totals th {
  background: #dce6f2;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.34rem 0.3rem;
}

.treasury-movements-totals-label {
  text-align: center;
  color: #1e3a5f;
}

.treasury-movements-totals-value {
  width: 8.5rem;
  min-width: 8.5rem;
  font-size: 0.74rem;
  color: #1e3a5f;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .treasury-movements-page {
    max-height: none;
    overflow: visible;
    min-height: 0;
  }

  .treasury-movements-table-wrap {
    max-height: min(70vh, 36rem);
  }
}

/* التحويلات بين الخزائن + نوافذ الإنشاء */
.treasury-transfers-page .btn,
.treasury-transfers-page .table-wrap,
.treasury-transfers-table-wrap,
.transfer-create-modal,
.transfer-create-modal .form-input,
.transfer-create-modal .sale-date-field .form-input,
.transfer-create-modal .sale-date-field-picker,
.transfer-create-modal-footer .btn {
  border-radius: 0 !important;
}

.treasury-transfers-table-wrap {
  border: 1px solid #94a3b8;
  background: #fff;
  box-shadow: none;
}

.treasury-transfers-table th,
.treasury-transfers-table td {
  padding: 0.22rem 0.45rem;
  font-size: 0.8rem;
  vertical-align: middle;
  border-radius: 0 !important;
}

.treasury-transfers-table thead th {
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.treasury-transfers-table .col-num {
  width: 2.4rem;
  text-align: center;
  color: #64748b;
}

.treasury-transfers-table .col-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.treasury-transfer-row--void td {
  opacity: 0.65;
}

.treasury-transfer-type {
  display: inline-block;
  font-weight: 600;
  color: #1e3a5f;
}

.treasury-transfer-type--external {
  color: #0f766e;
}

.transfer-create-modal {
  width: min(30rem, calc(100vw - 1.25rem));
  max-width: 30rem;
  padding: 0;
  border: none;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.transfer-create-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.transfer-create-modal-header {
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.transfer-create-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.transfer-create-modal-lead {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.transfer-create-modal-body {
  padding: 1rem 1.1rem;
}

.transfer-create-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.transfer-create-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}

.transfer-create-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.55rem;
  align-items: start;
}

.transfer-swap-btn {
  margin-top: 1.55rem;
  min-width: 2.4rem;
  min-height: 2.35rem;
  padding: 0 0.45rem;
  font-size: 1.1rem;
  line-height: 1;
  color: #1e3a5f;
  border-color: #94a3b8;
  background: #fff;
}

.transfer-swap-btn:hover {
  background: #f1f5f9;
  border-color: #64748b;
}

.transfer-create-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.transfer-create-label small {
  font-weight: 500;
  color: #94a3b8;
}

.transfer-treasury-balance {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.transfer-treasury-balance.is-positive {
  color: #15803d;
}

.transfer-treasury-balance.is-negative {
  color: #dc2626;
}

.transfer-treasury-balance.is-zero {
  color: #64748b;
}

.transfer-create-modal .form-input,
.transfer-create-modal select.form-input,
.transfer-create-modal .sale-date-field .form-input,
.transfer-create-modal .sale-date-field-picker {
  min-height: 2.35rem;
  font-size: 0.88rem;
}

.transfer-create-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.transfer-create-field--full,
.transfer-create-field--date,
.transfer-create-field--notes {
  grid-column: 1 / -1;
}

.transfer-create-modal-footer {
  display: flex;
  justify-content: stretch;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.transfer-create-modal-footer .btn {
  flex: 1;
  min-height: 2.4rem;
  font-weight: 600;
}

.transfer-create-modal-footer .btn-outline {
  color: #334155;
  border-color: #cbd5e1;
  background: #fff;
}

.transfer-create-submit {
  box-shadow: 0 1px 2px rgba(30, 58, 95, 0.18);
}

@media (max-width: 520px) {
  .transfer-create-modal-grid {
    grid-template-columns: 1fr;
  }

  .transfer-create-pair {
    grid-template-columns: 1fr;
  }

  .transfer-swap-btn {
    margin-top: 0;
    width: 100%;
  }

  .transfer-create-field--full,
  .transfer-create-field--date,
  .transfer-create-field--notes {
    grid-column: auto;
  }

  .transfer-create-modal-footer {
    flex-direction: column-reverse;
  }
}

/* حسابات خاصة — مساهمون */
.special-accounts-page .btn,
.special-accounts-page .table-wrap,
.special-accounts-table-wrap,
.special-modal,
.special-modal .form-input,
.special-modal .sale-date-field .form-input,
.special-modal .sale-date-field-picker {
  border-radius: 0 !important;
}

.special-accounts-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  font-size: 0.84rem;
  color: #334155;
}

.special-accounts-summary strong {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.special-accounts-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.special-accounts-search {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}

.special-accounts-search-input,
.special-accounts-search .special-accounts-search-input.form-input {
  width: min(18rem, 100%);
  min-width: 10rem;
  max-width: 18rem;
  flex: 0 1 18rem;
  height: 2.45rem;
  min-height: 2.45rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.35;
  box-sizing: border-box;
}

.special-accounts-search .btn {
  height: 2.45rem;
  min-height: 2.45rem;
  padding-inline: 0.9rem;
  flex-shrink: 0;
}

.special-accounts-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: center;
  flex-shrink: 0;
  margin-inline-start: auto;
}

.special-accounts-actions .btn {
  height: 2.45rem;
  min-height: 2.45rem;
  padding-inline: 0.85rem;
  white-space: nowrap;
}

.special-accounts-table-wrap {
  border: 1px solid #94a3b8;
  background: #fff;
  box-shadow: none;
}

.special-accounts-table th,
.special-accounts-table td {
  padding: 0.32rem 0.55rem;
  font-size: 0.84rem;
  vertical-align: middle;
}

.special-accounts-table thead th {
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.76rem;
  font-weight: 700;
}

.special-accounts-table .col-num {
  width: 2.4rem;
  text-align: center;
  color: #64748b;
}

.special-accounts-inactive {
  display: inline-block;
  margin-inline-start: 0.35rem;
  font-size: 0.7rem;
  color: #b45309;
}

.special-accounts-balance {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.special-accounts-balance__label {
  font-size: 0.76rem;
  font-weight: 700;
}

.special-accounts-balance.is-credit,
.special-party-balance.is-credit {
  color: #15803d;
}

.special-accounts-balance.is-debit,
.special-party-balance.is-debit {
  color: #c2410c;
}

.special-accounts-balance.is-zero,
.special-party-balance.is-zero {
  color: #64748b;
}

.special-accounts-last-date {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
}

.special-accounts-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.28rem;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.special-accounts-row-actions .table-action-btn {
  flex-shrink: 0;
}

.special-action-btn--statement {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.special-action-btn--statement:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.special-action-btn--accrual {
  background: #1e3a5f;
  border-color: #1e3a5f;
  color: #fff;
}

.special-action-btn--accrual:hover {
  background: #274b78;
  border-color: #274b78;
  color: #fff;
}

.special-action-btn--payout {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.special-action-btn--payout:hover {
  background: #ffedd5;
  border-color: #fb923c;
  color: #9a3412;
}

.special-action-btn--collect {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

.special-action-btn--collect:hover {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}

.special-accounts-table .col-actions {
  width: 7.5rem;
  min-width: 7.5rem;
  white-space: nowrap;
}

.special-party-balance {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.special-modal {
  width: min(30rem, calc(100vw - 1.25rem));
  max-width: min(30rem, calc(100vw - 1.25rem));
  padding: 0;
  border: none;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.special-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.special-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border-bottom: 1px solid #dbe4f0;
}

.special-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.special-modal-header .modal-close {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.special-modal-header .modal-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.special-modal-lead {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #64748b;
}

.special-modal-body {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem 1.15rem 1.05rem;
}

.special-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem 0.85rem;
}

.special-modal-grid .special-modal-field--full,
.special-modal-grid .form-field-full {
  grid-column: 1 / -1;
}

.special-modal-body .form-field,
.special-modal-body .special-modal-field,
.special-side-field {
  margin: 0;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  border: none;
  padding: 0;
}

.special-modal-body .form-field > span,
.special-modal-label,
.special-side-field > legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  padding: 0;
}

.special-modal-body .form-input,
.special-modal-body select.form-input,
.special-modal-body .sale-date-field .form-input {
  width: 100%;
  min-height: 2.4rem;
  box-sizing: border-box;
}

.special-side-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.special-side-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.45rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.special-side-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.special-side-option:has(input:checked) {
  border-color: #1e3a5f;
  background: #e8eef5;
  color: #0f172a;
  box-shadow: inset 0 0 0 1px #1e3a5f;
}

.special-side-option.is-credit:has(input:checked) {
  border-color: #15803d;
  background: #ecfdf5;
  color: #166534;
  box-shadow: inset 0 0 0 1px #15803d;
}

.special-side-option.is-debit:has(input:checked) {
  border-color: #c2410c;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px #c2410c;
}

.special-modal-footer {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem 1.15rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.special-modal-footer .btn {
  flex: 1;
  min-height: 2.45rem;
}

@media (max-width: 520px) {
  .special-modal-grid {
    grid-template-columns: 1fr;
  }

  .special-accounts-toolbar {
    flex-direction: column;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .special-accounts-search {
    width: 100%;
  }

  .special-accounts-search-input,
  .special-accounts-search .special-accounts-search-input.form-input {
    max-width: none;
    width: 100%;
    flex: 1 1 auto;
  }

  .special-accounts-actions {
    margin-inline-start: 0;
    width: 100%;
    justify-content: stretch;
  }

  .special-accounts-actions .btn {
    flex: 1;
  }
}

.special-statement-table .col-money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.special-statement-table .col-actions {
  width: 7%;
}

.special-statement-table .col-type {
  width: 30%;
}

.special-statement-page .customer-statement-panel--actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* المصاريف + نافذة إضافة مصروف */
.treasury-expenses-page .btn,
.treasury-expenses-page .table-wrap,
.treasury-expenses-table-wrap,
.expense-create-modal,
.expense-create-modal .form-input,
.expense-create-modal .sale-date-field .form-input,
.expense-create-modal .sale-date-field-picker,
.expense-create-modal-footer .btn {
  border-radius: 0 !important;
}

.treasury-expenses-table-wrap {
  border: 1px solid #94a3b8;
  background: #fff;
  box-shadow: none;
}

.treasury-expenses-list-page {
  --records-list-chrome-height: 11.5rem;
  --sales-list-thead-gap: 0.35rem;
}

@media (max-width: 599px) {
  .treasury-expenses-list-page {
    --records-list-chrome-height: 16rem;
  }
}

.treasury-expenses-list-page .sales-list-sticky-bar {
  margin: -0.25rem 0 0.35rem;
}

.treasury-expenses-list-page .records-list-chrome .page-header {
  margin-bottom: 0.75rem;
}

.treasury-expenses-list-page .treasury-expenses-filter {
  margin-bottom: 0;
}

.treasury-expenses-list-page .treasury-expenses-summary {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.15rem 0.15rem;
}

.treasury-expenses-list-page .treasury-expenses-table-wrap {
  margin-top: 0.15rem;
}

@media (min-width: 769px) {
  .treasury-expenses-list-page .treasury-expenses-table-wrap {
    overflow: visible;
    background: var(--color-surface);
    border: 1px solid #94a3b8;
    border-radius: 0;
    box-shadow: none;
  }

  .treasury-expenses-list-page .treasury-expenses-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .treasury-expenses-list-page .treasury-expenses-table thead th {
    position: sticky;
    top: calc(
      var(--app-header-height, 4.75rem)
      + var(--records-list-chrome-height, 11.5rem)
      + var(--sales-list-thead-gap, 0.35rem)
    );
    z-index: 34;
    background: #e8eef5 !important;
    border-bottom: 1px solid #94a3b8;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  }
}

.treasury-expenses-filter {
  margin-bottom: 0.65rem;
}

.treasury-expenses-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.15rem;
  font-size: 0.84rem;
  color: #334155;
}

.treasury-expenses-summary strong {
  color: #0f172a;
}

.treasury-expenses-summary-period {
  color: #64748b;
  font-size: 0.8rem;
}

.treasury-expenses-page .sales-list-filter,
.treasury-expenses-page .sales-list-filter-input,
.treasury-expenses-page .sale-date-field .form-input,
.treasury-expenses-page .sale-date-field-picker {
  border-radius: 0 !important;
}

.treasury-expenses-table th,
.treasury-expenses-table td {
  padding: 0.22rem 0.45rem;
  font-size: 0.8rem;
  vertical-align: middle;
  border-radius: 0 !important;
}

.treasury-expenses-table thead th {
  background: #e8eef5;
  color: #1e3a5f;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.treasury-expenses-table .col-num {
  width: 2.4rem;
  text-align: center;
  color: #64748b;
}

.treasury-expenses-table .col-actions {
  width: 3rem;
  text-align: center;
  white-space: nowrap;
}

.treasury-expense-action-muted {
  color: #94a3b8;
  font-size: 0.85rem;
}

.treasury-expense-notes {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treasury-expense-row--custody td {
  background: #fff7ed;
}

.treasury-expense-row--void td {
  opacity: 0.65;
}

.treasury-expense-source-badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.02rem 0.3rem;
  font-size: 0.64rem;
  font-weight: 700;
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fdba74;
  border-radius: 0;
}

.expense-create-modal {
  width: min(28rem, calc(100vw - 1.25rem));
  max-width: 28rem;
  padding: 0;
  border: none;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.expense-create-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.expense-create-modal-header {
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.expense-create-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.expense-create-modal-lead {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.expense-create-modal-body {
  padding: 1rem 1.1rem;
}

.expense-create-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.expense-create-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}

.expense-create-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.expense-create-label small {
  font-weight: 500;
  color: #94a3b8;
}

.expense-create-modal .form-input,
.expense-create-modal select.form-input,
.expense-create-modal .sale-date-field .form-input,
.expense-create-modal .sale-date-field-picker {
  min-height: 2.35rem;
  font-size: 0.88rem;
}

.expense-create-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.expense-create-field--date,
.expense-create-field--notes {
  grid-column: 1 / -1;
}

.expense-create-modal-footer {
  display: flex;
  justify-content: stretch;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.expense-create-modal-footer .btn {
  flex: 1;
  min-height: 2.4rem;
  font-weight: 600;
}

.expense-create-modal-footer .btn-outline {
  color: #334155;
  border-color: #cbd5e1;
  background: #fff;
}

.expense-create-submit {
  box-shadow: 0 1px 2px rgba(30, 58, 95, 0.18);
}

.expense-create-confirm-step {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.25rem 0 0.15rem;
}

.expense-create-confirm-lead {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.5;
}

.expense-create-confirm-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid #dbe4f0;
  border-radius: 0.55rem;
  background: #f8fafc;
}

.expense-create-confirm-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.expense-create-confirm-label {
  font-size: 0.85rem;
  color: #64748b;
}

.expense-create-confirm-value {
  font-size: 0.95rem;
  color: #0f172a;
  text-align: left;
}

.expense-create-confirm-amount {
  font-variant-numeric: tabular-nums;
}

.expense-create-confirm-hint {
  margin: 0;
}

@media (max-width: 520px) {
  .expense-create-modal-grid {
    grid-template-columns: 1fr;
  }

  .expense-create-field--date,
  .expense-create-field--notes {
    grid-column: auto;
  }

  .expense-create-modal-footer {
    flex-direction: column-reverse;
  }
}

.treasury-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.treasury-form-field--wide {
  grid-column: 1 / -1;
}

.treasury-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.treasury-alloc-section {
  margin-top: 0;
}

.treasury-voucher-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 1.25rem;
}

.treasury-voucher-meta div {
  margin: 0;
}

.treasury-voucher-meta dt {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.treasury-voucher-meta dd {
  margin: 0;
  font-weight: 600;
}

.treasury-invoice-payment-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.88rem;
}

.treasury-invoice-payment-summary strong {
  font-weight: 700;
}

.treasury-invoice-due {
  color: #b45309;
}

.treasury-receipt-page--create {
  --treasury-receipt-chrome: calc(var(--app-header-height, 4.75rem) + 4.25rem);
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  width: 100%;
  min-height: calc(100dvh - var(--app-header-height, 4.75rem));
  margin: 0 auto;
  padding: 0.45rem 1.5rem 0.65rem;
  box-sizing: border-box;
}

.treasury-receipt-chrome {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.treasury-receipt-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 55%, #f0fdf4 100%);
  border-bottom: 1px solid #e2e8f0;
}

.treasury-receipt-command-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.treasury-receipt-command-identity h1 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--color-primary-dark, #0f172a);
  line-height: 1.35;
}

.treasury-receipt-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.treasury-receipt-command-actions {
  flex-shrink: 0;
}

.treasury-receipt-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(280px, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.treasury-receipt-page--create .treasury-receipt-chrome {
  margin-bottom: 0.55rem;
}

.treasury-receipt-page--create .treasury-receipt-command-bar {
  padding: 0.5rem 0.75rem;
}

.treasury-receipt-page--create .treasury-receipt-command-identity h1 {
  font-size: 1rem;
}

.treasury-receipt-page--create .treasury-receipt-panel-head {
  padding: 0.4rem 0.6rem;
}

.treasury-receipt-page--create .treasury-receipt-panel-head h2 {
  font-size: 0.84rem;
}

.treasury-receipt-page--create .treasury-receipt-history-sub {
  font-size: 0.72rem;
}

.treasury-receipt-page--create .treasury-receipt-panel-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.treasury-receipt-page--create .treasury-receipt-panel-body {
  padding: 0.6rem;
}

.treasury-receipt-page--create .treasury-receipt-history-body {
  padding: 0.3rem 0.4rem 0.4rem;
  min-height: 180px;
  max-height: calc(100dvh - 16rem);
}

.treasury-receipt-page--create .treasury-receipt-fields {
  gap: 0.6rem;
}

.treasury-receipt-page--create .treasury-receipt-customer-block {
  padding: 0.5rem 0.6rem;
  gap: 0.4rem 0.55rem;
}

.treasury-receipt-page--create .treasury-customer-balance-badge {
  min-width: 5.5rem;
  padding: 0.35rem 0.5rem;
}

.treasury-receipt-page--create .treasury-customer-balance-badge__value {
  font-size: 0.95rem;
}

.treasury-receipt-page--create .treasury-receipt-amount-block {
  padding: 0.5rem 0.6rem;
}

.treasury-receipt-page--create .treasury-receipt-amount-input {
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  font-size: 1.1rem;
}

.treasury-receipt-page--create .treasury-receipt-details-grid {
  gap: 0.5rem 0.6rem;
}

.treasury-receipt-page--create .treasury-receipt-form .form-field-label {
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
}

.treasury-receipt-page--create .treasury-receipt-form .sale-input--compact,
.treasury-receipt-page--create .treasury-receipt-form select.form-input {
  min-height: 1.95rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
}

.treasury-receipt-page--create .treasury-receipt-form textarea.form-input {
  min-height: 3.25rem;
}

.treasury-receipt-page--create .treasury-receipt-form-actions {
  padding-top: 0.65rem;
}

.treasury-receipt-page--create .treasury-receipt-save-btn {
  min-height: 2.35rem;
}

.treasury-receipt-page--create .treasury-receipt-empty-state {
  min-height: 120px;
  padding: 0.75rem 0.5rem;
}

.treasury-receipt-page--create .treasury-receipt-empty-state__icon {
  width: 2.5rem;
  height: 2.5rem;
}

.treasury-receipt-page--create .treasury-receipt-empty-state__title {
  font-size: 0.84rem;
}

.treasury-receipt-page--create .treasury-receipt-empty-state__hint {
  font-size: 0.74rem;
}

.treasury-receipt-page--create .treasury-receipt-history-count {
  min-width: 1.4rem;
  height: 1.4rem;
  font-size: 0.72rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table-wrap {
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.treasury-receipt-page--create .treasury-receipt-history-table {
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

.treasury-receipt-page--create .treasury-receipt-history-table th,
.treasury-receipt-page--create .treasury-receipt-history-table td {
  padding: 0.2rem 0.35rem;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}

.treasury-receipt-page--create .treasury-receipt-history-table thead th {
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  white-space: nowrap;
}

.treasury-receipt-page--create .treasury-receipt-history-table tbody td {
  font-size: 0.76rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .col-actions {
  width: 3.6rem;
  white-space: nowrap;
  padding-inline: 0.15rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .col-history-num {
  width: 2.6rem;
  white-space: nowrap;
  padding-inline: 0.15rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .col-history-date {
  width: 5rem;
  white-space: nowrap;
  padding-inline: 0.15rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .col-history-amount {
  width: 4.1rem;
  white-space: nowrap;
  padding-inline: 0.15rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .col-history-notes {
  width: auto;
  max-width: 0;
  min-width: 0;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-inline: 0.3rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table thead th.col-history-notes {
  white-space: nowrap;
}

.treasury-receipt-page--create .treasury-receipt-history-table .table-action-group {
  gap: 0.18rem;
}

.treasury-receipt-page--create .treasury-receipt-history-table .table-action-btn {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
}

.treasury-receipt-page--create .treasury-receipt-history-table .table-action-btn .ui-icon {
  width: 13px;
  height: 13px;
}

.treasury-receipt-page--create .treasury-receipt-history-table a.treasury-receipt-history-link {
  font-weight: 700;
  color: var(--color-primary, #2563eb);
  text-decoration: none;
}

.treasury-receipt-page--create .treasury-receipt-history-table a.treasury-receipt-history-link:hover {
  text-decoration: underline;
}

.treasury-receipt-page--create .treasury-receipt-history-row--void {
  opacity: 0.55;
}

.treasury-receipt-page--create .treasury-receipt-history-row--void td:nth-child(3) {
  text-decoration: line-through;
  color: #94a3b8;
}

.treasury-receipt-form-col,
.treasury-receipt-history-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.treasury-receipt-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.treasury-receipt-panel--form,
.treasury-receipt-panel--history {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.treasury-receipt-panel--history {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.treasury-receipt-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: #f8fafc;
}

.treasury-receipt-panel-title {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.treasury-receipt-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  flex-shrink: 0;
  position: relative;
}

.treasury-receipt-panel-icon--form {
  background: #eef2ff;
}

.treasury-receipt-panel-icon--form::before {
  content: '';
  width: 0.95rem;
  height: 1.1rem;
  border: 2px solid #4f46e5;
  border-radius: 2px;
  box-shadow: inset 0 -0.35rem 0 #c7d2fe;
}

.treasury-receipt-panel-icon--history {
  background: #e0f2fe;
}

.treasury-receipt-panel-icon--history::before {
  content: '';
  width: 1rem;
  height: 0.75rem;
  border: 2px solid #0284c7;
  border-radius: 2px;
  box-shadow: 0 0.35rem 0 -0.1rem #bae6fd;
}

.treasury-receipt-panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  color: #0f172a;
}

.treasury-receipt-history-sub {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.treasury-receipt-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.treasury-receipt-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 1rem;
}

.treasury-receipt-history-body {
  flex: 1;
  padding: 0.75rem;
  overflow: auto;
  min-height: 280px;
}

.treasury-receipt-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.treasury-receipt-customer-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
}

.treasury-receipt-customer-field {
  grid-column: 1;
  margin: 0;
}

.treasury-customer-balance-badge {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 6.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.treasury-customer-balance-badge.is-preview {
  border-color: #fcd34d;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.treasury-customer-balance-badge__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.treasury-customer-balance-badge__value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.treasury-customer-balance-badge__value.is-debit {
  color: #b45309;
}

.treasury-customer-balance-badge__value.is-credit {
  color: #15803d;
}

.treasury-customer-balance-badge__value.is-zero {
  color: #64748b;
}

.treasury-receipt-amount-block {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.treasury-receipt-amount-block .form-field-label {
  color: #1e40af;
  font-weight: 700;
}

.treasury-receipt-amount-wrap {
  position: relative;
}

.treasury-receipt-amount-input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.55rem 0.85rem;
  font-size: 1.35rem;
  font-weight: 700;
  border: 1px solid #93c5fd;
  border-radius: 0.65rem;
  background: #fff;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.treasury-receipt-amount-input:focus {
  outline: none;
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.treasury-receipt-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 0.85rem;
  align-items: start;
}

.treasury-receipt-notes-field {
  margin: 0;
}

.treasury-receipt-fields .customer-picker {
  position: relative;
  width: 100%;
}

.treasury-receipt-fields .customer-picker-row .sale-input--compact {
  width: 100%;
  min-height: 2.35rem;
}

.treasury-receipt-fields .customer-suggestions {
  z-index: 80;
}

.treasury-receipt-form-actions {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
  justify-content: stretch;
}

.treasury-receipt-save-btn {
  flex: 1;
  min-height: 2.65rem;
  font-weight: 700;
}

.treasury-receipt-method-confirm-modal {
  max-width: 420px;
}

.treasury-receipt-method-confirm-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
}

.treasury-receipt-method-confirm-body .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.treasury-receipt-method-confirm-hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #475569;
}

.treasury-receipt-method-confirm-body .form-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  font-family: var(--font);
  font-size: 0.95rem;
  border: 1px solid var(--color-border, #d8e0ea);
  border-radius: var(--radius-sm, 8px);
  background: #fff;
}

.treasury-receipt-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 220px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: #64748b;
}

.treasury-receipt-empty-state__icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  position: relative;
}

.treasury-receipt-empty-state__icon::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #94a3b8;
  border-radius: 999px;
}

.treasury-receipt-empty-state__icon:not(.treasury-receipt-empty-state__icon--empty):not(.treasury-receipt-empty-state__icon--error)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  width: 1.35rem;
  height: 0.55rem;
  margin-left: -0.675rem;
  border: 2px solid #94a3b8;
  border-top: none;
  border-radius: 0 0 999px 999px;
}

.treasury-receipt-empty-state__icon--empty::before,
.treasury-receipt-empty-state__icon--empty::after {
  display: none;
}

.treasury-receipt-empty-state__icon--empty {
  background: #fff;
  border-style: solid;
  border-color: #e2e8f0;
}

.treasury-receipt-empty-state__icon--empty {
  box-shadow: inset 0 0 0 0.55rem #f8fafc;
}

.treasury-receipt-empty-state__icon--error {
  background: #fef2f2;
  border-color: #fecaca;
}

.treasury-receipt-empty-state__icon--error::before {
  content: '!';
  position: static;
  width: auto;
  height: auto;
  border: none;
  font-size: 1.35rem;
  font-weight: 800;
  color: #dc2626;
  line-height: 3.25rem;
  text-align: center;
  display: block;
}

.treasury-receipt-empty-state__icon--error::after {
  display: none;
}

.treasury-receipt-empty-state__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #475569;
}

.treasury-receipt-empty-state__hint {
  margin: 0;
  max-width: 18rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.treasury-receipt-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.treasury-receipt-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.treasury-receipt-history-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.treasury-receipt-history-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.treasury-receipt-history-item__link {
  font-weight: 700;
  color: var(--color-primary, #2563eb);
  text-decoration: none;
}

.treasury-receipt-history-item__link:hover {
  text-decoration: underline;
}

.treasury-receipt-history-item__date {
  font-size: 0.78rem;
  color: #64748b;
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.treasury-receipt-history-item__amount {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.treasury-receipt-history-item__status {
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}

.treasury-receipt-history-item__status.is-active {
  background: #dcfce7;
  color: #166534;
}

.treasury-receipt-history-item__status.is-void {
  background: #fee2e2;
  color: #991b1b;
}

.treasury-receipt-page .page-header {
  max-width: none;
  margin-bottom: 0.75rem;
}

.treasury-receipt-centered {
  max-width: 480px;
  margin: 0 auto;
}

.treasury-receipt-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-items: start;
}

.treasury-receipt-panel {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  background: #fff;
  overflow: visible;
}

.treasury-receipt-customer-field .customer-picker {
  position: relative;
  max-width: none;
}

.treasury-customer-balance-line {
  display: none;
}

.treasury-receipt-date-field .sale-date-field {
  width: 100%;
}

.treasury-receipt-date-field .sale-date-field-control,
.treasury-receipt-date-field .sale-date-field-picker {
  width: 100%;
  min-height: 2.15rem;
}

.treasury-receipt-form .form-field-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

.treasury-receipt-form .form-field {
  margin: 0;
}

.treasury-receipt-form .sale-input--compact,
.treasury-receipt-form select.form-input {
  width: 100%;
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
}

.treasury-receipt-form textarea.form-input {
  min-height: 4.5rem;
  resize: vertical;
}

.treasury-amount-input,
.treasury-alloc-table .treasury-alloc-input {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .treasury-receipt-workspace {
    grid-template-columns: 1fr;
  }

  .treasury-receipt-history-body {
    max-height: 320px;
  }

  .treasury-receipt-customer-block {
    grid-template-columns: 1fr;
  }

  .treasury-customer-balance-badge {
    grid-column: 1;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .treasury-receipt-page--create {
    padding: 0.4rem 0.75rem 0.6rem;
  }

  .treasury-receipt-details-grid,
  .treasury-receipt-field-row {
    grid-template-columns: 1fr;
  }

  .treasury-receipt-command-bar {
    padding: 0.65rem 0.75rem;
  }

  .treasury-receipt-centered {
    max-width: none;
  }
}

.treasury-receipt-page--view {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  min-height: calc(100dvh - var(--app-header-height, 4.75rem));
  margin: 0;
  padding: 0.65rem 1rem 0.85rem;
  box-sizing: border-box;
}

.treasury-receipt-workspace--view {
  flex: 1;
  min-height: 0;
}

.treasury-receipt-panel--view.is-void-voucher {
  border-color: #fecaca;
}

.treasury-receipt-view-status {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
}

.treasury-receipt-view-status.is-active {
  background: #dcfce7;
  color: #166534;
}

.treasury-receipt-view-status.is-void {
  background: #fee2e2;
  color: #991b1b;
}

.treasury-receipt-view-body {
  gap: 1rem;
}

.treasury-receipt-view-amount-block {
  padding: 1rem 1.1rem;
  border-radius: 0.75rem;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  text-align: center;
}

.treasury-receipt-view-amount-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e40af;
}

.treasury-receipt-view-amount {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.treasury-receipt-view-customer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
}

.treasury-receipt-view-customer strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
  color: #0f172a;
}

.treasury-receipt-view-meta-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.treasury-customer-balance-badge--static {
  grid-column: auto;
}

.treasury-receipt-view-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}

.treasury-receipt-view-meta div {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  background: #fff;
}

.treasury-receipt-view-meta dt {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.treasury-receipt-view-meta dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.treasury-receipt-view-notes,
.treasury-receipt-view-allocations {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
}

.treasury-receipt-view-notes p {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #334155;
}

.treasury-receipt-view-alloc-list {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
}

.treasury-receipt-view-alloc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.86rem;
}

.treasury-receipt-view-alloc-list li:last-child {
  border-bottom: none;
}

.treasury-receipt-history-item.is-current {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.treasury-receipt-history-item__link.is-current {
  color: #1d4ed8;
  font-weight: 800;
}

.treasury-receipt-history-item__link.is-current small {
  font-weight: 600;
  color: #3b82f6;
}

.treasury-receipt-print-sheet {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 14mm;
  }

  body {
    background: #fff !important;
  }

  .no-print,
  .app-header,
  .flash-banner,
  .page-progress,
  .network-wait-overlay,
  .toast-container,
  .treasury-receipt-chrome,
  .treasury-receipt-workspace,
  .treasury-receipt-print-toolbar {
    display: none !important;
  }

  .main-content.treasury-receipt-page {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
  }

  .main-content.treasury-receipt-print-page {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
  }

  .treasury-receipt-print-sheet {
    display: block !important;
  }

  .treasury-receipt-print-page {
    position: relative;
    color: #000;
    font-size: 11pt;
    line-height: 1.45;
  }

  .treasury-receipt-print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #000;
  }

  .treasury-receipt-print-brand h1 {
    margin: 0;
    font-size: 16pt;
  }

  .treasury-receipt-print-brand p {
    margin: 0.2rem 0 0;
    font-size: 9pt;
    color: #333;
  }

  .treasury-receipt-print-doc {
    text-align: left;
  }

  .treasury-receipt-print-doc h2 {
    margin: 0;
    font-size: 14pt;
  }

  .treasury-receipt-print-doc p {
    margin: 0.2rem 0 0;
    font-size: 13pt;
    font-weight: 700;
  }

  .treasury-receipt-print-void-mark {
    position: absolute;
    inset: 35% 10% auto;
    text-align: center;
    font-size: 42pt;
    font-weight: 800;
    color: rgba(220, 38, 38, 0.18);
    transform: rotate(-18deg);
    pointer-events: none;
  }

  .treasury-receipt-print-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border: 2px solid #000;
    border-radius: 4px;
  }

  .treasury-receipt-print-amount strong {
    font-size: 18pt;
    font-weight: 800;
  }

  .treasury-receipt-print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
  }

  .treasury-receipt-print-table th,
  .treasury-receipt-print-table td {
    border: 1px solid #333;
    padding: 0.45rem 0.6rem;
    text-align: right;
    vertical-align: top;
  }

  .treasury-receipt-print-table th {
    width: 32%;
    background: #f3f4f6;
    font-weight: 700;
  }

  .treasury-receipt-print-notes,
  .treasury-receipt-print-alloc {
    margin-bottom: 0.85rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #999;
    border-radius: 3px;
  }

  .treasury-receipt-print-alloc ul {
    margin: 0.35rem 0 0;
    padding: 0 1.1rem 0 0;
  }

  .treasury-receipt-print-footer {
    margin-top: 2.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #999;
  }

  .treasury-receipt-print-sign {
    display: inline-block;
    width: 42%;
    margin: 0 3% 1.5rem;
    vertical-align: top;
  }

  .treasury-receipt-print-sign-line {
    height: 2.2rem;
    margin-top: 0.35rem;
    border-bottom: 1px solid #000;
  }

  .treasury-receipt-print-meta {
    margin: 0;
    font-size: 8.5pt;
    color: #555;
    text-align: center;
  }
}

@media (max-width: 960px) {
  .treasury-receipt-view-customer-row {
    grid-template-columns: 1fr;
  }

  .treasury-receipt-view-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .treasury-receipt-page--view {
    padding: 0.5rem 0.65rem 0.75rem;
  }
}

.treasury-receipt-customer-row {
  display: none;
}

.treasury-receipts-list-page {
  --records-list-chrome-height: 12.5rem;
}

@media (max-width: 599px) {
  .treasury-receipts-list-page {
    --records-list-chrome-height: 16.5rem;
  }
}

.treasury-receipts-list-page .sales-list-sticky-bar {
  margin: -0.25rem 0 0.35rem;
}

.treasury-receipts-list-page .sales-list-table-wrap {
  margin-top: 0.15rem;
}

.treasury-receipts-list-page .treasury-receipts-col-muted:not(.col-history-notes) {
  max-width: 8.5rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.treasury-receipts-list-page .col-history-notes.treasury-receipts-col-muted,
.treasury-payments-list-page .col-history-notes.treasury-receipts-col-muted {
  color: #64748b;
  overflow: visible;
  text-overflow: unset;
}

.treasury-receipts-list-page .treasury-receipts-table .col-history-num,
.treasury-receipts-list-page .treasury-receipts-table .col-history-date,
.treasury-receipts-list-page .treasury-receipts-table .col-history-amount,
.treasury-payments-list-page .treasury-receipts-table .col-history-num,
.treasury-payments-list-page .treasury-receipts-table .col-history-date,
.treasury-payments-list-page .treasury-receipts-table .col-history-amount {
  width: 1%;
  white-space: nowrap;
  padding-inline: 0.35rem;
}

.treasury-receipts-list-page .treasury-receipts-table .col-history-notes,
.treasury-payments-list-page .treasury-receipts-table .col-history-notes {
  width: auto;
  min-width: 12rem;
  max-width: none;
  text-align: start;
  white-space: normal;
  word-break: break-word;
}

.treasury-receipts-list-page .treasury-receipts-row--void,
.treasury-payments-list-page .treasury-receipts-row--void {
  opacity: 0.62;
}

.treasury-receipts-list-page .treasury-receipts-row--void td:nth-child(6),
.treasury-payments-list-page .treasury-receipts-row--void td:nth-child(6) {
  text-decoration: line-through;
  color: #94a3b8;
}

.treasury-receipts-void-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #b91c1c;
  white-space: nowrap;
}

.treasury-receipt-print-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.65rem 1rem 1rem;
}

.treasury-receipt-print-page .treasury-receipt-print-sheet {
  display: block;
  margin-top: 0.85rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

@media (max-width: 1100px) {
  .treasury-receipts-list-page .treasury-receipts-col-muted:not(.col-history-notes),
  .treasury-payments-list-page .treasury-receipts-col-muted:not(.col-history-notes) {
    max-width: 6.5rem;
  }
}

@media (max-width: 960px) {
  .treasury-receipt-print-page {
    padding: 0.5rem 0.65rem 0.75rem;
  }
}

.treasury-customer-picker {
  position: relative;
}

.treasury-customer-balance-card {
  display: none;
}

.treasury-receipt-fields-grid {
  margin-bottom: 0;
}

.treasury-alloc-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.treasury-alloc-summary {
  margin: 0.55rem 0.85rem 0.75rem;
  font-size: 0.84rem;
  color: #475569;
}

.treasury-alloc-summary strong {
  font-weight: 700;
  color: #0f172a;
}

.treasury-alloc-table td[dir="ltr"],
.treasury-alloc-table th:nth-child(n+2):nth-child(-n+4) {
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* نقل الاصناف بين المخازن */
.wtr-toolbar {
  display: block;
}

.wtr-toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.55rem 0.7rem;
  width: 100%;
  min-width: 0;
}

.wtr-toolbar .wtr-warehouse-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.55rem 0.7rem;
  flex: 0 1 auto;
  min-width: 0;
}

.wtr-warehouse-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 0 0 auto;
  min-width: 5.5rem;
  max-width: 6.75rem;
  width: 6.75rem;
}

.wtr-warehouse-field .supply-request-stock-select {
  height: 2.15rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.78rem;
}

.wtr-warehouse-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  min-height: 1.35rem;
}

.wtr-warehouse-field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  flex: 0 0 auto;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  white-space: nowrap;
}

.wtr-warehouse-field-label .ui-icon {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--color-primary, #1e3a5f);
  flex-shrink: 0;
}

.wtr-stock-filter-sm {
  flex: 0 0 auto;
  width: auto;
  min-width: 3.5rem;
  max-width: 4.5rem;
  padding: 0.08rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  color: var(--color-text);
}

.wtr-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  flex: 0 0 auto;
  align-self: flex-end;
  margin-inline-start: auto;
}

.wtr-toolbar .wtr-search-row,
.wtr-toolbar-row .wtr-search-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  flex: 1 1 18rem;
  min-width: 14rem;
  max-width: 28rem;
  align-self: flex-end;
  margin: 0;
}

.wtr-search-field {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.wtr-search-field--code {
  flex: 0 0 5rem;
  max-width: 5rem;
}

.wtr-search-input {
  width: 100%;
  height: 2.15rem;
  box-sizing: border-box;
  padding: 0.28rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  font-size: 0.8rem;
  background: var(--color-surface, #fff);
  color: var(--color-text);
}

.wtr-search-field--code .wtr-search-input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.wtr-search-input:focus {
  outline: none;
  border-color: #eab308;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.28);
}

.wtr-show-items-btn {
  flex: 0 0 auto;
  align-self: flex-end;
  white-space: nowrap;
}

.wtr-completed-date-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  width: 100%;
  margin: 0;
}

.wtr-completed-date-form .wtr-date-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 0 0 auto;
  min-width: 9.5rem;
}

.wtr-completed-date-form .wtr-date-field > span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.wtr-completed-date-form .sale-date-field {
  --sale-meta-control-h: 2.15rem;
}

.wtr-completed-date-form .sale-date-field-picker {
  min-width: 9.25rem;
  width: 100%;
}

.wtr-completed-show-btn {
  flex: 0 0 auto;
  align-self: flex-end;
  white-space: nowrap;
}

.wtr-pending-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.wtr-pending-toolbar-row .form-hint {
  margin: 0;
}

.wtr-pending-toolbar-row #wtr-bulk-confirm-btn {
  margin-inline-start: auto;
}

.wtr-pending-qty-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
}

.wtr-pending-qty-input {
  width: 3.6rem;
  max-width: 100%;
  height: 1.85rem;
  box-sizing: border-box;
  padding: 0.15rem 0.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.wtr-pending-qty-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.wtr-pending-available {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  line-height: 1.2;
}

.wtr-pending-available.is-over,
.wtr-pending-row.is-qty-over .wtr-pending-available {
  color: #b91c1c;
}

.wtr-pending-row.is-qty-over .wtr-pending-qty-input {
  border-color: #fca5a5;
  color: #991b1b;
}

.wtr-swap-warehouses-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: flex-end;
  width: 1.85rem;
  height: 1.85rem;
  min-width: 1.85rem;
  padding: 0;
  border-radius: 0.4rem;
}

.wtr-swap-warehouses-btn .ui-icon {
  width: 0.9rem;
  height: 0.9rem;
}

@media (max-width: 1100px) {
  .wtr-toolbar .wtr-warehouse-form {
    flex-wrap: wrap;
  }

  .wtr-bulk-actions {
    margin-inline-start: 0;
  }
}

.wtr-bulk-table-wrap {
  max-height: min(50vh, 22rem);
  overflow: auto;
}

.wtr-bulk-table .wtr-bulk-qty {
  width: 5.5rem;
  max-width: 100%;
}

.wtr-confirm-items-table-wrap {
  max-height: min(50vh, 22rem);
  overflow: auto;
  margin-bottom: 0.85rem;
}

.wtr-confirm-items-table .wtr-confirm-storage-location {
  width: 100%;
  min-width: 7rem;
  max-width: 100%;
  font-size: 0.85rem;
}

.wtr-page .wtr-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

.wtr-page .wtr-table .col-check {
  width: 2rem;
}

.wtr-page .wtr-table .col-code {
  width: 2.5rem;
}

.wtr-page .wtr-table .col-part {
  width: 4.4rem;
}

.wtr-page .wtr-table .col-item-name {
  width: auto;
}

.wtr-page .wtr-table .col-manufacturer {
  width: 3.8rem;
}

.wtr-page .wtr-table .col-qty {
  width: 3.6rem;
}

.wtr-page .wtr-table th.col-qty {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
  padding-inline: 0.15rem;
  word-break: break-word;
}

.wtr-page .wtr-table td.col-qty {
  padding-inline: 0.15rem;
}

.wtr-page .wtr-table td.col-qty .inventory-qty-cell {
  margin-inline: auto;
  gap: 0.06rem;
}

.wtr-page .wtr-table td.col-qty .inventory-qty-num {
  font-size: 0.78rem;
}

.wtr-page .wtr-table td.col-qty .inventory-qty-status {
  font-size: 0.56rem;
  padding: 0.02rem 0.18rem;
}

.wtr-page .wtr-table td.col-item-name,
.wtr-page .wtr-table td.col-manufacturer,
.wtr-page .wtr-table td.col-part {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.wtr-page .wtr-table .col-wtr-transfer-status {
  width: 5.6rem;
  text-align: center;
  white-space: nowrap;
  padding-inline: 0.2rem;
}

.wtr-page .wtr-table th.col-wtr-transfer-status {
  font-size: 0.7rem;
  white-space: normal;
  line-height: 1.2;
}

.wtr-page .wtr-table th.col-actions,
.wtr-page .wtr-table td.col-actions {
  left: auto;
  z-index: auto;
  width: 4.6rem;
  min-width: 4.6rem;
  max-width: 4.6rem;
  padding-inline: 0.2rem;
  border-inline-start: none;
  box-shadow: none;
  white-space: nowrap;
}

.wtr-page .wtr-table td.col-actions {
  position: static;
}

.wtr-page .wtr-table thead th.col-actions {
  background: #eef2f7 !important;
}

.wtr-page .wtr-table tbody td.col-actions {
  background: var(--color-surface);
}

.wtr-page .wtr-table .col-actions .table-action-group {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
}

.wtr-page .wtr-table .col-actions .table-action-btn {
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 auto;
}

.wtr-page .wtr-table .col-actions .wtr-open-transfer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wtr-transfer-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.wtr-transfer-status-empty {
  color: #94a3b8;
}

.inventory-card-row--transfer-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}

.wtr-page .wtr-draft-row--pending {
  background: #f0f7ff;
}

.wtr-page .wtr-table-scroller {
  max-height: calc(
    100dvh - var(--app-header-height, 7.35rem) - var(--wtr-chrome-height, 11rem) - 1.75rem
  );
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.wtr-page .wtr-table-scroller .table-wrap {
  overflow: visible;
  max-width: 100%;
}

.wtr-page .wtr-table-scroller--pending,
.wtr-page .wtr-table-scroller--completed {
  overflow-y: auto;
  overflow-x: hidden;
}

.wtr-page .wtr-table-scroller--pending .table-wrap,
.wtr-page .wtr-table-scroller--completed .table-wrap {
  overflow: visible;
}

@media (min-width: 769px) {
  .wtr-page .wtr-table-scroller .wtr-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .wtr-page .wtr-table-scroller .wtr-table thead {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef2f7;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  }

  .wtr-page .wtr-table-scroller .wtr-table thead tr {
    background: #eef2f7;
  }

  .wtr-page .wtr-table-scroller .wtr-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef2f7 !important;
    border-bottom: 1px solid var(--color-border);
  }

  .wtr-page .wtr-table-scroller .supply-request-table.wtr-table thead th.col-actions {
    position: sticky;
    top: 0;
    left: auto;
    z-index: 4;
    border-inline-start: none;
    box-shadow: none;
  }
}

.wtr-page .wtr-table--pending .col-check,
.wtr-page .wtr-table--pending th.col-check,
.wtr-page .wtr-table--pending td.col-check {
  width: 2rem;
}

.wtr-page .wtr-table--pending .col-code,
.wtr-page .wtr-table--completed .col-code {
  width: 2.6rem;
}

.wtr-page .wtr-table--pending .col-part,
.wtr-page .wtr-table--completed .col-part {
  width: 4.5rem;
}

.wtr-page .wtr-table--pending .col-manufacturer,
.wtr-page .wtr-table--completed .col-manufacturer {
  width: 3.8rem;
}

.wtr-page .wtr-table--pending .col-item-name,
.wtr-page .wtr-table--completed .col-item-name {
  width: 22%;
}

.wtr-page .wtr-table--pending .col-wtr-wh,
.wtr-page .wtr-table--completed .col-wtr-wh {
  width: 6.1rem;
  max-width: 6.1rem;
  padding-inline: 0.3rem;
  font-size: 0.78rem;
}

.wtr-page .wtr-table--pending th.col-wtr-wh,
.wtr-page .wtr-table--completed th.col-wtr-wh {
  font-size: 0.72rem;
}

.wtr-page .wtr-table--pending td.col-wtr-wh,
.wtr-page .wtr-table--completed td.col-wtr-wh,
.wtr-page .wtr-table--pending td.col-item-name,
.wtr-page .wtr-table--completed td.col-item-name,
.wtr-page .wtr-table--pending td.col-manufacturer,
.wtr-page .wtr-table--completed td.col-manufacturer,
.wtr-page .wtr-table--pending td.col-part,
.wtr-page .wtr-table--completed td.col-part {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.wtr-page .wtr-table--pending .col-qty,
.wtr-page .wtr-table--completed .col-qty {
  width: 4.6rem;
}

.wtr-page .wtr-table--pending .col-datetime,
.wtr-page .wtr-table--completed .col-datetime {
  width: 5.6rem;
  font-size: 0.72rem;
  white-space: normal;
  line-height: 1.25;
  padding-inline: 0.25rem;
}

.wtr-page .wtr-table--pending th.col-actions,
.wtr-page .wtr-table--pending td.col-actions {
  width: 6.4rem;
  min-width: 6.4rem;
  max-width: 6.4rem;
  left: auto;
  border-inline-start: none;
}

.wtr-page .wtr-table--pending td.col-actions {
  position: static;
}

.wtr-page .wtr-table--pending .col-actions .table-action-group {
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.2rem;
}

.wtr-page .wtr-table--pending .col-actions .btn {
  padding: 0.22rem 0.4rem;
  font-size: 0.72rem;
  min-width: 0;
}

.wtr-toolbar .supply-request-toolbar-inline-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 11rem;
}

.wtr-toolbar .supply-request-toolbar-inline-field span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.wtr-hint {
  margin: 0.65rem 0 0;
  padding-inline: 0.25rem;
}

.wtr-print-toolbar {
  margin-bottom: 1rem;
}

.wtr-print-sheet {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  background: #fff;
  color: #111;
}

.wtr-print-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  text-align: center;
}

.wtr-print-meta {
  margin: 0.2rem 0;
  font-size: 0.92rem;
}

.wtr-print-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
}

.wtr-print-table th,
.wtr-print-table td {
  border: 1px solid #cbd5e1;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
}

.item-search-report-print-table .col-code {
  width: 4.5rem;
  white-space: nowrap;
}

.item-search-report-print-table td:nth-child(4) {
  min-width: 12rem;
}

.inventory-custom-report-dialog.crud-modal--wide {
  max-width: 560px;
}

.inventory-custom-report-dialog .modal-header {
  padding: 0.75rem 1rem;
}

.inventory-custom-report-dialog .modal-header h2 {
  font-size: 1rem;
}

.inventory-custom-report-intro {
  margin: 0;
  padding: 0.55rem 1rem 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.inventory-custom-report-body {
  padding: 0 1rem 0.65rem;
}

.inventory-custom-report-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.55rem;
  overflow: hidden;
  background: var(--color-bg);
}

.inventory-custom-report-panel:last-child {
  margin-bottom: 0;
}

.inventory-custom-report-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--color-surface-muted, rgba(0, 0, 0, 0.03));
  border-bottom: 1px solid var(--color-border);
}

.inventory-custom-report-section {
  margin-bottom: 1rem;
}

.inventory-custom-report-section-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.inventory-custom-report-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.inventory-custom-report-section-head .inventory-custom-report-section-title {
  margin: 0;
}

.inventory-custom-report-column-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.inventory-custom-report-column-actions .btn-sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.inventory-custom-report-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
  padding: 0.55rem 0.6rem 0.45rem;
}

.inventory-custom-report-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 0;
}

.inventory-custom-report-field input,
.inventory-custom-report-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 400;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.inventory-custom-report-stock-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  padding: 0 0.6rem 0.45rem;
}

.inventory-custom-report-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.inventory-custom-report-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.75rem, 1fr));
  gap: 0.2rem 0.45rem;
  padding: 0.45rem 0.6rem 0.55rem;
  border: none;
  border-radius: 0;
  background: transparent;
}

.inventory-custom-report-column {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
}

.inventory-custom-report-column input {
  margin: 0;
  flex-shrink: 0;
}

.inventory-custom-report-sort-grid {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.inventory-custom-report-stock-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.75rem;
  flex: 1;
  min-width: 0;
}

.inventory-custom-report-stock-option {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}

.inventory-custom-report-stock-option input {
  margin: 0;
  flex-shrink: 0;
}

.inventory-custom-report-micro-hint {
  margin: 0;
  padding: 0 0.6rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--color-text-muted);
}

.inventory-custom-report-dialog .modal-footer {
  padding: 0.55rem 1rem 0.75rem;
  gap: 0.45rem;
}

@media (max-width: 520px) {
  .inventory-custom-report-filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .inventory-custom-report-filters-grid .inventory-custom-report-field:first-child {
    grid-column: 1 / -1;
  }
}

.inventory-custom-report-print-table {
  table-layout: auto;
}

.inventory-custom-report-print-table td {
  vertical-align: top;
}

.wtr-print-table .wtr-print-avail--over {
  color: #b91c1c;
  font-weight: 700;
}

.wtr-print-total {
  margin-top: 0.75rem;
  font-weight: 600;
}

.wtr-print-signatures {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
}

.wtr-print-signatures > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.wtr-print-sign-line {
  display: block;
  border-bottom: 1px solid #64748b;
  min-height: 1.5rem;
}

@media print {
  .wtr-print-toolbar,
  .no-print {
    display: none !important;
  }

  .wtr-print-sheet {
    max-width: none;
    padding: 0;
  }
}

/* —— رواتب الموظفين (شاشة الاحتساب المضغوطة) —— */
.payroll-edit-page {
  --payroll-gap: 0.55rem;
  padding-block: 0.55rem 0.75rem;
}

.payroll-edit-page .payroll-edit-header {
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  gap: 0.5rem;
}

.payroll-edit-page .payroll-edit-header h1 {
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.25;
}

.payroll-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--payroll-gap);
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
}

.payroll-meta-bar {
  display: grid;
  grid-template-columns: minmax(12rem, 1.4fr) 8rem 5.5rem;
  gap: 0.45rem 0.65rem;
  align-items: end;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.payroll-meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  min-width: 0;
}

.payroll-meta-field > span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
}

.payroll-meta-field .form-input {
  min-height: 2rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.88rem;
}

.payroll-calc-panel {
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.payroll-calc-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  background: #f8fafc;
  width: 100%;
  box-sizing: border-box;
}

.payroll-calc-panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.payroll-calc-panel-head p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted, #64748b);
}

.payroll-table-wrap {
  overflow: visible;
  width: max-content;
  max-width: 100%;
}

.payroll-calc-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.84rem;
}

.payroll-calc-table thead th {
  padding: 0.35rem 0.4rem;
  background: #0f2744;
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: right;
  border: none;
  white-space: nowrap;
}

.payroll-calc-table tbody td {
  padding: 0.3rem 0.35rem;
  vertical-align: middle;
  border-bottom: 1px solid #e8eef5;
  background: #fff;
}

.payroll-calc-table .payroll-col-toggle {
  width: 1%;
  max-width: 2.1rem;
  padding-inline: 0.2rem !important;
  text-align: center;
  white-space: nowrap;
}

.payroll-calc-table thead th.payroll-col-toggle {
  font-size: 0.7rem;
  letter-spacing: 0;
  padding-inline: 0.2rem;
}

.payroll-calc-table .payroll-col-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  vertical-align: middle;
}

.payroll-calc-table .payroll-col-item {
  width: 1%;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  padding-inline: 0.35rem 0.55rem;
}

.payroll-calc-table .payroll-col-item label {
  cursor: pointer;
  margin: 0;
}

.payroll-calc-table .payroll-col-details {
  width: 1%;
  white-space: nowrap;
}

.payroll-calc-table .payroll-col-amount {
  width: 1%;
  min-width: 7rem;
  white-space: nowrap;
  padding-inline: 0.45rem 0.5rem;
}

.payroll-calc-table .payroll-col-muted {
  color: #94a3b8;
  font-weight: 600;
}

.payroll-calc-table .payroll-line {
  opacity: 0.55;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.payroll-calc-table .payroll-line.is-enabled {
  opacity: 1;
}

.payroll-calc-table .payroll-line.is-enabled td {
  background: #f4fbf9;
}

.payroll-calc-table .payroll-line--deductions td {
  background: #fff8f1 !important;
}

.payroll-advance-remaining-info {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted, #64748b);
  line-height: 1.35;
}

.payroll-advance-remaining-info strong {
  color: var(--color-primary-dark, #1e3a5f);
  font-weight: 700;
  margin-inline-start: 0.25rem;
}

.payroll-line[data-line="advance"]:not(.is-enabled) #payroll-advance-deduction {
  opacity: 0.45;
}

.payroll-calc-table .payroll-line--totals td {
  background: #eef6ff !important;
  border-bottom: none;
  padding-block: 0.45rem;
}

.payroll-inline-fields {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.28rem 0.32rem;
  align-items: flex-end;
  vertical-align: middle;
}

.payroll-inline-fields--single {
  flex-wrap: nowrap;
}

.payroll-inline-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  flex: 0 0 auto;
  width: 5.1rem;
  max-width: 5.1rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: #64748b;
}

.payroll-inline-fields--single label {
  width: 5.5rem;
  max-width: 5.5rem;
}

.payroll-inline-fields .form-input,
.payroll-col-amount .form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 1.7rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.payroll-inline-fields input[type="number"] {
  -moz-appearance: textfield;
}

.payroll-inline-fields input[type="number"]::-webkit-outer-spin-button,
.payroll-inline-fields input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.payroll-line-result {
  display: inline-block;
  width: 6.5rem;
  max-width: 6.5rem;
  font-weight: 700;
  text-align: left;
  background: #f8fafc !important;
  color: #0f172a;
}

.payroll-totals-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.payroll-totals-inline > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.payroll-totals-inline span {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
}

.payroll-totals-inline strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.payroll-col-net {
  text-align: center;
}

.payroll-net-label {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.payroll-col-net #payroll-net {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0b5f56;
  font-variant-numeric: tabular-nums;
}

.payroll-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
  background: #fafbfc;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .payroll-form {
    width: 100%;
  }

  .payroll-calc-panel,
  .payroll-table-wrap,
  .payroll-calc-table {
    width: 100%;
  }

  .payroll-meta-bar {
    grid-template-columns: 1fr 1fr;
  }

  .payroll-inline-fields {
    flex-wrap: wrap;
  }

  .payroll-inline-fields label {
    width: 5.25rem;
    max-width: 5.25rem;
  }
}

@media (max-width: 720px) {
  .payroll-meta-bar {
    grid-template-columns: 1fr;
  }

  .payroll-calc-table thead {
    display: none;
  }

  .payroll-calc-table,
  .payroll-calc-table tbody,
  .payroll-calc-table tr,
  .payroll-calc-table td {
    display: block;
    width: 100%;
  }

  .payroll-calc-table tr.payroll-line {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.45rem 0.35rem;
  }

  .payroll-calc-table tbody td {
    border: none;
    padding: 0.2rem 0.25rem;
  }

  .payroll-calc-table .payroll-col-toggle,
  .payroll-calc-table .payroll-col-item {
    display: inline-block;
    width: auto;
    vertical-align: middle;
  }

  .payroll-inline-fields label {
    width: 5rem;
    max-width: 5rem;
  }
}

.rent-edit-page .payroll-calc-panel {
  overflow: visible;
  width: min(100%, 36rem);
}

.rent-edit-page .form-grid.crud-form-grid {
  padding: 0;
}

.rent-edit-page .rent-date-field .sale-date-field {
  width: 100%;
  z-index: 40;
}

.rent-edit-page .rent-date-field .sale-date-field-control,
.rent-edit-page .rent-date-field .sale-date-field-picker {
  width: 100%;
  max-width: none;
  min-height: 2.35rem;
  height: auto;
}

.payroll-print-toolbar {
  margin-bottom: 0.85rem;
}

.payroll-print-sheet {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 1.35rem;
  background: #fff;
  color: #111827;
  border: 1px solid #cbd5e1;
}

.payroll-print-header {
  text-align: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid #1e293b;
}

.payroll-print-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0;
}

.payroll-print-meta {
  margin: 0;
  color: #475569;
  font-size: 0.82rem;
}

.payroll-print-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
}

.payroll-print-meta-table th,
.payroll-print-meta-table td {
  border: 1px solid #94a3b8;
  padding: 0.4rem 0.55rem;
  vertical-align: middle;
}

.payroll-print-meta-table th {
  width: 18%;
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.payroll-print-meta-table td {
  width: 32%;
  background: #fff;
}

.payroll-print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.86rem;
}

.payroll-print-table thead th {
  background: #1e293b;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #1e293b;
  text-align: right;
}

.payroll-print-table tbody td {
  border: 1px solid #94a3b8;
  padding: 0.45rem 0.55rem;
  vertical-align: top;
  background: #fff;
}

.payroll-print-col-name {
  width: 22%;
  font-weight: 700;
  white-space: nowrap;
}

.payroll-print-col-amount {
  width: 16%;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.payroll-print-details {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.22rem;
}

.payroll-print-details li {
  display: grid;
  grid-template-columns: minmax(8.5rem, 42%) minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  align-items: baseline;
}

.payroll-print-details span {
  color: #64748b;
  font-size: 0.78rem;
}

.payroll-print-details strong {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.84rem;
}

.payroll-print-muted {
  color: #94a3b8;
}

.payroll-print-row-subtotal td {
  background: #f8fafc;
  font-weight: 700;
}

.payroll-print-row-net td {
  background: #e2e8f0;
  font-weight: 800;
  font-size: 0.92rem;
}

.payroll-print-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
  font-size: 0.84rem;
  margin-top: 1.75rem;
  color: #334155;
}

.payroll-print-sign-line {
  display: block;
  border-bottom: 1px solid #475569;
  min-height: 1.75rem;
  margin-top: 1.35rem;
}

@media print {
  .payroll-print-toolbar,
  .payroll-print-page .no-print {
    display: none !important;
  }

  .payroll-print-sheet {
    max-width: none;
    border: none;
    padding: 0;
  }

  .main-content.payroll-print-page {
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 720px) {
  .payroll-print-meta-table,
  .payroll-print-meta-table tbody,
  .payroll-print-meta-table tr,
  .payroll-print-meta-table th,
  .payroll-print-meta-table td {
    display: block;
    width: 100%;
  }

  .payroll-print-details li {
    grid-template-columns: 1fr;
    gap: 0.05rem;
  }
}

/* —— جرد الأصناف —— */
.stocktake-home {
  font-size: 0.9rem;
}

.stocktake-home .page-header h1 {
  font-size: 1.35rem;
}

.stocktake-home-select {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.75rem;
}

.stocktake-wh-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.stocktake-wh-bar-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
  white-space: nowrap;
}

.stocktake-wh-bar-select {
  width: auto;
  min-width: 12rem;
  max-width: 20rem;
  flex: 0 1 16rem;
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
}

.stocktake-wh-bar-btn {
  flex: 0 0 auto;
}

.stocktake-home-lists {
  padding: 0.75rem 0.9rem;
}

.stocktake-home-lists-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.stocktake-home-lists-header h2 {
  margin: 0;
  font-size: 1rem;
}

.stocktake-home .stocktake-create-form {
  margin: 0;
}

.stocktake-home-table-wrap {
  overflow-x: hidden;
}

.stocktake-lists-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.82rem;
}

.stocktake-lists-table th,
.stocktake-lists-table td {
  padding: 0.28rem 0.4rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.stocktake-lists-table th:nth-child(1),
.stocktake-lists-table td:nth-child(1) {
  width: 3.2rem;
}

.stocktake-lists-table th:nth-child(2),
.stocktake-lists-table td:nth-child(2) {
  width: 4.5rem;
}

.stocktake-lists-table th:nth-child(5),
.stocktake-lists-table td:nth-child(5) {
  width: 4.5rem;
  text-align: center;
}

.stocktake-list-workspace {
  font-size: 0.9rem;
}

.stocktake-list-workspace .page-header h1 {
  font-size: 1.35rem;
}

.stocktake-list-workspace .stock-page-card-header h2 {
  font-size: 1rem;
}

.stocktake-list-workspace .stock-page-card-hint,
.stocktake-list-workspace .form-hint {
  font-size: 0.82rem;
  margin-bottom: 0.55rem;
}

.stocktake-list-workspace .stock-page-card {
  padding: 0.75rem 0.85rem;
}

.stocktake-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}

.stocktake-split-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  margin-bottom: 0;
}

.stocktake-split-pane--search {
  order: 1;
}

.stocktake-split-pane--lines {
  order: 2;
}

.stocktake-split-table-wrap {
  flex: 1 1 auto;
  max-height: min(70vh, 40rem);
  overflow-x: hidden;
  overflow-y: auto;
}

.stocktake-split-pane .data-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.74rem;
}

.stocktake-split-pane .data-table th,
.stocktake-split-pane .data-table td {
  padding: 0.18rem 0.22rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.stocktake-pick-table th:nth-child(1),
.stocktake-pick-table td:nth-child(1) {
  width: 11%;
}

.stocktake-pick-table th:nth-child(2),
.stocktake-pick-table td:nth-child(2) {
  width: 18%;
}

.stocktake-pick-table th:nth-child(3),
.stocktake-pick-table td:nth-child(3) {
  width: 43%;
}

.stocktake-pick-table th:nth-child(4),
.stocktake-pick-table td:nth-child(4) {
  width: 12%;
}

.stocktake-pick-table th:nth-child(5),
.stocktake-pick-table td:nth-child(5) {
  width: 16%;
  padding-inline: 0.1rem;
}

.stocktake-pick-table th.stocktake-pick-qty-head,
.stocktake-pick-table th:nth-child(5) {
  white-space: normal;
  font-size: 0.65rem;
  line-height: 1.15;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
}

.stocktake-pick-table td:nth-child(5) {
  white-space: nowrap;
}

.stocktake-lines-table th:nth-child(1),
.stocktake-lines-table td:nth-child(1) {
  width: 2.1rem;
}

.stocktake-lines-table th:nth-child(2),
.stocktake-lines-table td:nth-child(2) {
  width: 2.8rem;
}

.stocktake-lines-table th:nth-child(3),
.stocktake-lines-table td:nth-child(3) {
  width: 18%;
}

.stocktake-lines-table th:nth-child(4),
.stocktake-lines-table td:nth-child(4) {
  width: 24%;
}

.stocktake-lines-table th:nth-child(5),
.stocktake-lines-table td:nth-child(5) {
  width: 12%;
}

.stocktake-lines-table th:nth-child(6),
.stocktake-lines-table td:nth-child(6),
.stocktake-lines-table th:nth-child(7),
.stocktake-lines-table td:nth-child(7) {
  width: 3.2rem;
}

.stocktake-lines-table th:nth-child(8),
.stocktake-lines-table td:nth-child(8) {
  width: 3.6rem;
  text-align: center;
}

.stocktake-lines-table .stocktake-line-delete {
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.2;
}

.stocktake-pick-filters-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stocktake-pick-filters-row .inventory-filter-label span {
  font-size: 0.78rem;
}

.stocktake-pick-filters-row input {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}

.stocktake-pick-row {
  cursor: pointer;
}

.stocktake-pick-row:hover,
.stocktake-pick-row:focus {
  background: rgba(0, 0, 0, 0.04);
  outline: none;
}

@media (max-width: 1100px) {
  .stocktake-split {
    grid-template-columns: 1fr;
  }

  .stocktake-split-pane--search {
    order: 0;
  }

  .stocktake-split-pane--lines {
    order: 1;
  }

  .stocktake-split-table-wrap {
    max-height: min(50vh, 28rem);
  }
}

.stocktake-item-meta th {
  width: 12rem;
  font-weight: 600;
}

.stocktake-already-counted {
  font-weight: 700;
  font-size: 1.1em;
}

.stocktake-count-dialog {
  max-width: 420px;
}

.stocktake-count-dialog-body {
  padding: 0.85rem 1.15rem 0.35rem;
}

.stocktake-count-dialog .stocktake-item-meta {
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
}

.stocktake-count-dialog .stocktake-item-meta th,
.stocktake-count-dialog .stocktake-item-meta td {
  padding: 0.28rem 0.4rem;
}

.stocktake-modal-qty-label {
  display: block;
  margin: 0.5rem 0 0.75rem;
  font-weight: 600;
}

.stocktake-modal-qty-label input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font-size: 1.05rem;
  padding: 0.45rem 0.55rem;
}

.stocktake-modal-error {
  color: #b42318;
  margin: 0 0 0.5rem;
}

.stocktake-row--surplus td:last-child {
  color: #0a7a3e;
}

.stocktake-row--shortage td:last-child {
  color: #b42318;
}

.stocktake-row--not-counted td:last-child {
  color: #6b7280;
}

.stocktake-sync-card {
  border-color: rgba(180, 35, 24, 0.25);
}

.stocktake-report-page {
  font-size: 0.9rem;
}

.stocktake-report-filters {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}

.stocktake-report-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.stocktake-report-filter-item {
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
}

.stocktake-report-filter-select {
  width: auto;
  min-width: 10rem;
  max-width: 16rem;
  flex: 0 1 14rem;
  font-size: 0.88rem;
  padding: 0.35rem 0.5rem;
}

.stocktake-report-results {
  background: #fff;
  border: 1px solid var(--color-border, #d7dee8);
  border-radius: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  margin-bottom: 0.75rem;
}

.stocktake-report-results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stocktake-report-results-header h2 {
  margin: 0;
  font-size: 1rem;
}

.stocktake-report-table-wrap {
  overflow-x: auto;
  border-radius: 0;
}

.stocktake-report-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.8rem;
  border-radius: 0;
}

.stocktake-report-table th,
.stocktake-report-table td {
  padding: 0.22rem 0.35rem;
  line-height: 1.25;
  border-radius: 0;
}

.stocktake-report-table thead th {
  border-radius: 0;
}

.stocktake-sync-dialog {
  max-width: 460px;
}

.stocktake-sync-dialog-body {
  padding: 0.9rem 1.15rem 0.35rem;
}

.stocktake-sync-warning {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.stocktake-sync-warning p {
  margin: 0 0 0.45rem;
}

.stocktake-sync-warning p:last-child {
  margin-bottom: 0;
}

.stocktake-sync-password-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.stocktake-sync-password-label input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.55rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body.is-navigating {
    opacity: 1;
  }
}

/* Legacy import hub — compact two-section tables */
.legacy-import-page .legacy-hub-status-line {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.legacy-wipe-form .legacy-wipe-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  max-width: 28rem;
}

.legacy-wipe-form .legacy-wipe-row .form-control {
  flex: 1 1 12rem;
}

.legacy-hub-section {
  margin: 1.25rem 0 1.75rem;
}

.legacy-hub-section-title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark, #0f172a);
}

.legacy-hub-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
}

.legacy-hub-table {
  margin: 0;
  width: 100%;
  border-collapse: collapse;
}

.legacy-hub-table th,
.legacy-hub-table td {
  padding: 0.4rem 0.55rem;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.84rem;
}

.legacy-hub-table thead th {
  background: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}

.legacy-hub-table tbody tr:last-child td {
  border-bottom: 0;
}

.legacy-hub-name-cell {
  min-width: 14rem;
}

.legacy-hub-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.legacy-hub-name {
  font-weight: 600;
  color: #0f172a;
}

.legacy-hub-count {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.legacy-hub-note {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: #b45309;
  line-height: 1.4;
}

.legacy-hub-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: help;
  padding: 0;
  vertical-align: middle;
}

.legacy-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.legacy-hub-actions .btn-sm {
  padding: 0.22rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.legacy-hub-hidden-form {
  display: none;
}

.legacy-hub-upload-form {
  margin: 0;
}

.legacy-hub-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.legacy-hub-file-input {
  max-width: 14rem;
  font-size: 0.75rem;
  padding: 0.15rem;
}

.legacy-hub-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.legacy-hub-export-wh-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.legacy-hub-export-wh-form select {
  max-width: 9.5rem;
  font-size: 0.75rem;
  padding: 0.18rem 0.3rem;
}

.legacy-hub-export-zeros-check {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.legacy-hub-export-zeros-check input {
  margin: 0;
}

.legacy-hub-report-list {
  margin: 0;
  padding-inline-start: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.55;
}

.legacy-hub-report-list li + li {
  margin-top: 0.25rem;
}

@media (max-width: 720px) {
  .legacy-hub-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .legacy-hub-export-wh-form {
    flex-direction: column;
    align-items: stretch;
  }

  .legacy-hub-export-wh-form select {
    max-width: 100%;
  }

  .legacy-hub-upload-row {
    flex-direction: column;
    align-items: stretch;
  }

  .legacy-hub-file-input {
    max-width: 100%;
  }
}

.sale-whatsapp-panel {
  margin-top: 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid #bbf7d0;
  border-radius: 0.75rem;
  background: #f0fdf4;
}

.sale-whatsapp-panel-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #166534;
}

.sale-whatsapp-panel-lead {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: #3f6212;
}

.sale-whatsapp-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sale-whatsapp-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #16a34a;
  border-color: #16a34a;
}

.sale-whatsapp-send-btn:hover,
.sale-whatsapp-send-btn:focus-visible {
  background: #15803d;
  border-color: #15803d;
}

.sale-whatsapp-panel-error,
.sale-whatsapp-list-msg {
  margin: 0.55rem 0 0;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 500;
}

.sale-whatsapp-panel-ok {
  margin: 0.55rem 0 0;
  color: #166534;
  font-size: 0.85rem;
}

.sale-whatsapp-sent-panel {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  background: #f0fdf4;
}

.sale-whatsapp-sent-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #166534;
}

.sale-whatsapp-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.table-action-btn--whatsapp {
  color: #15803d;
}

.table-action-btn--whatsapp:hover {
  background: #dcfce7;
  color: #166534;
}

.sale-invoice-print-embed {
  margin: 0;
  background: #fff;
}

.sale-invoice-print-page-wrap {
  background: #e5e7eb;
  padding-block: 1rem;
}

.sale-invoice-print-sheet {
  background: #fff;
  color: #111;
}

.sale-invoice-print-sheet--formal {
  max-width: 210mm;
  margin: 0 auto;
  box-shadow: 0 0 0 1px #d1d5db;
}

.sale-invoice-print-page {
  padding: 1.1rem 1.25rem;
  background: #fff;
}

.sale-invoice-print-page--formal {
  padding: 10mm 11mm 8mm;
  min-height: 277mm;
  display: flex;
  flex-direction: column;
  font-family: "Traditional Arabic", "Simplified Arabic", Arial, "Times New Roman", Tahoma, sans-serif;
  color: #111;
}

.sale-invoice-print-page--receipt {
  page-break-before: always;
  break-before: page;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed #cbd5e1;
}

.sale-invoice-print-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #1e3a5f;
}

.sale-invoice-print-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  color: #1e3a5f;
}

.sale-invoice-print-brand p,
.sale-invoice-print-doc p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.sale-invoice-print-doc {
  text-align: left;
}

.sale-invoice-print-doc h2 {
  margin: 0;
  font-size: 1rem;
}

.sale-invoice-print-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem 0.8rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
}

.sale-invoice-print-meta span {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
}

.sale-invoice-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.sale-invoice-print-table th,
.sale-invoice-print-table td {
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.45rem;
  text-align: right;
}

.sale-invoice-print-table th {
  background: #f8fafc;
}

.sale-invoice-print-line-note {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
}

.sale-invoice-print-empty {
  text-align: center;
  color: #94a3b8;
}

.sale-invoice-print-totals {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  max-width: 16rem;
  margin-inline-start: auto;
}

.sale-invoice-print-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.sale-invoice-print-grand {
  font-weight: 700;
  border-top: 1px solid #cbd5e1;
  padding-top: 0.3rem;
}

.sale-invoice-print-notes {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
}

.sip-identity {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 3px double #1a1f2e;
}

.sip-identity-ar {
  min-width: 0;
  text-align: right;
}

.sip-identity h1 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  color: #0b4f6c;
  line-height: 1.25;
}

.sip-identity p {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: #374151;
  line-height: 1.35;
}

.sip-identity-phone {
  font-weight: 700;
  color: #1a1f2e;
}

.sip-logo {
  flex: 0 0 auto;
  line-height: 0;
}

.sip-parties {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0.35rem 0;
  margin: 0.5rem 0 0.45rem;
  table-layout: fixed;
}

.sip-parties tr {
  vertical-align: top;
}

.sip-party-box {
  width: 25%;
  vertical-align: top;
  border: 1px solid #1a1f2e;
  background: #fff;
  padding: 0.38rem 0.5rem 0.42rem;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  color: #111;
}

.sip-party-box--pack {
  width: 12%;
}

.sip-party-box--account {
  width: 30%;
}

.sip-party-box--doc,
.sip-party-box--account {
  background: #f8fafc;
}

.sip-party-box h2 {
  margin: 0 0 0.25rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #8a1f1f;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 0.16rem;
}

.sip-party-box p {
  margin: 0.12rem 0 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sip-party-name,
.sip-invoice-no {
  color: #b71c1c;
}

.sip-party-name {
  font-size: 0.92rem !important;
  font-weight: 800;
}

.sip-invoice-no {
  font-size: 0.92rem;
  font-weight: 800;
}

.sip-party-sep {
  margin: 0 0.35rem;
  color: #9ca3af;
  font-weight: 400;
}

.sip-doc-date {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-size: 0.76rem;
}

.sip-date {
  display: inline-table;
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  border: none;
  direction: rtl;
  vertical-align: middle;
  font-variant-numeric: tabular-nums lining-nums;
}

.sip-date td {
  border: none;
  padding: 0 0.04em;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: inherit;
  line-height: inherit;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.sip-date td.sip-date-label {
  padding: 0 0 0 0.28em;
  text-align: right;
  font-size: 0.76rem;
  font-weight: 700;
}

.sip-date-box {
  min-width: 1.2em;
}

.sip-date-box--year {
  min-width: 2.4em;
}

.sip-date-sep {
  width: 0.4em;
}

.sip-date-suffix {
  padding-left: 0.35em;
}

.sip-summary-words,
.sip-notes {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sip-table {
  margin-top: 0.35rem;
  border: 1px solid #111;
  table-layout: fixed;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  color: #111;
}

.sip-table th,
.sip-table td {
  border: 1px solid #111;
  padding: 0.18rem 0.2rem;
  text-align: center;
  vertical-align: middle;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sip-table th {
  background: #4b5563;
  color: #fff;
  white-space: nowrap;
}

.sip-table td.sip-col-name,
.sip-table td.sip-col-part {
  text-align: right;
}

.sip-col-num { width: 2rem; }

.sip-col-code {
  width: calc(4ch + 0.55rem);
  white-space: nowrap;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.sip-col-name {
  font-size: 0.82rem;
}

.sip-col-part {
  width: calc(11ch + 0.55rem);
}

.sip-part-main {
  display: block;
  white-space: nowrap;
}

.sip-part-rest {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sip-col-mfr {
  width: 12ch;
  max-width: 12ch;
  text-align: center;
}

.sip-col-qty { width: 3.2rem; }

.sip-col-price,
.sip-col-total {
  width: 5.4rem;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.01em;
}

.sip-table tfoot td {
  border: 1px solid #111;
  border-top: none;
  padding: 0.38rem 0.35rem;
  text-align: center;
  vertical-align: middle;
  font-size: 0.88rem;
  font-weight: 700;
  background: #fff;
}

.sip-summary-row td strong,
.sip-summary-net-num {
  font-family: Arial, Helvetica, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 0.98rem;
  font-weight: 700;
}

.sip-summary-words {
  text-align: right;
  font-size: 0.9rem;
  font-weight: 700;
}

.sip-summary-words span {
  color: #1d4ed8;
  font-weight: 800;
}

.sip-summary-net-num {
  font-size: 1.08rem;
  font-weight: 800;
}

.sip-summary-discount {
  white-space: nowrap;
}

.sip-discount-pct {
  font-weight: 600;
  color: #374151;
  font-size: 0.74rem;
}

.sip-notes {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
}

.sip-party-box--pack {
  background: #f8fafc;
  padding: 0.38rem 0.35rem 0.42rem;
}

.sip-party-box--pack p {
  display: grid;
  grid-template-columns: 4.05em 0.55em 1.35em;
  justify-content: start;
  align-items: baseline;
  column-gap: 0.08rem;
  margin: 0.06rem 0 0;
  font-size: 0.68rem;
  line-height: 1.2;
}

.sip-pack-label {
  text-align: justify;
  text-align-last: justify;
}

.sip-pack-label--rolls {
  letter-spacing: 0.34em;
}

.sip-pack-colon {
  text-align: center;
}

.sip-party-box--pack strong {
  text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
}

.sip-party-box--account p {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.sip-auth {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.1rem;
  font-size: 0.78rem;
  text-align: center;
}

.sip-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.35rem;
  border-top: 1px solid #6b7280;
  font-size: 0.74rem;
  color: #111;
}

@media print {
  .sale-invoice-print-toolbar,
  .sale-invoice-print-page-wrap .no-print,
  .app-header,
  .app-nav {
    display: none !important;
  }

  .sale-invoice-print-page-wrap,
  .sale-invoice-print-embed,
  .main-content.sale-invoice-print-page-wrap {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .sale-invoice-print-sheet--formal {
    max-width: none;
    box-shadow: none;
  }

  .sale-invoice-print-page--formal {
    min-height: auto;
    padding: 0;
  }

  .sip-table thead {
    display: table-header-group;
  }

  .sip-table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .sip-table tfoot {
    display: table-footer-group !important;
  }

  .sip-summary-row,
  .sip-summary-net {
    display: table-row !important;
  }

  .sip-table tfoot td {
    display: table-cell !important;
    width: auto !important;
  }

  .sip-identity,
  .sip-parties,
  .sip-auth {
    display: grid !important;
  }

  .sip-identity {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
  }

  .sip-parties {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0.35rem 0 !important;
  }

  .sip-parties tr {
    display: table-row !important;
  }

  .sip-party-box {
    display: table-cell !important;
    height: auto !important;
    vertical-align: top !important;
  }

  .sip-auth {
    grid-template-columns: 1fr 1fr 1fr !important;
  }

  .sip-footer {
    display: flex !important;
  }

  @page {
    size: A4;
    margin: 8mm 8mm 10mm;
  }
}

@media screen and (max-width: 720px) {
  .sip-auth {
    grid-template-columns: 1fr;
    display: grid;
  }

  .sip-side {
    text-align: right;
  }

  .sip-side,
  .sip-footer {
    text-align: right;
  }
}

.sale-invoice-print-receipt-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.sale-invoice-print-receipt-img {
  display: block;
  max-width: 100%;
  max-height: 220mm;
  margin: 0 auto;
}

.sale-invoice-print-receipt-pdf {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sale-invoice-print-receipt-pdf-page {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  page-break-inside: avoid;
  break-inside: avoid;
}

.sale-invoice-print-receipt-fallback {
  color: #475569;
  font-size: 0.9rem;
}

.sale-invoice-auto-download {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  background: #f0fdf4;
}

.sale-invoice-auto-download-msg {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #166534;
}

.sale-invoice-auto-download-msg.is-error {
  color: #b91c1c;
}

.sale-invoice-auto-download .btn {
  margin-top: 0.25rem;
}
