/* Delivery flow v2: scoped additions layered over the existing visual system. */
.v2-file-card,
.v2-decision-card,
.v2-admin-block {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(64, 54, 92, .06);
}

.v2-file-card {
  display: grid;
  gap: 12px;
}

.v2-file-head,
.v2-status-row,
.v2-field-head,
.v2-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.v2-file-head h2,
.v2-admin-block h3,
.v2-modal-head h2 {
  margin: 0;
}

.v2-file-badge,
.v2-action-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--teal2);
  color: #357c70;
  font-size: 12px;
  font-weight: 750;
}

.v2-file-badge.empty {
  background: var(--soft);
  color: var(--muted);
}

.v2-link-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4d4761;
  font-size: 14px;
}

.v2-file-actions,
.v2-decision-actions,
.v2-inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.v2-file-actions .btn,
.v2-decision-actions .btn {
  flex: 1 1 150px;
}

.v2-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.v2-link-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.v2-link-editor input {
  min-width: 0;
}

.v2-retoucher-file {
  margin-top: 2px;
  background: #fbfaff;
}

.v2-retoucher-file .v2-file-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.v2-publish-note {
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8f5ff;
  color: #655f77;
  font-size: 12px;
  line-height: 1.55;
}

.v2-decision-card {
  display: grid;
  gap: 12px;
  background: #fbfaff;
}

.v2-decision-card strong {
  font-size: 15px;
}

.v2-group-comment {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.v2-group-comment textarea {
  min-height: 86px;
}

.v2-warning {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid #f2d8d8;
  background: #fff5f5;
  color: #b74855;
  font-size: 13px;
  line-height: 1.55;
}

.v2-info {
  padding: 11px 13px;
  border-radius: 14px;
  background: #f2f7ff;
  color: #52627e;
  font-size: 13px;
  line-height: 1.55;
}

.v2-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 24, 38, .45);
  backdrop-filter: blur(10px);
}

.v2-modal.hidden {
  display: none;
}

.v2-modal-card {
  width: min(560px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(28, 24, 48, .22);
}

.v2-modal-body {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.v2-confirm-summary {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: #f8f6fc;
  color: #5b566b;
}

.v2-confirm-summary b {
  color: var(--text);
}

.v2-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v2-choice {
  position: relative;
}

.v2-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.v2-choice span {
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: #514b61;
  background: #fff;
  font-weight: 700;
}

.v2-choice input:checked + span {
  border-color: var(--lavender);
  background: var(--lavender-2);
  color: #5e4abb;
  box-shadow: 0 0 0 3px rgba(145, 131, 217, .12);
}

.v2-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.v2-modal-actions .btn {
  flex: 1;
}

.v2-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.v2-admin-block {
  display: grid;
  gap: 10px;
  box-shadow: none;
  background: #fcfbff;
}

.v2-log-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.v2-log-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: #625d70;
  font-size: 12px;
}

.v2-log-item:last-child {
  border-bottom: 0;
}

.v2-log-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--lavender);
}

.v2-customer-file-card {
  margin-bottom: 18px;
}

.customer #customerRevisionLinkPanel.v2-visible {
  display: block !important;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.v2-completed-banner {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  color: #39766b;
  background: var(--teal2);
}

.v2-waiting-banner {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  color: #94615a;
  background: #fff3f1;
}

.v2-old-delivery-hidden {
  display: none !important;
}

.delivery-order-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.delivery-order-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #5e586e;
}

.delivery-order-summary strong {
  color: var(--text);
  font-size: 18px;
}

.delivery-stage-mini {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #e4def0;
  border-radius: 999px;
  background: #faf8fe;
  color: #756e86;
  font-size: 12px;
  font-weight: 800;
}

.delivery-layout-grid {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(0, 1.35fr);
  gap: 14px;
  align-items: start;
}

.delivery-link-column,
.delivery-log-column {
  min-width: 0;
}

.delivery-link-column > .empty,
.delivery-log-column > .empty {
  margin: 0;
}

.delivery-link-column .v2-file-card {
  height: 100%;
}

.delivery-link-block {
  background: #fff;
}

.delivery-link-block > .v2-file-card {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.v2-delivery-status-block,
.v2-delivery-confirm-block {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.v2-delivery-status-block h3,
.v2-delivery-confirm-block h3 {
  margin: 0;
}

.delivery-log-block {
  background: #fff;
}

.delivery-log-column .v2-admin-block {
  height: 100%;
}

.delivery-log-column .v2-log-list {
  max-height: 520px;
}

.v2-legacy-delivery-controls {
  display: none !important;
}

@media (max-width: 760px) {
  .v2-file-card,
  .v2-decision-card,
  .v2-admin-block {
    padding: 15px;
    border-radius: 18px;
  }

  .v2-link-editor,
  .v2-admin-grid,
  .delivery-layout-grid {
    grid-template-columns: 1fr;
  }

  .delivery-order-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .v2-file-actions,
  .v2-decision-actions,
  .v2-retoucher-file .v2-file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .v2-file-actions .btn,
  .v2-decision-actions .btn {
    min-width: 0;
    padding-inline: 10px;
  }

  .v2-file-head {
    align-items: flex-start;
  }

  .v2-modal {
    align-items: end;
    padding: 0;
  }

  .v2-modal-card {
    width: 100%;
    max-height: 88vh;
    border-radius: 26px 26px 0 0;
    padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  }
}
