/* Presentation only. This sheet is scoped to an already linked chat order. */
.draft-pane-linked { --chat-receipt-backdrop: color-mix(in srgb, var(--surface-subtle, #f5f7fb) 88%, var(--border)); }
.draft-pane-linked .draft-scroll { background: var(--chat-receipt-backdrop); }
.draft-pane-linked .draft-products-step {
  display: flex; flex-direction: column; min-width: 0; gap: 0;
  padding: 10px 10px 12px; border: 0; background: var(--chat-receipt-backdrop);
}
.draft-pane-linked .draft-products-step > .draft-section-head {
  min-height: 26px; margin: 0; padding: 11px 12px 3px;
  border-radius: 12px 12px 0 0; background: var(--surface);
}
.draft-pane-linked .draft-products-step > .draft-section-head h3 {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 0; color: var(--text); font-size: 12px;
}
.draft-pane-linked .draft-products-step > .draft-section-head h3 span {
  display: inline; min-width: 0; height: auto; margin: 0; padding: 0;
  color: var(--text-muted); background: none; font-size: 9px; font-weight: 650; white-space: nowrap;
}
.draft-pane-linked .message-product-picker { margin: 0; border-radius: 0; background: var(--surface); }
.draft-pane-linked .draft-products {
  position: relative; gap: 2px; padding: 3px 12px 19px;
  border-radius: 0 0 12px 12px; background: var(--surface);
}
.draft-pane-linked .draft-products::after {
  content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 7px;
  background: radial-gradient(circle at 5px 0, var(--chat-receipt-backdrop) 4px, transparent 4.5px) 0 0 / 10px 7px repeat-x;
  pointer-events: none;
}
.draft-pane-linked .draft-product.editable {
  min-height: 49px; padding: 4px 0;
  grid-template-columns: 40px minmax(0, 1fr) 58px 49px 18px; column-gap: 4px;
}
.draft-pane-linked .draft-product.editable > .order-volume-photo { width: 40px; height: 43px; }
.draft-pane-linked .draft-product.editable > div:nth-child(2) { min-width: 0; gap: 2px; }
.draft-pane-linked .draft-product.editable > div:nth-child(2) strong {
  display: -webkit-box; overflow: hidden; max-width: none; white-space: normal;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  color: var(--text); font-size: 10px; line-height: 1.22;
}
.draft-pane-linked .draft-product.editable .draft-product-meta { font-size: 8.5px; }
.draft-pane-linked .draft-product.editable .quantity-control {
  width: 58px; height: 26px; grid-template-columns: 17px 24px 17px;
  border-radius: 7px; background: var(--surface-subtle);
}
.draft-pane-linked .draft-item-price-readonly { font-size: 10px; white-space: nowrap; text-align: right; }
.draft-pane-linked .draft-remove-product { width: 18px; height: 25px; }
.draft-pane-linked .message-order-totals {
  gap: 5px; margin: 6px 0 0; padding: 9px 0 0;
  border-top: 1px dashed var(--border-strong); border-bottom: 0;
}
.draft-pane-linked .message-order-totals > span { min-height: 18px; font-size: 10px; }
.draft-pane-linked .message-order-totals > span b { font-size: 10.5px; }
.draft-pane-linked .message-order-totals .draft-grand {
  min-height: 34px; margin-top: 2px; padding-top: 7px;
  border-top: 1px dashed var(--border-strong); font-size: 12px;
}
.draft-pane-linked .message-order-totals .draft-grand b { font-size: 15px; }
.draft-pane-linked .message-order-totals.has-deduction .draft-grand b { color: #c58023; }
.draft-pane-linked .message-order-status {
  gap: 10px; margin-top: 12px; padding: 12px 10px;
  border: 0; border-radius: 12px; background: var(--surface);
}
.draft-pane-linked .message-status-heading { min-height: 27px; color: var(--text); font-size: 11px; }
.draft-pane-linked .message-status-heading .status-notify-toggle { font-size: 9.5px; white-space: nowrap; }
.draft-pane-linked .message-status-heading-actions { gap: 6px; }
.draft-pane-linked .message-quick-status-grid { gap: 5px; }
.draft-pane-linked .message-quick-status-grid button {
  position: relative; min-height: 40px; padding: 6px 5px;
  border-radius: 9px; font-size: 9px; line-height: 1.15;
  white-space: normal; overflow-wrap: normal;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен'] {
  border-color: #ccebd5; color: #317c49; background: #f0f9f2;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный'] {
  border-color: #f0dc9d; color: #83691e; background: #fffbec;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено'] {
  border-color: #f0c9c7; color: #aa3b3e; background: #fff3f2;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен']::before,
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный']::before,
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено']::before {
  content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 4px;
  border-radius: 50%; vertical-align: 1px;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен']::before { background: #418d55; }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный']::before { background: #d5ae2c; }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено']::before { background: #d2464d; }
.draft-pane-linked .message-quick-status-grid button.active::before { display: none; }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен'].active {
  border-color: #418d55; color: #fff; background: #418d55; box-shadow: none;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный'].active {
  border-color: #d5ae2c; color: #fff; background: #d5ae2c; box-shadow: none;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено'].active {
  border-color: #d2464d; color: #fff; background: #d2464d; box-shadow: none;
}
.draft-pane-linked .message-quick-status-grid button.active::after {
  content: '✓'; position: absolute; top: -7px; right: -6px;
  width: 16px; height: 16px; border: 2px solid var(--surface); border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: var(--primary);
  font-size: 10px; line-height: 1;
}
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен'].active::after { background: #418d55; }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный'].active::after { background: #d5ae2c; }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено'].active::after { background: #d2464d; }
.draft-pane-linked .message-receipt-progress { display: grid; gap: 6px; }
.draft-pane-linked .message-receipt-progress-bars,
.draft-pane-linked .message-receipt-progress-labels {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
}
.draft-pane-linked .message-receipt-progress-bars i { height: 5px; border-radius: 5px; background: var(--border); }
.draft-pane-linked [data-receipt-status='Заказ оплачен'] .message-receipt-progress-bars i:first-child { background: #418d55; }
.draft-pane-linked [data-receipt-status='Обработанный'] .message-receipt-progress-bars i:first-child { background: #d5ae2c; }
.draft-pane-linked .message-receipt-progress-labels span { color: var(--text-muted); font-size: 9px; text-align: center; }
.draft-pane-linked .message-receipt-progress-labels span:first-child { color: var(--text); font-weight: 700; }
.draft-pane-linked .message-receipt-next {
  margin: 2px 0 0; padding: 8px 9px; border-radius: 8px;
  color: var(--text-muted); background: var(--surface-subtle);
  font-size: 9px; line-height: 1.3; text-align: center;
}
.draft-pane-linked .message-receipt-next strong { color: var(--text); }
.draft-pane-linked .message-shipment-status .message-status-heading { flex-wrap: wrap; gap: 5px 9px; }
.draft-pane-linked .message-shipment-tracking { font-size: 9.5px; }
.draft-pane-linked .message-shipment-status {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0; row-gap: 8px;
}
.draft-pane-linked .message-shipment-status > .message-status-heading,
.draft-pane-linked .message-shipment-status > .message-shipment-timeline { grid-column: 1 / -1; }
.draft-pane-linked .message-shipment-timeline {
  gap: 4px; margin: 2px 0 0; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.draft-pane-linked .message-shipment-timeline > li { gap: 5px; font-size: 9px; }
.draft-pane-linked .message-shipment-timeline > li::before {
  content: ''; width: 100%; height: 5px; border-radius: 5px; background: var(--border);
}
.draft-pane-linked .message-shipment-timeline > li:first-child::before { background: #efa833; }
.draft-pane-linked .message-shipment-timeline > li.current::before { background: #f0c88f; }
.draft-pane-linked .message-shipment-timeline > li:not(:last-child)::after,
.draft-pane-linked .message-shipment-node { display: none; }
.draft-pane-linked .message-shipment-current {
  min-width: 0; margin-top: 0; padding: 9px 0 9px 10px; border-radius: 8px 0 0 8px;
  color: #9c5a00; background: #fff2df; font-size: 9.5px; text-align: left;
}
.draft-pane-linked .message-shipment-current::before { content: '🚚'; margin-right: 5px; }
.draft-pane-linked .message-shipment-help {
  width: auto; max-width: none; margin: 0; padding: 9px 10px 9px 4px;
  border-radius: 0 8px 8px 0; color: #a36925; background: #fff2df;
  font-size: 0; text-align: right; white-space: nowrap;
}
.draft-pane-linked .message-shipment-help > button { font-size: 9px; font-weight: 700; text-decoration: none; }
.draft-pane-linked .message-shipment-help > button::after { content: ' →'; }
.draft-pane-linked .message-order-spoiler {
  min-width: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--surface);
}
.draft-pane-linked .message-order-status + .message-order-spoiler { margin-top: 12px; border-radius: 12px 12px 0 0; }
.draft-pane-linked .message-order-spoiler > summary { min-height: 48px; padding: 7px 10px !important; }
.draft-pane-linked .message-order-spoiler-icon {
  width: 34px; height: 34px; flex-basis: 34px; border-radius: 8px;
}
.draft-pane-linked .message-order-spoiler summary strong { font-size: 11px; }
.draft-pane-linked .message-order-spoiler summary small { max-width: 185px; font-size: 9px; }
.draft-pane-linked .message-adjustments-section { border-radius: 0 0 12px 12px; border-bottom: 0; }
.draft-pane-linked .message-comment-section { margin-top: 12px; border: 0; border-radius: 12px; }
@media (max-width: 760px) {
  .draft-pane-linked .draft-product.editable { grid-template-columns: 38px minmax(0, 1fr) 58px 46px 18px; column-gap: 3px; }
  .draft-pane-linked .draft-product.editable > .order-volume-photo { width: 38px; height: 41px; }
  .draft-pane-linked .message-status-heading .status-notify-toggle { font-size: 9px; }
}
:root[data-theme='dark'] .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен']:not(.active) { color: #7fe3a0; background: #183025; }
:root[data-theme='dark'] .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный']:not(.active) { color: #f7d977; background: #342c18; }
:root[data-theme='dark'] .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено']:not(.active) { color: #ffa3a3; background: #351f22; }
:root[data-theme='dark'] .draft-pane-linked .message-shipment-current,
:root[data-theme='dark'] .draft-pane-linked .message-shipment-help { color: #f2bd70; background: #332919; }

/* Refine ticket edge and status control contrast. */
.draft-pane-linked .draft-products::after { transform: rotate(180deg); }
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен']::before,
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный']::before,
.draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено']::before { display: none; }
.draft-pane-linked .message-quick-status-grid button.has-status-color:hover:not(:disabled):not(.active) {
  border-color: color-mix(in srgb, var(--status-color) 35%, var(--border));
  background: color-mix(in srgb, var(--status-color) 6%, var(--surface));
}
:root[data-theme='dark'] .draft-pane-linked .message-quick-status-grid button.has-status-color:hover:not(:disabled):not(.active) {
  background: color-mix(in srgb, var(--status-color) 10%, var(--surface));
}

/* Status buttons should gently darken on hover instead of washing out. */
:root .draft-pane-linked .message-quick-status-grid button.has-status-color {
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;
}
:root .draft-pane-linked .message-quick-status-grid button.has-status-color:hover:not(:disabled):not(.active) {
  background: color-mix(in srgb, var(--status-color) 7%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--status-color) 44%, var(--border)) !important;
  filter: brightness(.96);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--status-color) 12%, transparent);
}
:root .draft-pane-linked .message-quick-status-grid button.active.has-status-color:hover:not(:disabled) {
  color: #fff !important;
  filter: brightness(.92);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--status-color) 24%, transparent) !important;
}
:root .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Заказ оплачен'].active:hover:not(:disabled) { background: #397d4c !important; }
:root .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Обработанный'].active:hover:not(:disabled) { background: #c39a20 !important; }
:root .draft-pane-linked .message-quick-status-grid button[data-receipt-status='Отменено'].active:hover:not(:disabled) { background: #bd3b43 !important; }
:root .draft-pane-linked .message-quick-status-grid button.has-status-color:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
