/* ==========================================================================
   Quotations View - Minimal Sleek Aesthetic & Sortable Table Design
   Pure Monochrome Theme (Dark & Light)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Quotations View Header (Title + Import & Three Dots Actions)
   -------------------------------------------------------------------------- */
.quotations-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
  position: relative;
  min-height: 38px;
}

.view-header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  max-width: 240px;
  overflow: hidden;
  transition: max-width 240ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 200ms ease,
              transform 200ms ease;
  white-space: nowrap;
}

.quotations-title {
  font-family: var(--font-brand);
  font-size: 1.15rem; /* 18.5px - balanced and not too big compared to company name */
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
  min-width: 0;
}

.btn-view-icon-action {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.btn-view-icon-action:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.btn-view-icon-action:active {
  transform: scale(0.97);
}

.action-btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-view-icon-action.active,
.btn-view-icon-action[aria-expanded="true"] {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   0b. Three-Dots Floating Options Popup Menu
   -------------------------------------------------------------------------- */
.options-menu-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.options-dropdown-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  width: max-content;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  padding: 4px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.options-dropdown-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  box-sizing: border-box;
  white-space: nowrap;
}

.dropdown-menu-item:hover,
.dropdown-menu-item:focus-visible {
  background-color: var(--bg-secondary);
}

.dropdown-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.dropdown-menu-item:hover .dropdown-item-icon {
  color: var(--text-primary);
}

.dropdown-item-icon svg {
  width: 15px;
  height: 15px;
}

.dropdown-item-title {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  line-height: 1;
}

/* --------------------------------------------------------------------------
   0c. Collapsible Minimal Search Bar (Placed in Header left of Three Dots)
   -------------------------------------------------------------------------- */
.collapsible-search-wrapper {
  position: relative;
  height: 38px;
  width: 38px;
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-sizing: border-box;
  overflow: hidden;
  transition: width 260ms cubic-bezier(0.16, 1, 0.3, 1), 
              border-color var(--transition-fast), 
              background-color var(--transition-fast), 
              box-shadow var(--transition-fast);
}

.collapsible-search-wrapper:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.collapsible-search-wrapper.expanded {
  width: 280px;
  background-color: var(--bg-surface);
  border-color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.collapsible-search-wrapper:not(.expanded) {
  width: 38px !important;
  overflow: hidden !important;
  border-color: var(--border-subtle) !important;
  box-shadow: none !important;
}

.collapsible-search-wrapper:not(.expanded) .btn-search-close {
  display: none !important;
}

.collapsible-search-wrapper.expanded .btn-search-close {
  display: inline-flex !important;
}

.btn-search-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  padding: 0;
  transition: color var(--transition-fast);
}

.collapsible-search-wrapper:hover .btn-search-toggle,
.collapsible-search-wrapper.expanded .btn-search-toggle,
.collapsible-search-wrapper:focus-within .btn-search-toggle {
  color: var(--text-primary);
}

.search-icon-toggle {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.collapsible-search-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 0 28px 0 2px;
  outline: none;
  box-sizing: border-box;
}

.collapsible-search-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.btn-search-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  padding: 0;
  line-height: 1;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-search-close:hover {
  background-color: var(--text-primary);
  color: var(--text-inverted);
}

.collapsible-search-wrapper.expanded .btn-search-close {
  display: inline-flex !important;
}

#view-catalog .quotations-view-header {
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   1. Advanced Search Toggle & Filter Dropdown (Header Elements)
   -------------------------------------------------------------------------- */
.quotations-toolbar-container {
  display: none;
}

/* Embedded Sleek Advanced Search Pill inside Quotations Search Wrapper */
#quote-search-wrapper {
  position: relative;
  height: 38px;
  width: 38px;
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-sizing: border-box;
  overflow: hidden;
  transition: width 260ms cubic-bezier(0.16, 1, 0.3, 1), 
              border-color var(--transition-fast), 
              background-color var(--transition-fast), 
              box-shadow var(--transition-fast);
}

#quote-search-wrapper.expanded {
  width: 380px !important;
  max-width: 100% !important;
  background-color: var(--bg-surface);
  border-color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  overflow: visible !important;
}

#quote-search-wrapper:not(.expanded) {
  width: 38px !important;
  overflow: hidden !important;
  border-color: var(--border-subtle) !important;
  box-shadow: none !important;
}

#quote-search-wrapper:not(.expanded) .btn-search-close,
#quote-search-wrapper:not(.expanded) .adv-search-embedded-pill {
  display: none !important;
}

#quote-search-wrapper.expanded .btn-search-close {
  display: inline-flex !important;
}

#quote-search-wrapper .collapsible-search-input {
  flex: 1;
  min-width: 0;
  padding: 0 6px 0 2px;
}

.adv-search-embedded-pill {
  display: none;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 28px;
  transition: all var(--transition-fast);
}

.collapsible-search-wrapper.expanded .adv-search-embedded-pill,
.collapsible-search-wrapper:focus-within .adv-search-embedded-pill {
  display: inline-flex;
}

.adv-search-embedded-pill:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.adv-search-embedded-pill:has(.advanced-search-checkbox:checked) {
  background-color: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--color-primary, #2563eb);
}

.advanced-search-checkbox.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.adv-pill-track {
  position: relative;
  width: 20px;
  height: 12px;
  border-radius: 6px;
  background-color: var(--border-strong, #cbd5e1);
  transition: background-color 160ms ease;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.advanced-search-checkbox:checked + .adv-pill-track {
  background-color: var(--color-primary, #2563eb);
}

.adv-pill-thumb {
  position: absolute;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.advanced-search-checkbox:checked + .adv-pill-track .adv-pill-thumb {
  transform: translateX(8px);
}

.adv-pill-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

#quote-search-wrapper.adv-mode-active {
  width: 380px !important;
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

#quote-search-wrapper.adv-mode-active .collapsible-search-input {
  color: var(--text-muted);
}

/* When in advanced search mode, hide default filter button completely */
.quotations-view-header.adv-search-active #quote-filter-wrapper,
#view-quotation.adv-search-active #quote-filter-wrapper {
  display: none !important;
}

/* Status Filter Button & Dropdown */
.quote-filter-wrapper {
  position: relative;
  display: inline-flex;
}

.btn-quote-filter {
  position: relative;
  transition: all var(--transition-fast);
}

.btn-quote-filter.has-active-filter {
  width: auto !important;
  min-width: 36px;
  padding: 0 10px;
  gap: 6px;
  border-color: var(--border-strong);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.filter-status-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  line-height: 1;
  white-space: nowrap;
}

.quote-filter-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  animation: quoteDropdownFadeIn 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes quoteDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quote-filter-dropdown-header {
  padding: 6px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.quote-filter-dropdown-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quote-filter-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast);
}

.quote-filter-menu-item:hover {
  background-color: var(--bg-secondary);
}

.quote-filter-menu-item.active {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

.quote-filter-menu-item .filter-check-icon {
  opacity: 0;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
}

.quote-filter-menu-item.active .filter-check-icon {
  opacity: 1;
}

.filter-item-name {
  font-size: 12.5px;
}

.filter-item-status-pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
}

.filter-item-status-pill.status-open {
  background-color: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.filter-item-status-pill.status-paid {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.filter-item-status-pill.status-partially-paid {
  background-color: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.filter-item-status-pill.status-not-paid {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* --------------------------------------------------------------------------
   1b. Advanced Search Dedicated Row
   -------------------------------------------------------------------------- */
.quotations-advanced-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: advSearchSlideDown 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes advSearchSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.adv-search-fields-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.adv-field-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.adv-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.adv-input {
  height: 36px;
  padding: 0 10px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  box-sizing: border-box;
}

.adv-input:focus {
  border-color: var(--text-primary);
  background-color: var(--bg-surface);
}

.adv-text-input {
  width: 190px;
}

.adv-select-input {
  width: 140px;
  cursor: pointer;
  background-color: var(--bg-primary);
}

.adv-select-input option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.adv-date-range-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.adv-date-input {
  width: 132px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.adv-date-sep {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.adv-search-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-adv-submit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background-color: var(--text-primary);
  color: var(--text-inverted);
  border: 1px solid var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-adv-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-adv-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-adv-reset:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   2. Minimal Sleek Table Card Container
   -------------------------------------------------------------------------- */
.quotations-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition-normal), background-color var(--transition-normal);
}

.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.table-scroll-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.quotations-table {
  width: 100%;
  table-layout: fixed; /* Rigid fixed column widths */
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: var(--text-xs);
  min-width: 680px;
}

/* Table Header (Exact 42px height matching footer) */
.quotations-table thead {
  background-color: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 2;
}

.quotations-table thead tr {
  height: 42px;
}

.quotations-table th {
  height: 42px;
  padding: 0 12px;
  font-size: 10.5px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
  vertical-align: middle;
}

/* Sortable column header */
.quotations-table th.sortable-th {
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.quotations-table th.sortable-th:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quotations-table th.text-right .th-inner {
  justify-content: flex-end;
}

.sort-icon {
  width: 12px;
  height: 12px;
  opacity: 0.35;
  transition: opacity var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
  stroke-width: 2.25;
}

.quotations-table th.sortable-th:hover .sort-icon {
  opacity: 0.75;
}

.quotations-table th.sortable-th.sorted-active {
  color: var(--text-primary);
}

.quotations-table th.sortable-th.sorted-active .sort-icon {
  opacity: 1;
  color: var(--text-primary);
}

.quotations-table th.sortable-th.sorted-asc .sort-icon {
  transform: rotate(180deg);
}

.quotations-table th.sortable-th.sorted-desc .sort-icon {
  transform: rotate(0deg);
}

/* Column alignments */
.quotations-table th.text-right,
.quotations-table td.text-right {
  text-align: right;
}

.quotations-table th.text-right .th-inner {
  justify-content: flex-end;
}

.quotations-table th.text-center,
.quotations-table td.text-center {
  text-align: center;
}

.quotations-table th.text-center .th-inner {
  justify-content: center;
}

/* Table Body Rows (Increased 50px comfortable row height) */
.quotations-table tbody tr {
  height: 50px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

#catalog-card .quotations-table tbody tr,
#customers-card .quotations-table tbody tr {
  cursor: default;
}

.quotations-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

.quotations-table td {
  height: 50px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  box-sizing: border-box;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quotations-table tbody tr:last-child td {
  border-bottom: none;
}

/* Cell 1: Quote */
.quote-no-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Cell 2: Customer with Mobile Number */
.customer-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

.customer-name {
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.customer-mobile {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Cell 3: Date */
.date-cell {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Cell 4: Items */
.items-cell {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Cell 5: Total */
.grand-total-cell {
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-semibold);
  font-size: 13px;
  color: var(--text-primary);
}

/* Cell 6: Due */
.outstanding-cell {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
}

.outstanding-zero {
  color: var(--text-muted);
}

.outstanding-due {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Cell 7: Minimal Coloured Status Icons (Uniform & Sleek)
   -------------------------------------------------------------------------- */
.status-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-sizing: border-box;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: default;
}

.status-icon-badge:hover {
  transform: scale(1.12);
}

.status-icon-badge svg {
  width: 13.5px;
  height: 13.5px;
  flex-shrink: 0;
}

/* 1. Paid: Emerald Green */
.status-icon-badge.status-paid {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

:root[data-theme="dark"] .status-icon-badge.status-paid {
  background-color: rgba(52, 211, 153, 0.16);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.32);
}

/* 2. Partially Paid: Amber/Gold */
.status-icon-badge.status-partially-paid {
  background-color: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

:root[data-theme="dark"] .status-icon-badge.status-partially-paid {
  background-color: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.32);
}

/* 3. Not Paid: Coral/Red */
.status-icon-badge.status-notpaid {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

:root[data-theme="dark"] .status-icon-badge.status-notpaid {
  background-color: rgba(248, 113, 113, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.32);
}

/* 4. Open: Sky Blue */
.status-icon-badge.status-open {
  background-color: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.28);
}

:root[data-theme="dark"] .status-icon-badge.status-open {
  background-color: rgba(96, 165, 250, 0.16);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.32);
}

/* --------------------------------------------------------------------------
   2b. Parts Catalog Table Cells (Part Number, Name, HSN, MRP, GST Rate)
   -------------------------------------------------------------------------- */
.part-no-cell {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.part-name-cell {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.hsn-cell {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.mrp-cell {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.gst-rate-cell {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   2c. Customers / Contacts Table Cells (Phone Number, Name)
   -------------------------------------------------------------------------- */
.phone-cell {
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.contact-name-cell {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   3. Separate Bottom Footer Cards (Left: Pagination Info, Right: Load More)
   -------------------------------------------------------------------------- */
.quotations-footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
  box-sizing: border-box;
}

.quotations-footer-container.footer-container-right {
  justify-content: flex-end;
}

.footer-card {
  height: 38px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.footer-card-left {
  padding: 0 14px;
}

.footer-card-right {
  padding: 0;
  min-width: 145px;
  justify-content: center;
  overflow: hidden;
}

.pagination-info-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.pagination-info-text .highlight {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.btn-load-more {
  width: 100%;
  height: 100%;
  min-width: 145px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  box-sizing: border-box;
}

.btn-load-more:not(:disabled):hover {
  background-color: var(--bg-tertiary);
}

.btn-load-more:disabled,
.btn-load-more.all-loaded {
  background-color: transparent;
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   4. Empty State (Zero Search / Filter Matches)
   -------------------------------------------------------------------------- */
.quotations-empty-state {
  display: none;
  padding: var(--space-10) var(--space-6);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
}

.quotations-empty-state.active {
  display: flex;
}

.empty-state-icon {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  stroke-width: 1.5;
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.empty-state-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0;
}

.empty-state-btn {
  margin-top: var(--space-2);
  padding: 6px 14px;
  background-color: var(--text-primary);
  color: var(--text-inverted);
  border: 1px solid var(--text-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.empty-state-btn:hover {
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   5. Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .quotations-advanced-search-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .adv-search-fields-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    width: 100%;
  }

  .adv-field-block {
    width: 100%;
  }

  .adv-text-input,
  .adv-select-input {
    width: 100%;
  }

  .adv-date-range-box {
    width: 100%;
  }

  .adv-date-input {
    flex: 1;
    width: 100%;
  }

  .adv-search-actions-group {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  /* Mobile Header & Collapsible Search Behavior (Hides title, expands search to fill space, protects three-dots button) */
  .quotations-view-header.search-expanded .view-header-left,
  .quotations-view-header:has(.collapsible-search-wrapper.expanded) .view-header-left,
  .quotations-view-header:has(.collapsible-search-wrapper:focus-within) .view-header-left {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    margin: 0;
    padding: 0;
  }

  .quotations-view-header.search-expanded .view-header-actions,
  .quotations-view-header:has(.collapsible-search-wrapper.expanded) .view-header-actions,
  .quotations-view-header:has(.collapsible-search-wrapper:focus-within) .view-header-actions {
    flex: 1;
    width: 100%;
    min-width: 0;
  }

  .quotations-view-header.search-expanded .collapsible-search-wrapper,
  .quotations-view-header:has(.collapsible-search-wrapper.expanded) .collapsible-search-wrapper,
  .quotations-view-header:has(.collapsible-search-wrapper:focus-within) .collapsible-search-wrapper {
    flex: 1;
    width: 100% !important;
    max-width: calc(100% - 46px) !important;
  }
}

@media (max-width: 520px) {
  .adv-search-fields-group {
    grid-template-columns: 1fr;
  }

  .adv-search-actions-group {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .btn-adv-submit,
  .btn-adv-reset {
    flex: 1;
    justify-content: center;
  }

  .quotations-table th,
  .quotations-table td {
    padding: 6px 10px;
  }

  .quotations-footer-container {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    width: 100%;
  }

  .footer-card {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .btn-load-more {
    width: 100%;
  }
}

/* ==========================================================================
   6. Import Parts Popup Modal & Options
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.97);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.btn-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  padding: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.btn-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 75vh;
}

/* Hidden Native File Input (Guarantees zero browser default file picker button) */
#parts-file-input,
.visually-hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
}

/* Upload Drop Zone (Aesthetic & Minimal) */
.modal-upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  background-color: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.modal-upload-zone:hover,
.modal-upload-zone.dragover {
  border-color: var(--text-primary);
  background-color: var(--bg-tertiary);
  transform: translateY(-1px);
}

.upload-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.upload-icon {
  width: 22px;
  height: 22px;
}

.upload-prompt {
  font-size: 13.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin: 0;
}

.upload-browse-link {
  color: #3b82f6;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: var(--font-weight-semibold);
}

.upload-support-text {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Selected File Preview Badge */
.selected-file-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  gap: 12px;
}

.file-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.file-info-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.file-ready-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.ready-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.modal-subtitle.is-ready {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

.file-badge-icon {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name-text {
  font-size: 12.5px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-remove-file {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  padding: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-remove-file:hover {
  background: var(--text-primary);
  color: var(--text-inverted);
}

/* Dual-Stage Smooth Progress View (S3 Upload & DynamoDB Parts Update) */
.import-progress-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.progress-stage-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.progress-stage-card.is-active {
  border-color: rgba(59, 130, 246, 0.4);
  background-color: rgba(59, 130, 246, 0.04);
}

.progress-stage-card.is-completed {
  border-color: rgba(34, 197, 94, 0.35);
  background-color: rgba(34, 197, 94, 0.04);
}

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

.stage-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.stage-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.progress-stage-card.is-active .stage-icon-wrap {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.4);
  background-color: rgba(59, 130, 246, 0.1);
  animation: stagePulse 1.8s infinite;
}

.progress-stage-card.is-completed .stage-icon-wrap {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.4);
  background-color: rgba(34, 197, 94, 0.1);
}

@keyframes stagePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
}

.stage-svg {
  width: 16px;
  height: 16px;
}

.stage-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stage-title {
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.stage-subtitle {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-badge {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  padding: 3px 8px;
  border-radius: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.progress-stage-card.is-active .stage-badge {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
  background-color: rgba(59, 130, 246, 0.08);
}

.progress-stage-card.is-completed .stage-badge {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
  background-color: rgba(34, 197, 94, 0.08);
}

.stage-progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.stage-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 240ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.progress-stage-card.is-completed .stage-progress-bar {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.stage-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px 20px;
  border-top: 1px solid var(--border-subtle);
}

.btn-modal-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  line-height: 1;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-modal-cancel:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-strong);
}

.btn-modal-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  height: 38px;
  padding: 0 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: var(--text-primary);
  color: var(--text-inverted);
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: opacity var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.btn-modal-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-modal-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
