.red-packet-page {
  display: grid;
  gap: 24px;
}

.red-packet-page[hidden] {
  display: none;
}

.red-packet-field-grid,
.red-packet-process-grid,
.red-packet-option-group {
  display: grid;
  gap: 8px;
}

.red-packet-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.red-packet-option-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.red-packet-process-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 16px;
}

.red-packet-option-group button,
.red-packet-process-grid button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font: inherit;
}

.red-packet-option-group button:hover,
.red-packet-option-group button:focus-visible,
.red-packet-process-grid button:hover,
.red-packet-process-grid button:focus-visible {
  border-color: #3b82f6;
  outline: 2px solid #e2e8f0;
  outline-offset: 2px;
}

.red-packet-option-group button[data-selected='true'],
.red-packet-process-grid button[data-selected='true'] {
  border-color: #ef4444;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
}

.red-packet-option-group button[data-selected='true']::before,
.red-packet-process-grid button[data-selected='true']::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #ef4444;
  content: '';
}

.red-packet-measurement {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.red-packet-process-details {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.red-packet-process-details > [data-red-process-panel],
.red-packet-conditional-panel {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.red-packet-process-details > [data-red-process-panel][hidden],
.red-packet-conditional-panel[hidden],
[data-red-specific-requirement][hidden],
[data-red-box-mark-fields][hidden] {
  display: none;
}

[data-red-process-stack] {
  display: grid;
  gap: 16px;
}

[data-red-process-entry] {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.red-packet-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.red-packet-entry-actions button,
[data-red-box-mark] {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font: inherit;
}

.red-packet-entry-actions button:focus-visible,
[data-red-box-mark]:focus-visible {
  border-color: #3b82f6;
  outline: 2px solid #e2e8f0;
  outline-offset: 2px;
}

[data-red-box-mark][data-selected='true'] {
  border-color: #ef4444;
  color: #0f172a;
  font-weight: 600;
}

.red-packet-subsection {
  display: grid;
  gap: 12px;
  padding-block: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.red-packet-subsection:last-child {
  border-bottom: 0;
}

.field-caption {
  color: #0f172a;
  font-weight: 600;
}

.red-packet-conditional-panel {
  display: grid;
  gap: 16px;
}

.red-packet-conditional-panel p {
  margin: 0;
  color: #64748b;
}

.red-packet-printing {
  max-width: 360px;
}

.red-packet-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, max-content);
  gap: 12px;
}

.red-packet-actions .button {
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .red-packet-process-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .red-packet-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .red-packet-actions > div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .red-packet-field-grid,
  .red-packet-option-group,
  .red-packet-process-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .red-packet-process-details > [data-red-process-panel],
  .red-packet-conditional-panel,
  [data-red-process-entry] {
    padding: 12px;
  }

  .red-packet-actions {
    grid-template-columns: 1fr;
  }

  .red-packet-actions .button {
    width: 100%;
  }
}
