/* Pharmacy details page inside admin.html. Builds on /onboarding/assets/dataque.css. */

.dqp {
  max-width: 1240px;
  color: var(--dq-ink);
  font-family: var(--dq-font);
}
.dqp-muted {
  color: var(--dq-muted);
}
.dqp-small {
  font-size: 13px;
}
.dqp-strong {
  font-weight: 600;
}
.dqp-nowrap {
  white-space: nowrap;
}
.dqp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 320px;
  color: var(--dq-graphite);
}
.dqp-back {
  display: inline-block;
  font-size: 13px;
  color: var(--dq-graphite);
  margin-bottom: 14px;
}
.dqp-error p {
  margin: 0 0 14px;
}
.dqp-inline-err {
  margin: 0 0 12px;
  color: var(--dq-red);
  font-size: 14px;
}

/* Head */
.dqp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.dqp-id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.dqp-logo {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  border: 1px solid var(--dq-line);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 24px;
  font-weight: 600;
  color: var(--dq-graphite);
}
.dqp-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
.dqp-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.dqp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--dq-graphite);
}
.dqp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dqp .dq-btn--sm {
  min-height: 34px;
  padding: 0 16px;
  font-size: 13px;
}

/* KPI strip */
.dqp-kpis {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--dq-line-soft);
  border: 1px solid var(--dq-line-soft);
  border-radius: var(--dq-radius-lg);
  overflow: hidden;
  transition: opacity 0.2s ease;
}
.dqp-kpis.is-busy {
  opacity: 0.55;
}
.dqp-kpi {
  background: #fff;
  padding: 18px 20px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.dqp-kpi__k {
  font-size: 12px;
  color: var(--dq-muted);
}
.dqp-kpi__v {
  font-size: 24px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dqp-kpi--wide .dqp-kpi__v {
  font-size: 32px;
}
.dqp-kpi__sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--dq-muted);
}
.dqp-delta {
  font-weight: 600;
  color: var(--dq-graphite);
  font-variant-numeric: tabular-nums;
}
.dqp-delta.is-up {
  color: var(--dq-green-ink);
}
.dqp-delta.is-down {
  color: var(--dq-red);
}
.dqp-note {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--dq-muted);
}

/* Panels */
.dqp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.dqp-span2 {
  grid-column: span 2;
}
.dqp-span3 {
  grid-column: 1 / -1;
}
.dqp-panel {
  background: #fff;
  border: 1px solid var(--dq-line-soft);
  border-radius: var(--dq-radius-lg);
  padding: 24px;
  min-width: 0;
}
.dqp-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.dqp-panel__head .dqp-muted {
  font-size: 13px;
}
.dqp-empty {
  margin: 0;
  padding: 28px 0;
  text-align: center;
  color: var(--dq-muted);
  font-size: 14px;
}
.dqp-textbtn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--dq-graphite);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.dqp-textbtn:disabled {
  cursor: default;
  text-decoration: none;
}

/* Bar chart (single series: product sales) */
.dqp-chart__plot {
  position: relative;
  height: 300px;
  margin-left: 64px;
}
.dqp-chart__grid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.dqp-chart__tick {
  position: relative;
  border-top: 1px solid var(--dq-line-soft);
  height: 0;
}
.dqp-chart__tick:last-child {
  border-top-color: var(--dq-line);
}
.dqp-chart__tick span {
  position: absolute;
  right: calc(100% + 10px);
  top: -8px;
  font-size: 11px;
  color: var(--dq-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dqp-chart__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.dqp-chart__col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: default;
  outline: none;
}
.dqp-chart__bar {
  display: block;
  width: 100%;
  max-width: 28px;
  background: var(--dq-ink);
  border-radius: 4px 4px 0 0;
  transition: opacity 0.12s ease, background-color 0.12s ease;
}
.dqp-chart__col.is-dim .dqp-chart__bar {
  opacity: 0.35;
}
.dqp-chart__col.is-hover .dqp-chart__bar,
.dqp-chart__col:focus-visible .dqp-chart__bar {
  background: var(--dq-green);
}
.dqp-chart__tip {
  position: absolute;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--dq-line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.dqp-chart__x {
  display: flex;
  gap: 2px;
  margin: 8px 0 0 64px;
}
.dqp-chart__x span {
  flex: 1 1 0;
  min-width: 0;
  font-size: 11px;
  color: var(--dq-muted);
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

/* Status bars */
.dqp-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.dqp-bars li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 14px;
}
.dqp-bars__v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.dqp-bars__track {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--dq-line-soft);
  overflow: hidden;
}
.dqp-bars__track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--dq-graphite);
}
.dqp-bars__track .is-delivered {
  background: var(--dq-green);
}
.dqp-bars__track .is-cancelled,
.dqp-bars__track .is-declined {
  background: var(--dq-red);
}
.dqp-bars__track .is-awaiting_payment,
.dqp-bars__track .is-other {
  background: var(--dq-faint);
}

/* Definition lists */
.dqp-dl {
  margin: 0;
  display: grid;
  gap: 10px;
}
.dqp-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}
.dqp-dl dt {
  color: var(--dq-graphite);
}
.dqp-dl dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow-wrap: anywhere;
}
.dqp-dl dd.is-warn {
  color: var(--dq-amber);
  font-weight: 600;
}
.dqp-dl--tight {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--dq-line-soft);
}
.dqp-dl--stack > div {
  display: grid;
  gap: 2px;
}
.dqp-dl--stack dt {
  font-size: 12px;
  color: var(--dq-muted);
}
.dqp-dl--stack dd {
  text-align: left;
}
.dqp-pre {
  white-space: pre-line;
}
.dqp-split {
  list-style: none;
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--dq-line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dqp-split li {
  display: inline-flex;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--dq-page);
  font-size: 13px;
}

/* Catalogue */
.dqp-cat {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--dq-line-soft);
  border: 1px solid var(--dq-line-soft);
  border-radius: var(--dq-radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.dqp-cat__item {
  background: #fff;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}
.dqp-cat__v {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.dqp-cat__k {
  font-size: 12px;
  color: var(--dq-muted);
}
.dqp-cat__item.is-strong {
  background: var(--dq-green-wash);
}
.dqp-cat__item.is-strong .dqp-cat__v {
  color: var(--dq-green-ink);
}
.dqp-cat__item.is-warn .dqp-cat__v {
  color: var(--dq-amber);
}

/* Tables */
.dqp-tablewrap {
  overflow-x: auto;
  margin: 0 -4px;
}
.dqp-tablewrap--scroll {
  max-height: 260px;
  overflow-y: auto;
}
.dqp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.dqp-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--dq-muted);
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--dq-line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: #fff;
}
.dqp-table td {
  padding: 11px 4px;
  border-bottom: 1px solid var(--dq-line-soft);
  vertical-align: middle;
}
.dqp-table tr:last-child td {
  border-bottom: 0;
}
.dqp-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dqp-sub {
  display: block;
  font-size: 12px;
}
.dqp-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--dq-graphite);
  overflow-wrap: anywhere;
}
.dqp-tag {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--dq-page);
  color: var(--dq-graphite);
}

.dqp-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin: 20px 2px 8px;
  font-size: 12px;
  color: var(--dq-muted);
}

/* Responsive */
@media (max-width: 1100px) {
  .dqp-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dqp-cat {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .dqp-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dqp-span2,
  .dqp-span3 {
    grid-column: auto;
  }
}
@media (max-width: 600px) {
  .dqp-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dqp-kpi--wide {
    grid-column: 1 / -1;
  }
  .dqp-cat {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dqp-panel {
    padding: 18px;
  }
  .dqp-chart__plot,
  .dqp-chart__x {
    margin-left: 52px;
  }
  .dqp-chart__plot {
    height: 200px;
  }
  .dqp-actions .dq-seg {
    width: 100%;
    overflow-x: auto;
  }
  .dqp-hide-sm {
    display: none;
  }
  .dqp-table td:first-child {
    white-space: normal;
  }
}

/* Fill the last cell when a row is short */
@media (max-width: 1100px) and (min-width: 601px) {
  .dqp-cat__item:last-child {
    grid-column: span 2;
  }
}
@media (max-width: 600px) {
  .dqp-kpi:last-child,
  .dqp-cat__item:last-child {
    grid-column: 1 / -1;
  }
}

/* Deal & handover (from the onboarding) */
.dqp-handover__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 28px;
}
.dqp-pinned {
  padding: 10px 0;
  border-top: 1px solid var(--dq-line-soft);
  font-size: 14px;
}
.dqp-pinned:first-child {
  border-top: 0;
  padding-top: 0;
}
.dqp-pinned__top {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
}
.dqp-pinned__tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--dq-page);
  color: var(--dq-graphite);
}
.dqp-pinned__tag.is-deal {
  background: var(--dq-green-wash);
  color: var(--dq-green-ink);
}
.dqp-pinned__tag.is-handover {
  background: var(--dq-amber-wash);
  color: var(--dq-amber);
}
.dqp-pinned__body {
  margin: 4px 0 0;
  color: var(--dq-graphite);
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .dqp-handover__cols {
    grid-template-columns: 1fr;
  }
}
