/* Qalığı Satılmalı — cədvəl (#qsTable) və məhsul seçimi modali */

#qsTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 20px 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

#qsTable thead th {
  background-color: #2E75B6;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  padding: 12px 8px;
  border: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

#qsTable tbody tr {
  transition: background-color 0.15s ease;
}

#qsTable tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

#qsTable tbody tr:hover {
  background-color: #f1f7ff;
  cursor: pointer;
}

#qsTable td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  vertical-align: middle;
}

#qsTable td:first-child {
  text-align: center;
  color: #4b5563;
  font-weight: 500;
}

#qsTable td:nth-child(2) {
  font-weight: 600;
  color: #111827;
}

#qsTable td:nth-child(3) {
  text-align: center;
  font-weight: 700;
  color: #1d4ed8;
  background-color: #e0f2fe;
}

#qsTable td:last-child {
  text-align: right;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  color: #065f46;
}

#qsTable tfoot td {
  background-color: #2E75B6;
  color: white;
  font-weight: 700;
  padding: 12px 16px;
  text-align: right;
  font-size: 15px;
}

#qsTable tfoot td:first-child {
  text-align: left;
  padding-left: 20px;
}

@media (max-width: 768px) {
  #qsTable {
    font-size: 14px;
  }

  #qsTable th,
  #qsTable td {
    padding: 8px 10px;
  }
}

/* —— Məhsul seçimi modalı (#qaliqSatilmaliModal) — premium, simmetrik —— */
#qaliqSatilmaliModal.modal.qs-goods-modal {
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-sizing: border-box;
}

#qaliqSatilmaliModal .modal-content.qs-modal.qs-goods-modal__card {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  margin: 0;

  width: min(640px, 100%);
  max-width: 640px;
  max-height: min(88vh, 720px);

  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 16px;
  padding: 0;
  box-shadow:
    0 4px 8px -2px rgba(15, 23, 42, 0.06),
    0 24px 48px -12px rgba(15, 23, 42, 0.22);

  display: flex;
  flex-direction: column;
  font-size: 13px;
  overflow: hidden;
}

#qaliqSatilmaliModal .qs-goods-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  margin-bottom: 0;
}

#qaliqSatilmaliModal .qs-goods-modal__head-text {
  min-width: 0;
  flex: 1;
}

#qaliqSatilmaliModal .qs-goods-modal__title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.25;
}

#qaliqSatilmaliModal .qs-goods-modal__subtitle {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.35;
}

#qaliqSatilmaliModal .qs-goods-modal__close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.9);
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#qaliqSatilmaliModal .qs-goods-modal__close:hover {
  background: rgba(241, 245, 249, 1);
  color: #0f172a;
}

/* Simmetrik segment: iki bərabər seçim */
#qaliqSatilmaliModal .qs-goods-modal__segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px 10px;
  margin: 0;
}

#qaliqSatilmaliModal .qs-goods-modal__segment-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

#qaliqSatilmaliModal .qs-goods-modal__segment-item:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: #ffffff;
}

#qaliqSatilmaliModal .qs-goods-modal__segment-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

#qaliqSatilmaliModal .qs-goods-modal__segment-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #475569;
  text-align: center;
  line-height: 1.25;
  pointer-events: none;
}

#qaliqSatilmaliModal .qs-goods-modal__segment-item:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.5);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.95) 0%, rgba(219, 234, 254, 0.5) 100%);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12);
}

#qaliqSatilmaliModal .qs-goods-modal__segment-item:has(input:checked) .qs-goods-modal__segment-label {
  color: #1e40af;
}

@supports not selector(:has(*)) {
  #qaliqSatilmaliModal .qs-goods-modal__segment-item input:checked + .qs-goods-modal__segment-label {
    color: #1e40af;
  }
}

/* Axtarış */
#qaliqSatilmaliModal .qs-goods-modal__search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 12px;
  padding: 0 12px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

#qaliqSatilmaliModal .qs-goods-modal__search:focus-within {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#qaliqSatilmaliModal .qs-goods-modal__search-ic {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 13px;
}

#qaliqSatilmaliModal .qs-goods-modal__search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #0f172a;
  outline: none;
}

#qaliqSatilmaliModal .qs-goods-modal__search-input::placeholder {
  color: #94a3b8;
}

#qaliqSatilmaliModal .qs-goods-modal__list {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: min(46vh, 360px);
  overflow: auto;
  margin: 0 16px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(248, 250, 252, 0.65);
  -webkit-overflow-scrolling: touch;
}

/* Footer: iki bərabər düymə */
#qaliqSatilmaliModal .qs-goods-modal__footer {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px 16px;
  margin-top: 0;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.65);
}

#qaliqSatilmaliModal .qs-goods-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

#qaliqSatilmaliModal .qs-goods-modal__btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

#qaliqSatilmaliModal .qs-goods-modal__btn--ghost {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.42);
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#qaliqSatilmaliModal .qs-goods-modal__btn--ghost:hover {
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.42);
}

#qaliqSatilmaliModal .qs-goods-modal__btn--primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(29, 78, 216, 0.35);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

#qaliqSatilmaliModal .qs-goods-modal__btn--primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

#qaliqSatilmaliModal .qs-goods-modal__btn i {
  font-size: 12px;
  opacity: 0.95;
}

/* Siyahı sətirləri */
#qaliqSatilmaliModal .qs-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  background: #ffffff;
  font-size: 12.5px;
  border-radius: 8px;
  margin-bottom: 3px;
  transition: background 0.12s ease;
}

#qaliqSatilmaliModal .qs-row:last-child {
  margin-bottom: 0;
}

#qaliqSatilmaliModal label.qs-row:hover {
  background: rgba(239, 246, 255, 0.5);
}

#qaliqSatilmaliModal .qs-row-header {
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom: none;
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
}

#qaliqSatilmaliModal .qs-row-header > div {
  padding: 2px 0;
}

#qaliqSatilmaliModal .qs-col-check {
  text-align: center;
}

#qaliqSatilmaliModal .qs-col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

#qaliqSatilmaliModal .qs-col-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#qaliqSatilmaliModal .qs-name-main {
  font-size: 12.5px;
  font-weight: 500;
  color: #1e293b;
}

#qaliqSatilmaliModal .qs-col-log {
  text-align: right;
}

#qaliqSatilmaliModal .qs-log-label {
  font-size: 10.5px;
  font-weight: 500;
  color: #64748b;
}

@media (max-width: 520px) {
  #qaliqSatilmaliModal .qs-goods-modal__segment {
    grid-template-columns: 1fr;
  }

  #qaliqSatilmaliModal .qs-goods-modal__footer {
    grid-template-columns: 1fr;
  }

  #qaliqSatilmaliModal .modal-content.qs-modal.qs-goods-modal__card {
    max-height: 92vh;
    border-radius: 14px;
  }

  #qaliqSatilmaliModal .qs-goods-modal__list {
    max-height: min(48vh, 320px);
    margin: 0 12px;
  }

  #qaliqSatilmaliModal .qs-goods-modal__search {
    margin: 0 12px 10px;
  }

  #qaliqSatilmaliModal .qs-goods-modal__segment {
    padding: 10px 12px 8px;
  }
}

/* Apteklər üzrə hesabat — toolbar + nazik düymə cütü + cədvəl altı Sütunlar */
.qs-aptek-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 16px;
  margin-bottom: 4px;
  background: linear-gradient(160deg, #ffffff 0%, #f6f8fc 100%);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 14px;
  box-shadow: 0 2px 12px -4px rgba(15, 23, 42, 0.1);
}

.qs-aptek-toolbar__pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

.qs-aptek-btn {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #0f172a;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.12s ease;
}

.qs-aptek-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.qs-aptek-btn--back {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  min-height: 40px;
  width: auto;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  color: #334155;
}

.qs-aptek-btn--back:hover {
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.48);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

/* Diaqram + Şəkil: nazik, eyni sətir, optimal ölçü */
.qs-aptek-btn--slim {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  min-height: 36px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  color: #334155;
  flex: 0 1 auto;
}

.qs-aptek-btn--slim:hover {
  background: #ffffff;
  border-color: rgba(59, 130, 246, 0.38);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
}

.qs-aptek-btn--slim .qs-aptek-btn__ic {
  font-size: 0.88rem;
  color: #3b82f6;
  opacity: 0.92;
}

.qs-aptek-btn--slim:active,
.qs-aptek-btn--back:active {
  transform: translateY(0.5px);
}

/* Sütunlar — cədvəlin altı */
.qs-aptek-cols-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  margin-bottom: 6px;
}

.qs-aptek-btn--cols {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 22px;
  min-height: 42px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  color: #1e293b;
}

.qs-aptek-btn--cols:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.qs-aptek-btn--cols .qs-aptek-btn__ic {
  font-size: 0.95rem;
  color: #2563eb;
}

.qs-aptek-btn__ic {
  font-size: 1rem;
  line-height: 1;
  color: #2563eb;
}

.qs-aptek-btn--back .qs-aptek-btn__ic {
  font-size: 0.85rem;
  color: #64748b;
}

.qs-aptek-btn__lbl {
  text-align: center;
  max-width: 100%;
}

.qs-aptek-headline {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.018em;
  line-height: 1.45;
  margin: 14px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
}

@media (max-width: 560px) {
  .qs-aptek-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .qs-aptek-toolbar__pair {
    justify-content: stretch;
  }

  .qs-aptek-btn--slim {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 7px 10px;
    font-size: 11px;
    white-space: normal;
    text-align: center;
  }

  .qs-aptek-btn--back {
    width: 100%;
    justify-content: center;
  }
}

/* Sütunlar modalı (Apteklər üzrə cədvəl) — incə, zərif */
.qs-col-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-sizing: border-box;
}

.qs-col-modal__card {
  width: 100%;
  max-width: 400px;
  max-height: min(78vh, 520px);
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  box-shadow:
    0 4px 8px -2px rgba(15, 23, 42, 0.06),
    0 22px 48px -12px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.qs-col-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  flex-shrink: 0;
}

.qs-col-modal__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #0f172a;
  line-height: 1.3;
}

.qs-col-modal__close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.qs-col-modal__close:hover {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
}

.qs-col-modal__body {
  padding: 8px 10px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.qs-col-modal__grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.qs-col-modal__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  font: inherit;
}

.qs-col-modal__row:hover {
  background: rgba(248, 250, 252, 0.98);
}

.qs-col-modal__check {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}

.qs-col-modal__name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  line-height: 1.35;
}

.qs-col-modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 11px;
  border-top: 1px solid rgba(226, 232, 240, 0.92);
  flex-shrink: 0;
}

.qs-col-modal__btn {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 5px 13px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.qs-col-modal__btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.qs-col-modal__btn--ghost {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.42);
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.qs-col-modal__btn--ghost:hover {
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.4);
}

.qs-col-modal__btn--primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(29, 78, 216, 0.35);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.22);
}

.qs-col-modal__btn--primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.28);
}

@media (max-width: 420px) {
  .qs-col-modal__card {
    max-height: 85vh;
    border-radius: 12px;
  }

  .qs-col-modal__actions {
    justify-content: stretch;
  }

  .qs-col-modal__btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }
}
